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): ...@@ -135,7 +135,11 @@ def get_score(user, problem, cache):
if id in cache and response.max_grade != None: if id in cache and response.max_grade != None:
total = response.max_grade total = response.max_grade
else: 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.max_grade = total
response.save() response.save()
......
...@@ -25,6 +25,7 @@ class I4xSystem(object): ...@@ -25,6 +25,7 @@ class I4xSystem(object):
def __init__(self, ajax_url, track_function, render_function, filestore=None): def __init__(self, ajax_url, track_function, render_function, filestore=None):
self.ajax_url = ajax_url self.ajax_url = ajax_url
self.track_function = track_function self.track_function = track_function
if not filestore:
self.filestore = OSFS(settings.DATA_DIR) self.filestore = OSFS(settings.DATA_DIR)
self.render_function = render_function self.render_function = render_function
self.exception404 = Http404 self.exception404 = Http404
......
...@@ -51,6 +51,9 @@ class XModule(object): ...@@ -51,6 +51,9 @@ class XModule(object):
self.item_id = item_id self.item_id = item_id
self.state = state self.state = state
if system:
## These are temporary; we really should go
## through self.system.
self.ajax_url = system.ajax_url self.ajax_url = system.ajax_url
self.tracker = system.track_function self.tracker = system.track_function
self.filestore = system.filestore self.filestore = system.filestore
......
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