diff options
author | ankitjavalkar | 2020-11-04 18:00:56 +0530 |
---|---|---|
committer | GitHub | 2020-11-04 18:00:56 +0530 |
commit | 2371058b9cf8fd953e8e089ac51702475a102ff7 (patch) | |
tree | 1764959aca48f835be56c0819cddd286aeb8b4df /yaksh/views.py | |
parent | 81f96a24954d375ab32ab8dfb1ee8aba299655c6 (diff) | |
parent | aef2589eadaf7f3252e281286ab1bb83e690ba6a (diff) | |
download | online_test-2371058b9cf8fd953e8e089ac51702475a102ff7.tar.gz online_test-2371058b9cf8fd953e8e089ac51702475a102ff7.tar.bz2 online_test-2371058b9cf8fd953e8e089ac51702475a102ff7.zip |
Merge pull request #784 from adityacp/improve_lesson_stats
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 da5748b..bd8ca5d 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -4012,8 +4012,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 |