Commit 85079da3 by Piotr Mitros Committed by pmitros

Minor bug fix/conflict between grades and i4xsystem

parent 747105e3
......@@ -135,7 +135,11 @@ def get_score(user, problem, cache):
if id in cache and response.max_grade != None:
total = response.max_grade
else:
total=float(courseware.modules.capa_module.Module(etree.tostring(problem), "id").max_score())
## HACK 1: We shouldn't specifically reference capa_module
## HACK 2: Backwards-compatibility: This should be written when a grade is saved, and removed from the system
from module_render import I4xSystem
system = I4xSystem(None, None, None)
total=float(courseware.modules.capa_module.Module(system, etree.tostring(problem), "id").max_score())
response.max_grade = total
response.save()
......
......@@ -25,7 +25,8 @@ class I4xSystem(object):
def __init__(self, ajax_url, track_function, render_function, filestore=None):
self.ajax_url = ajax_url
self.track_function = track_function
self.filestore = OSFS(settings.DATA_DIR)
if not filestore:
self.filestore = OSFS(settings.DATA_DIR)
self.render_function = render_function
self.exception404 = Http404
......
......@@ -51,8 +51,11 @@ class XModule(object):
self.item_id = item_id
self.state = state
self.ajax_url = system.ajax_url
self.tracker = system.track_function
self.filestore = system.filestore
self.render_function = system.render_function
if system:
## These are temporary; we really should go
## through self.system.
self.ajax_url = system.ajax_url
self.tracker = system.track_function
self.filestore = system.filestore
self.render_function = system.render_function
self.system = system
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment