Commit 11525556 by Sarina Canelake

Merge pull request #5253 from mitocw/bdero/fix-psychometrics-opaque-keys

Fixed problems with psychometrics (Opaque Keys)
parents 1cd2d550 efa44003
...@@ -52,9 +52,9 @@ class Command(BaseCommand): ...@@ -52,9 +52,9 @@ class Command(BaseCommand):
# get attempt times from tracking log # get attempt times from tracking log
uname = sm.student.username uname = sm.student.username
tset = TrackingLog.objects.using(db).filter(username=uname, event_type__contains='save_problem_check') tset = TrackingLog.objects.using(db).filter(username=uname, event_type__contains='problem_check')
tset = tset.filter(event_source='server') tset = tset.filter(event_source='server')
tset = tset.filter(event__contains="'%s'" % url) tset = tset.filter(event__contains="'%s'" % usage_key)
checktimes = [x.dtcreated for x in tset] checktimes = [x.dtcreated for x in tset]
pmd.checktimes = checktimes pmd.checktimes = checktimes
if not len(checktimes) == pmd.attempts: if not len(checktimes) == pmd.attempts:
......
...@@ -10,6 +10,7 @@ import logging ...@@ -10,6 +10,7 @@ import logging
import json import json
import math import math
import numpy as np import numpy as np
from opaque_keys.edx.locator import BlockUsageLocator
from scipy.optimize import curve_fit from scipy.optimize import curve_fit
from django.conf import settings from django.conf import settings
...@@ -129,7 +130,14 @@ def problems_with_psychometric_data(course_id): ...@@ -129,7 +130,14 @@ def problems_with_psychometric_data(course_id):
''' '''
pmdset = PsychometricData.objects.using(db).filter(studentmodule__course_id=course_id) pmdset = PsychometricData.objects.using(db).filter(studentmodule__course_id=course_id)
plist = [p['studentmodule__module_state_key'] for p in pmdset.values('studentmodule__module_state_key').distinct()] plist = [p['studentmodule__module_state_key'] for p in pmdset.values('studentmodule__module_state_key').distinct()]
problems = dict((p, pmdset.filter(studentmodule__module_state_key=p).count()) for p in plist) problems = dict(
(
p,
pmdset.filter(
studentmodule__module_state_key=BlockUsageLocator.from_string(p)
).count()
) for p in plist
)
return problems return problems
...@@ -138,7 +146,9 @@ def problems_with_psychometric_data(course_id): ...@@ -138,7 +146,9 @@ def problems_with_psychometric_data(course_id):
def generate_plots_for_problem(problem): def generate_plots_for_problem(problem):
pmdset = PsychometricData.objects.using(db).filter(studentmodule__module_state_key=problem) pmdset = PsychometricData.objects.using(db).filter(
studentmodule__module_state_key=BlockUsageLocator.from_string(problem)
)
nstudents = pmdset.count() nstudents = pmdset.count()
msg = "" msg = ""
plots = [] plots = []
......
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