Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-proctoring
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
edx-proctoring
Commits
4936f7a7
Commit
4936f7a7
authored
Jul 15, 2015
by
Afzal Wali
Committed by
Muhammad Shoaib
Jul 16, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
returned formatted time allowed and the datetimes
parent
be0b4208
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
71 deletions
+19
-71
edx_proctoring/serializers.py
+15
-0
edx_proctoring/static/proctoring/js/views/proctored_exam_attempt_view.js
+1
-56
edx_proctoring/static/proctoring/templates/student-proctored-exam-attempts.underscore
+3
-15
No files found.
edx_proctoring/serializers.py
View file @
4936f7a7
...
...
@@ -2,6 +2,9 @@
from
rest_framework
import
serializers
from
django.contrib.auth.models
import
User
from
edx_proctoring.models
import
ProctoredExam
,
ProctoredExamStudentAttempt
,
ProctoredExamStudentAllowance
from
edx_proctoring.utils
import
humanized_time
DATETIME_FORMAT
=
"
%
b
%
d,
%
Y
%
I:
%
M
%
p"
# "MMMM dd, yyyy HH:MM"
class
StrictBooleanField
(
serializers
.
BooleanField
):
...
...
@@ -68,6 +71,18 @@ class ProctoredExamStudentAttemptSerializer(serializers.ModelSerializer):
"""
proctored_exam
=
ProctoredExamSerializer
()
user
=
UserSerializer
()
allowed_time_limit_mins
=
serializers
.
SerializerMethodField
(
method_name
=
"get_allowed_time_limit_mins"
)
started_at
=
serializers
.
SerializerMethodField
(
method_name
=
"get_started_at"
)
completed_at
=
serializers
.
SerializerMethodField
(
method_name
=
"get_completed_at"
)
def
get_allowed_time_limit_mins
(
self
,
obj
):
return
humanized_time
(
obj
.
allowed_time_limit_mins
)
def
get_started_at
(
self
,
obj
):
return
obj
.
started_at
.
strftime
(
DATETIME_FORMAT
)
if
obj
.
started_at
else
"N/A"
def
get_completed_at
(
self
,
obj
):
return
obj
.
completed_at
.
strftime
(
DATETIME_FORMAT
)
if
obj
.
completed_at
else
"N/A"
class
Meta
:
"""
...
...
edx_proctoring/static/proctoring/js/views/proctored_exam_attempt_view.js
View file @
4936f7a7
...
...
@@ -102,66 +102,11 @@ var edx = edx || {};
collectionChanged
:
function
()
{
this
.
hydrate
();
},
humanized_time
:
function
(
time_in_minutes
)
{
var
hours
=
parseInt
(
time_in_minutes
/
60
);
var
minutes
=
time_in_minutes
%
60
;
var
hours_present
=
false
;
if
(
hours
==
0
)
{
hours_present
=
false
;
var
template
=
""
}
else
if
(
hours
==
1
)
{
template
=
hours
+
" Hour "
;
hours_present
=
true
;
}
else
if
(
hours
>=
2
)
{
console
.
log
(
hours
);
template
=
hours
+
" Hours "
;
hours_present
=
true
}
else
{
template
=
"error"
;
}
if
(
template
!==
"error"
)
{
if
(
minutes
==
0
)
{
if
(
!
hours_present
)
{
template
=
minutes
+
" Minutes"
;
}
}
else
if
(
minutes
==
1
)
{
if
(
hours_present
)
{
template
=
template
+
" and "
+
minutes
+
" Minute"
;
}
else
{
template
=
template
+
minutes
+
" Minute"
;
}
}
else
{
if
(
hours_present
)
{
template
=
template
+
" and "
+
minutes
+
" Minutes"
;
}
else
{
template
=
template
+
minutes
+
" Minutes"
;
}
}
}
return
template
;
},
render
:
function
()
{
if
(
this
.
template
!==
null
)
{
var
attempts
=
this
.
collection
.
toJSON
()[
0
].
proctored_exam_attempts
;
var
proctored_attempts
=
[];
var
self
=
this
;
$
.
each
(
attempts
,
function
(
index
,
attempt
){
attempt
.
allowed_time_limit_mins
=
self
.
humanized_time
(
attempt
.
allowed_time_limit_mins
);
proctored_attempts
.
push
(
attempt
);
});
var
html
=
this
.
template
({
proctored_exam_attempts
:
proctored
_attempts
,
proctored_exam_attempts
:
this
.
collection
.
toJSON
()[
0
].
proctored_exam
_attempts
,
pagination_info
:
this
.
collection
.
toJSON
()[
0
].
pagination_info
,
attempt_url
:
this
.
collection
.
toJSON
()[
0
].
attempt_url
,
inSearchMode
:
this
.
inSearchMode
,
...
...
edx_proctoring/static/proctoring/templates/student-proctored-exam-attempts.underscore
View file @
4936f7a7
...
...
@@ -81,7 +81,7 @@
<th class="username"><%- gettext("Username") %></th>
<th class="exam-name"><%- gettext("Exam Name") %></th>
<th class="attempt-allowed-time"><%- gettext("Allowed Time for Student") %> </th>
<th class="attempt-started-at"><%- gettext("
s
tarted At") %></th>
<th class="attempt-started-at"><%- gettext("
S
tarted At") %></th>
<th class="attempt-completed-at"><%- gettext("Completed At") %> </th>
<th class="attempt-status"><%- gettext("Status") %> </th>
<th class="c_action"><%- gettext("Action") %> </th>
...
...
@@ -97,20 +97,8 @@
<%- interpolate(gettext(' %(exam_display_name)s '), { exam_display_name: proctored_exam_attempt.proctored_exam.exam_name }, true) %>
</td>
<td> <%= proctored_exam_attempt.allowed_time_limit_mins %></td>
<td>
<% if (proctored_exam_attempt.started_at){ %>
<%= new Date(proctored_exam_attempt.started_at).toString("MMMM dd, yyyy HH:MM") %>
<% } else { %>
N/A
<% } %>
</td>
<td>
<% if (proctored_exam_attempt.completed_at){ %>
<%= new Date(proctored_exam_attempt.completed_at).toString("MMMM dd, yyyy HH:MM") %>
<% } else { %>
N/A
<% } %>
<td>
<td> <%= proctored_exam_attempt.started_at %></td>
<td> <%= proctored_exam_attempt.completed_at %></td>
<% if (proctored_exam_attempt.status){ %>
<%= proctored_exam_attempt.status %> </td>
<% } else { %>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment