summaryrefslogtreecommitdiff
path: root/yaksh/views.py
diff options
context:
space:
mode:
authorPalaparthy Adityachandra2020-11-07 19:07:36 +0530
committerGitHub2020-11-07 19:07:36 +0530
commit39a13424ad5b5d59044bec27530bdad1ccf12c25 (patch)
tree886f3277e1f2399eafa8ff596c72c904aaae18f8 /yaksh/views.py
parent5d320e054cd125582c56a6c25a70ba57f1cccbce (diff)
parentd09ff51b6c957137e705fee73f1808c6333eed7f (diff)
downloadonline_test-39a13424ad5b5d59044bec27530bdad1ccf12c25.tar.gz
online_test-39a13424ad5b5d59044bec27530bdad1ccf12c25.tar.bz2
online_test-39a13424ad5b5d59044bec27530bdad1ccf12c25.zip
Merge pull request #794 from adityacp/video_tracking
Basic tracking for video lessons
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 b3b1e02..95a7218 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)