Commit c7beb4e5 by Muhammad Shoaib

added the new property for the dateFormat

parent 08460713
...@@ -3,8 +3,6 @@ from rest_framework import serializers ...@@ -3,8 +3,6 @@ from rest_framework import serializers
from django.contrib.auth.models import User from django.contrib.auth.models import User
from edx_proctoring.models import ProctoredExam, ProctoredExamStudentAttempt, ProctoredExamStudentAllowance from edx_proctoring.models import ProctoredExam, ProctoredExamStudentAttempt, ProctoredExamStudentAllowance
DATETIME_FORMAT = "%b %d, %Y %I:%M %p" # "MMMM dd, yyyy HH:MM"
class StrictBooleanField(serializers.BooleanField): class StrictBooleanField(serializers.BooleanField):
""" """
......
...@@ -5,7 +5,17 @@ var edx = edx || {}; ...@@ -5,7 +5,17 @@ var edx = edx || {};
edx.instructor_dashboard = edx.instructor_dashboard || {}; edx.instructor_dashboard = edx.instructor_dashboard || {};
edx.instructor_dashboard.proctoring = edx.instructor_dashboard.proctoring || {}; edx.instructor_dashboard.proctoring = edx.instructor_dashboard.proctoring || {};
var viewHelper = {
getDateFormat: function(date) {
if (date) {
return new Date(date).toString('MMM dd, yyyy h:mmtt');
}
else {
return 'N/A';
}
}
};
edx.instructor_dashboard.proctoring.ProctoredExamAttemptView = Backbone.View.extend({ edx.instructor_dashboard.proctoring.ProctoredExamAttemptView = Backbone.View.extend({
initialize: function (options) { initialize: function (options) {
this.$el = options.el; this.$el = options.el;
...@@ -105,13 +115,15 @@ var edx = edx || {}; ...@@ -105,13 +115,15 @@ var edx = edx || {};
render: function () { render: function () {
if (this.template !== null) { if (this.template !== null) {
var self = this; var self = this;
var html = this.template({ var data = {
proctored_exam_attempts: this.collection.toJSON()[0].proctored_exam_attempts, proctored_exam_attempts: this.collection.toJSON()[0].proctored_exam_attempts,
pagination_info: this.collection.toJSON()[0].pagination_info, pagination_info: this.collection.toJSON()[0].pagination_info,
attempt_url: this.collection.toJSON()[0].attempt_url, attempt_url: this.collection.toJSON()[0].attempt_url,
inSearchMode: this.inSearchMode, inSearchMode: this.inSearchMode,
searchText: this.searchText searchText: this.searchText
}); };
_.extend(data, viewHelper);
var html = this.template(data);
this.$el.html(html); this.$el.html(html);
this.$el.show(); this.$el.show();
} }
......
...@@ -80,7 +80,7 @@ ...@@ -80,7 +80,7 @@
<tr class="exam-attempt-headings"> <tr class="exam-attempt-headings">
<th class="username"><%- gettext("Username") %></th> <th class="username"><%- gettext("Username") %></th>
<th class="exam-name"><%- gettext("Exam Name") %></th> <th class="exam-name"><%- gettext("Exam Name") %></th>
<th class="attempt-allowed-time"><%- gettext("Allowed Time for Student") %> </th> <th class="attempt-allowed-time"><%- gettext("Allowed Time (Minutes)") %> </th>
<th class="attempt-started-at"><%- gettext("Started At") %></th> <th class="attempt-started-at"><%- gettext("Started At") %></th>
<th class="attempt-completed-at"><%- gettext("Completed At") %> </th> <th class="attempt-completed-at"><%- gettext("Completed At") %> </th>
<th class="attempt-status"><%- gettext("Status") %> </th> <th class="attempt-status"><%- gettext("Status") %> </th>
...@@ -97,8 +97,8 @@ ...@@ -97,8 +97,8 @@
<%- interpolate(gettext(' %(exam_display_name)s '), { exam_display_name: proctored_exam_attempt.proctored_exam.exam_name }, true) %> <%- interpolate(gettext(' %(exam_display_name)s '), { exam_display_name: proctored_exam_attempt.proctored_exam.exam_name }, true) %>
</td> </td>
<td> <%= proctored_exam_attempt.allowed_time_limit_mins %></td> <td> <%= proctored_exam_attempt.allowed_time_limit_mins %></td>
<td> <%= proctored_exam_attempt.started_at %></td> <td> <%= getDateFormat(proctored_exam_attempt.started_at) %></td>
<td> <%= proctored_exam_attempt.completed_at %></td> <td> <%= getDateFormat(proctored_exam_attempt.completed_at) %></td>
<td> <td>
<% if (proctored_exam_attempt.status){ %> <% if (proctored_exam_attempt.status){ %>
<%= proctored_exam_attempt.status %> <%= proctored_exam_attempt.status %>
......
...@@ -385,7 +385,7 @@ class TestStudentProctoredExamAttempt(LoggedInTestCase): ...@@ -385,7 +385,7 @@ class TestStudentProctoredExamAttempt(LoggedInTestCase):
) )
attempt_data = { attempt_data = {
'exam_id': proctored_exam.id, 'exam_id': proctored_exam.id,
'attempt_proctored': True, 'external_id': proctored_exam.external_id,
'start_clock': True, 'start_clock': True,
} }
response = self.client.post( response = self.client.post(
...@@ -411,7 +411,7 @@ class TestStudentProctoredExamAttempt(LoggedInTestCase): ...@@ -411,7 +411,7 @@ class TestStudentProctoredExamAttempt(LoggedInTestCase):
) )
attempt_data = { attempt_data = {
'exam_id': proctored_exam.id, 'exam_id': proctored_exam.id,
'attempt_proctored': True, 'external_id': proctored_exam.external_id,
'start_clock': True, 'start_clock': True,
} }
response = self.client.post( response = self.client.post(
...@@ -455,7 +455,7 @@ class TestStudentProctoredExamAttempt(LoggedInTestCase): ...@@ -455,7 +455,7 @@ class TestStudentProctoredExamAttempt(LoggedInTestCase):
attempt_data = { attempt_data = {
'exam_id': proctored_exam.id, 'exam_id': proctored_exam.id,
'attempt_proctored': True, 'external_id': proctored_exam.external_id,
'start_clock': True, 'start_clock': True,
} }
response = self.client.post( response = self.client.post(
...@@ -488,7 +488,7 @@ class TestStudentProctoredExamAttempt(LoggedInTestCase): ...@@ -488,7 +488,7 @@ class TestStudentProctoredExamAttempt(LoggedInTestCase):
) )
attempt_data = { attempt_data = {
'exam_id': proctored_exam.id, 'exam_id': proctored_exam.id,
'attempt_proctored': True, 'external_id': proctored_exam.external_id,
'start_clock': True, 'start_clock': True,
} }
response = self.client.post( response = self.client.post(
...@@ -530,8 +530,7 @@ class TestStudentProctoredExamAttempt(LoggedInTestCase): ...@@ -530,8 +530,7 @@ class TestStudentProctoredExamAttempt(LoggedInTestCase):
) )
attempt_data = { attempt_data = {
'exam_id': proctored_exam.id, 'exam_id': proctored_exam.id,
'attempt_proctored': True, 'external_id': proctored_exam.external_id
'start_clock': False
} }
response = self.client.post( response = self.client.post(
reverse('edx_proctoring.proctored_exam.attempt.collection'), reverse('edx_proctoring.proctored_exam.attempt.collection'),
...@@ -567,8 +566,8 @@ class TestStudentProctoredExamAttempt(LoggedInTestCase): ...@@ -567,8 +566,8 @@ class TestStudentProctoredExamAttempt(LoggedInTestCase):
) )
attempt_data = { attempt_data = {
'exam_id': proctored_exam.id, 'exam_id': proctored_exam.id,
'attempt_proctored': True, 'user_id': self.student_taking_exam.id,
'start_clock': False 'external_id': proctored_exam.external_id
} }
response = self.client.post( response = self.client.post(
reverse('edx_proctoring.proctored_exam.attempt.collection'), reverse('edx_proctoring.proctored_exam.attempt.collection'),
...@@ -603,8 +602,8 @@ class TestStudentProctoredExamAttempt(LoggedInTestCase): ...@@ -603,8 +602,8 @@ class TestStudentProctoredExamAttempt(LoggedInTestCase):
) )
attempt_data = { attempt_data = {
'exam_id': proctored_exam.id, 'exam_id': proctored_exam.id,
'attempt_proctored': True, 'user_id': self.student_taking_exam.id,
'start_clock': False 'external_id': proctored_exam.external_id
} }
response = self.client.post( response = self.client.post(
reverse('edx_proctoring.proctored_exam.attempt.collection'), reverse('edx_proctoring.proctored_exam.attempt.collection'),
...@@ -634,7 +633,7 @@ class TestStudentProctoredExamAttempt(LoggedInTestCase): ...@@ -634,7 +633,7 @@ class TestStudentProctoredExamAttempt(LoggedInTestCase):
attempt_data = { attempt_data = {
'exam_id': proctored_exam.id, 'exam_id': proctored_exam.id,
'start_clock': False, 'start_clock': False,
'attempt_proctored': True 'attempt_proctored': False
} }
# create a exam attempt # create a exam attempt
response = self.client.post( response = self.client.post(
...@@ -680,8 +679,8 @@ class TestStudentProctoredExamAttempt(LoggedInTestCase): ...@@ -680,8 +679,8 @@ class TestStudentProctoredExamAttempt(LoggedInTestCase):
) )
attempt_data = { attempt_data = {
'exam_id': proctored_exam.id, 'exam_id': proctored_exam.id,
'attempt_proctored': True, 'user_id': self.student_taking_exam.id,
'start_clock': False 'external_id': proctored_exam.external_id
} }
response = self.client.post( response = self.client.post(
reverse('edx_proctoring.proctored_exam.attempt.collection'), reverse('edx_proctoring.proctored_exam.attempt.collection'),
...@@ -736,8 +735,9 @@ class TestStudentProctoredExamAttempt(LoggedInTestCase): ...@@ -736,8 +735,9 @@ class TestStudentProctoredExamAttempt(LoggedInTestCase):
attempt_data = { attempt_data = {
'exam_id': proctored_exam.id, 'exam_id': proctored_exam.id,
'start_clock': True, 'user_id': self.user.id,
'attempts_proctored': True 'external_id': proctored_exam.external_id,
'start_clock': True
} }
response = self.client.post( response = self.client.post(
reverse('edx_proctoring.proctored_exam.attempt.collection'), reverse('edx_proctoring.proctored_exam.attempt.collection'),
...@@ -769,8 +769,9 @@ class TestStudentProctoredExamAttempt(LoggedInTestCase): ...@@ -769,8 +769,9 @@ class TestStudentProctoredExamAttempt(LoggedInTestCase):
attempt_data = { attempt_data = {
'exam_id': proctored_exam.id, 'exam_id': proctored_exam.id,
'start_clock': True, 'user_id': self.user.id,
'attempt_proctored': True 'external_id': proctored_exam.external_id,
'start_clock': True
} }
response = self.client.post( response = self.client.post(
reverse('edx_proctoring.proctored_exam.attempt.collection'), reverse('edx_proctoring.proctored_exam.attempt.collection'),
...@@ -805,8 +806,8 @@ class TestStudentProctoredExamAttempt(LoggedInTestCase): ...@@ -805,8 +806,8 @@ class TestStudentProctoredExamAttempt(LoggedInTestCase):
attempt_data = { attempt_data = {
'exam_id': proctored_exam.id, 'exam_id': proctored_exam.id,
'attempt_proctored': True, 'user_id': self.student_taking_exam.id,
'start_clock': True 'external_id': proctored_exam.external_id
} }
response = self.client.post( response = self.client.post(
reverse('edx_proctoring.proctored_exam.attempt.collection'), reverse('edx_proctoring.proctored_exam.attempt.collection'),
...@@ -842,8 +843,8 @@ class TestStudentProctoredExamAttempt(LoggedInTestCase): ...@@ -842,8 +843,8 @@ class TestStudentProctoredExamAttempt(LoggedInTestCase):
# create an attempt but don't start it # create an attempt but don't start it
attempt_data = { attempt_data = {
'attempt_proctored': True,
'exam_id': proctored_exam.id, 'exam_id': proctored_exam.id,
'external_id': proctored_exam.external_id,
'start_clock': False, 'start_clock': False,
} }
response = self.client.post( response = self.client.post(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment