summaryrefslogtreecommitdiff
path: root/yaksh/static
diff options
context:
space:
mode:
authoradityacp2020-11-16 16:54:07 +0530
committeradityacp2020-11-18 17:52:53 +0530
commit5f02880d022053ed07ed218fd52d9e436f6455ee (patch)
tree4596a627d68accb8ac27805a7ce34b7a1c70addb /yaksh/static
parent6aef69d6e5a3eb3dde2d39e0bb9e1dd5b05a8b3c (diff)
downloadonline_test-5f02880d022053ed07ed218fd52d9e436f6455ee.tar.gz
online_test-5f02880d022053ed07ed218fd52d9e436f6455ee.tar.bz2
online_test-5f02880d022053ed07ed218fd52d9e436f6455ee.zip
Change stats and yaksh
- Show total visits per student in lesson statistics - Remove settimeout ajax calls for tracking video positions - Show initial views per lesson in the course modules section
Diffstat (limited to 'yaksh/static')
-rw-r--r--yaksh/static/yaksh/js/show_toc.js26
1 files changed, 13 insertions, 13 deletions
diff --git a/yaksh/static/yaksh/js/show_toc.js b/yaksh/static/yaksh/js/show_toc.js
index 914ab1c..2bedc6a 100644
--- a/yaksh/static/yaksh/js/show_toc.js
+++ b/yaksh/static/yaksh/js/show_toc.js
@@ -27,10 +27,8 @@ $(document).ready(function() {
var total_duration;
player.on('ready loadedmetadata', event => {
total_duration = parseInt(player.duration);
+ store_tracker_time(total_duration);
$("#video_duration").val(get_time_in_hrs(total_duration));
- if (total_duration > 0) {
- start_tracker((total_duration * 1000) / 4, player);
- }
});
player.on('timeupdate', event => {
@@ -44,10 +42,17 @@ $(document).ready(function() {
}
else {
if(player.fullscreen.active) player.fullscreen.exit();
+ player.pause()
url = $("#toc_"+content.id).val();
ajax_call(url, "GET", screen_lock=true);
}
}
+ if(markers.length > 0 && current_time >= markers[track_count]) {
+ track_count++;
+ var csrf = document.getElementById("track-form").elements[0].value;
+ ajax_call($("#track-form").attr("action"), $("#track-form").attr("method"),
+ $("#track-form").serialize(), csrf, screen_lock=false);
+ }
});
player.on('ended', event => {
var csrf = document.getElementById("track-form").elements[0].value;
@@ -57,16 +62,11 @@ $(document).ready(function() {
});
});
-
-function start_tracker(slice_duration, player) {
- setTimeout(function run() {
- if(player && player.playing) {
- var csrf = document.getElementById("track-form").elements[0].value;
- ajax_call($("#track-form").attr("action"), $("#track-form").attr("method"),
- $("#track-form").serialize(), csrf, screen_lock=false);
- }
- setTimeout(run, slice_duration);
- }, slice_duration);
+function store_tracker_time(duration) {
+ marker = duration / 4;
+ for(var i = marker; i <= duration - marker; i = i + marker) {
+ markers.push(i);
+ }
}
function show_topic(description, override) {