summaryrefslogtreecommitdiff
path: root/yaksh/views.py
diff options
context:
space:
mode:
authoradityacp2020-09-14 16:04:35 +0530
committeradityacp2020-09-14 16:04:35 +0530
commit98908b86a94da4a2552564e057457c48b46d4ac3 (patch)
tree000d9ed201008020d057ca7b0bdf59514e7f8c2f /yaksh/views.py
parentb1d2b88746fc670d7362f9b4d175d5e570f3ac77 (diff)
downloadonline_test-98908b86a94da4a2552564e057457c48b46d4ac3.tar.gz
online_test-98908b86a94da4a2552564e057457c48b46d4ac3.tar.bz2
online_test-98908b86a94da4a2552564e057457c48b46d4ac3.zip
Show lesson quiz statistics
Diffstat (limited to 'yaksh/views.py')
-rw-r--r--yaksh/views.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/yaksh/views.py b/yaksh/views.py
index c817c51..ab0f95d 100644
--- a/yaksh/views.py
+++ b/yaksh/views.py
@@ -3900,13 +3900,19 @@ def submit_marker_quiz(request, course_id, toc_id):
@login_required
@email_verified
-def lessson_statistics(request, course_id, lesson_id):
+def lesson_statistics(request, course_id, lesson_id, toc_id=None):
user = request.user
course = get_object_or_404(Course, pk=course_id)
if (not is_moderator(user) or
not course.is_creator(user) or not course.is_creator(user)):
raise Http404("You are not allowed to view this page")
- toc = TableOfContents.objects.get_data(course_id, lesson_id)
- return render(request, 'yaksh/show_lesson_statistics.html', {
- 'data': toc,
- })
+ context = {}
+ data = TableOfContents.objects.get_data(course_id, lesson_id)
+ context['data'] = data
+ context['lesson'] = next(iter(data)).lesson
+ context['course_id'] = course_id
+ if toc_id:
+ per_que_data = TableOfContents.objects.get_question_stats(toc_id)
+ context['per_que_data'] = per_que_data
+ context['is_que_data'] = True
+ return render(request, 'yaksh/show_lesson_statistics.html', context)