diff options
Diffstat (limited to 'stats/templates')
-rw-r--r-- | stats/templates/view_lesson_tracking.html | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/stats/templates/view_lesson_tracking.html b/stats/templates/view_lesson_tracking.html new file mode 100644 index 0000000..fd87d70 --- /dev/null +++ b/stats/templates/view_lesson_tracking.html @@ -0,0 +1,69 @@ +{% extends "manage.html" %} + +{% block title %} Lesson Views {% endblock %} +{% block script %} +<script type="text/javascript"> + function get_time_in_seconds(time) { + var time = time.split(":"); + var hh = parseInt(time[0]); + var mm = parseInt(time[1]); + var ss = parseInt(time[2]); + return hh * 3600 + mm * 60 + ss; + } + + $(document).ready(function() { + $('#stats-table tr').each(function() { + var td = $(this).find("td"); + var elapsed = td.eq(4).html(); + var duration = td.eq(5).html(); + var input = td.eq(6).find("input"); + if (elapsed != undefined && duration != undefined) { + percent = (get_time_in_seconds(elapsed) / get_time_in_seconds(duration)) * 100; + input.val(Math.round(percent)); + } + }); + }); +</script> +{% endblock %} +{% block content %} +<div class="container"> + {% with objects.object_list as trackings %} + <center> + <h3>Statistics for {% with trackings|first as entry %} {{entry.lesson}} {% endwith %}</h3> + </center> + <a class="btn btn-primary" href="{% url 'yaksh:lesson_statistics' course_id lesson_id %}"> + <i class="fa fa-arrow-left"></i> Back + </a> + <br><br> + {% include "yaksh/paginator.html" %} + <br> + <h4><strong>{{total}} student(s) viewed this lesson</strong></h4> + <table class="table table-responsive" id="stats-table"> + <tr> + <th>Sr No.</th> + <th>Student Name</th> + <th>Last access on</th> + <th>Started on</th> + <th>Current Time</th> + <th>Video Duration</th> + <th>Percentage watched</th> + </tr> + {% for track in trackings %} + <tr> + <td>{{ forloop.counter0|add:objects.start_index }}</td> + <td>{{track.user.get_full_name}}</td> + <td>{{track.last_access_time}}</td> + <td>{{track.creation_time}}</td> + <td>{{track.current_time}}</td> + <td>{{track.video_duration}}</td> + <td> + <input type="text" class="form-control" readonly=""> + </td> + </tr> + {% endfor %} + </table> + {% endwith %} + <br> + {% include "yaksh/paginator.html" %} +</div> +{% endblock %}
\ No newline at end of file |