summaryrefslogtreecommitdiff
path: root/yaksh/views.py
diff options
context:
space:
mode:
authoradityacp2020-11-06 18:19:56 +0530
committeradityacp2020-11-06 18:19:56 +0530
commit5936383ed3ca28ca3c2ed280ca8f75d9ccb98298 (patch)
tree1de3d66e1a95c5f65b34fd470182e21e21f5fe38 /yaksh/views.py
parent46da73d199e227c3f7abfa8d720d073496211b5e (diff)
downloadonline_test-5936383ed3ca28ca3c2ed280ca8f75d9ccb98298.tar.gz
online_test-5936383ed3ca28ca3c2ed280ca8f75d9ccb98298.tar.bz2
online_test-5936383ed3ca28ca3c2ed280ca8f75d9ccb98298.zip
Initial video tracking
Diffstat (limited to 'yaksh/views.py')
-rw-r--r--yaksh/views.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/yaksh/views.py b/yaksh/views.py
index dd9090d..c6bd560 100644
--- a/yaksh/views.py
+++ b/yaksh/views.py
@@ -42,6 +42,7 @@ from yaksh.models import (
LearningUnit, LearningModule, CourseStatus, question_types, Post, Comment,
Topic, TableOfContents, LessonQuizAnswer, MicroManager
)
+from stats.models import TrackLesson
from yaksh.forms import (
UserRegisterForm, UserLoginForm, QuizForm, QuestionForm,
QuestionFilterForm, CourseForm, ProfileForm,
@@ -2817,6 +2818,9 @@ def show_lesson(request, lesson_id, module_id, course_id):
if not learn_unit.is_prerequisite_complete(user, learn_module, course):
msg = "You have not completed previous Lesson/Quiz/Exercise"
return view_module(request, learn_module.id, course_id, msg=msg)
+ track, created = TrackLesson.objects.get_or_create(
+ user_id=user.id, course_id=course_id, lesson_id=lesson_id
+ )
lesson_ct = ContentType.objects.get_for_model(learn_unit.lesson)
title = learn_unit.lesson.name
@@ -2849,7 +2853,7 @@ def show_lesson(request, lesson_id, module_id, course_id):
'course': course, 'state': "lesson", "all_modules": all_modules,
'learning_units': learning_units, "current_unit": learn_unit,
'learning_module': learn_module, 'toc': toc,
- 'contents_by_time': contents_by_time,
+ 'contents_by_time': contents_by_time, 'track_id': track.id,
'comments': comments, 'form': form, 'post': post}
return my_render_to_response(request, 'yaksh/show_video.html', context)