diff options
author | adityacp | 2020-10-24 16:42:10 +0530 |
---|---|---|
committer | adityacp | 2020-10-24 16:42:10 +0530 |
commit | 8747c671d87418be83c8c6b9849e2962cdbb0715 (patch) | |
tree | 73027483efd30183390e3d4f06a87634993ce01c /yaksh/views.py | |
parent | 430c8d1480d897e9fc0dc328bad173642d0a2946 (diff) | |
download | online_test-8747c671d87418be83c8c6b9849e2962cdbb0715.tar.gz online_test-8747c671d87418be83c8c6b9849e2962cdbb0715.tar.bz2 online_test-8747c671d87418be83c8c6b9849e2962cdbb0715.zip |
Improve lesson statistics
Diffstat (limited to 'yaksh/views.py')
-rw-r--r-- | yaksh/views.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/yaksh/views.py b/yaksh/views.py index 69a7414..e01bf86 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -4025,8 +4025,19 @@ def lesson_statistics(request, course_id, lesson_id, toc_id=None): context['course_id'] = course_id if toc_id: per_que_data = TableOfContents.objects.get_question_stats(toc_id) - paginator = Paginator(per_que_data[1], 50) - context['question'] = per_que_data[0] + question = per_que_data[0] + answers = per_que_data[1] + is_percent_reqd = ( + True if question.type == "mcq" or question.type == "mcc" + else False + ) + per_tc_ans, total_count = TableOfContents.objects.get_per_tc_ans( + toc_id, question.type, is_percent_reqd + ) + context['per_tc_ans'] = per_tc_ans + context['total_count'] = total_count + paginator = Paginator(answers, 50) + context['question'] = question page = request.GET.get('page') per_que_data = paginator.get_page(page) context['is_que_data'] = True |