From d09ff51b6c957137e705fee73f1808c6333eed7f Mon Sep 17 00:00:00 2001 From: adityacp Date: Sat, 7 Nov 2020 18:54:15 +0530 Subject: Add additional model to store last access for lesson --- stats/views.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'stats/views.py') diff --git a/stats/views.py b/stats/views.py index 3bfe9c3..f7c028f 100644 --- a/stats/views.py +++ b/stats/views.py @@ -7,7 +7,7 @@ from django.core.paginator import Paginator from django.http import Http404 # Local Imports -from stats.models import TrackLesson +from stats.models import TrackLesson, LessonLog from yaksh.models import Course from yaksh.decorators import email_verified @@ -27,7 +27,9 @@ def add_tracker(request, tracker_id): if current_time: track.current_time = current_time track.video_duration = video_duration - track.last_access_time = timezone.now() + LessonLog.objects.create( + track_id=track.id, last_access_time=timezone.now() + ) track.save() success = True else: -- cgit