From dba04ab6d8d8432048ef87827ec0e311f86000ec Mon Sep 17 00:00:00 2001 From: Vik Paruchuri Date: Wed, 24 Oct 2012 15:14:06 -0400 Subject: [PATCH] added docstrings --- lms/djangoapps/courseware/module_render.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lms/djangoapps/courseware/module_render.py b/lms/djangoapps/courseware/module_render.py index 94bbc918bf..e0b0c3aaec 100644 --- a/lms/djangoapps/courseware/module_render.py +++ b/lms/djangoapps/courseware/module_render.py @@ -384,6 +384,7 @@ def xqueue_callback(request, course_id, userid, id, dispatch): if instance_module.grade != oldgrade or instance_module.state != old_instance_state: instance_module.save() + #Bin score into range and increment stats score_bucket=get_score_bucket(instance_module.grade, instance_module.max_grade) org, course_num, run=course_id.split("/") statsd.increment("lms.courseware.question_answered", @@ -476,6 +477,7 @@ def modx_dispatch(request, dispatch, location, course_id): instance_module.max_grade != old_instance_max_grade): instance_module.save() + #Bin score into range and increment stats score_bucket=get_score_bucket(instance_module.grade, instance_module.max_grade) org, course_num, run=course_id.split("/") statsd.increment("lms.courseware.question_answered", @@ -530,9 +532,12 @@ def preview_chemcalc(request): return HttpResponse(json.dumps(result)) -#Function to split arbitrary score ranges into 3 buckets. -#Used with statsd tracking. + def get_score_bucket(grade,max_grade): + """ + Function to split arbitrary score ranges into 3 buckets. + Used with statsd tracking. + """ score_bucket="incorrect" if(grade>0 and grade