Commit 131e3120 by Calen Pennington

Try to make psychometrics work with new storage model code

parent a9c5a638
......@@ -297,9 +297,9 @@ def get_module_for_descriptor(user, request, descriptor, model_data_cache, cours
# pass position specified in URL to module through ModuleSystem
system.set('position', position)
system.set('DEBUG', settings.DEBUG)
if settings.MITX_FEATURES.get('ENABLE_PSYCHOMETRICS') and instance_module is not None:
if settings.MITX_FEATURES.get('ENABLE_PSYCHOMETRICS'):
system.set('psychometrics_handler', # set callback for updating PsychometricsData
make_psychometrics_data_update_handler(instance_module))
make_psychometrics_data_update_handler(course_id, user, descriptor.location.url()))
try:
module = descriptor.xmodule(system)
......
......@@ -297,12 +297,18 @@ def generate_plots_for_problem(problem):
#-----------------------------------------------------------------------------
def make_psychometrics_data_update_handler(studentmodule):
def make_psychometrics_data_update_handler(course_id, user, module_state_key):
"""
Construct and return a procedure which may be called to update
the PsychometricsData instance for the given StudentModule instance.
"""
sm = studentmodule
sm = studentmodule.objects.get_or_create(
course_id=course_id,
student=user,
module_state_key=module_state_key,
defaults={'state': '{}', 'module_type': 'problem'},
)
try:
pmd = PsychometricData.objects.using(db).get(studentmodule=sm)
except PsychometricData.DoesNotExist:
......
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