summaryrefslogtreecommitdiff
path: root/stats/views.py
diff options
context:
space:
mode:
authorprathamesh2020-11-09 15:52:56 +0530
committerprathamesh2020-11-09 15:52:56 +0530
commitb6f78c5db15cb7e34649ca67f3295dcb1a102bbe (patch)
tree68f1b3b669e1ad265e6b79a227716e2bbc14aa22 /stats/views.py
parent530fb70da288d53be0c7e293121e807ffa2a73c2 (diff)
downloadonline_test-b6f78c5db15cb7e34649ca67f3295dcb1a102bbe.tar.gz
online_test-b6f78c5db15cb7e34649ca67f3295dcb1a102bbe.tar.bz2
online_test-b6f78c5db15cb7e34649ca67f3295dcb1a102bbe.zip
Modify Lesson Statistics
- gives total spent time - sets initial percentage to less than 25% - gives completion status(True or False)
Diffstat (limited to 'stats/views.py')
-rw-r--r--stats/views.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/stats/views.py b/stats/views.py
index f7c028f..53b7cf7 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, LessonLog
+from stats.models import TrackLesson, LessonLog, str_to_time, time_to_seconds
from yaksh.models import Course
from yaksh.decorators import email_verified
@@ -25,12 +25,16 @@ def add_tracker(request, tracker_id):
video_duration = request.POST.get('video_duration')
current_time = request.POST.get('current_video_time')
if current_time:
- track.current_time = current_time
+ track.set_current_time(current_time)
track.video_duration = video_duration
LessonLog.objects.create(
- track_id=track.id, last_access_time=timezone.now()
+ track_id=track.id, current_time=current_time,
+ last_access_time=timezone.now()
)
track.save()
+ if not track.watched:
+ track.set_watched()
+ track.save()
success = True
else:
success = False