diff options
Diffstat (limited to 'yaksh/views.py')
-rw-r--r-- | yaksh/views.py | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/yaksh/views.py b/yaksh/views.py index 7a4810c..dd9090d 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -3000,19 +3000,6 @@ def add_module(request, course_id=None, module_id=None): @login_required @email_verified -def preview_html_text(request): - user = request.user - if not is_moderator(user): - raise Http404('You are not allowed to view this page!') - response_kwargs = {} - response_kwargs['content_type'] = 'application/json' - request_data = json.loads(request.body.decode("utf-8")) - html_text = get_html_text(request_data['description']) - return HttpResponse(json.dumps({"data": html_text}), **response_kwargs) - - -@login_required -@email_verified def get_next_unit(request, course_id, module_id, current_unit_id=None, first_unit=None): user = request.user @@ -4038,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 |