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
4336daf4
Commit
4336daf4
authored
Jul 15, 2015
by
Muhammad Shoaib
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change the allowed time to humanized from,
parent
a4260231
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
55 deletions
+60
-55
edx_proctoring/static/proctoring/js/views/proctored_exam_attempt_view.js
+57
-1
edx_proctoring/static/proctoring/templates/student-proctored-exam-attempts.underscore
+2
-53
edx_proctoring/views.py
+1
-1
No files found.
edx_proctoring/static/proctoring/js/views/proctored_exam_attempt_view.js
View file @
4336daf4
...
@@ -85,10 +85,66 @@ var edx = edx || {};
...
@@ -85,10 +85,66 @@ var edx = edx || {};
collectionChanged
:
function
()
{
collectionChanged
:
function
()
{
this
.
hydrate
();
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
()
{
render
:
function
()
{
if
(
this
.
template
!==
null
)
{
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
({
var
html
=
this
.
template
({
proctored_exam_attempts
:
this
.
collection
.
toJSON
()[
0
].
proctored_exam
_attempts
,
proctored_exam_attempts
:
proctored
_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
});
});
...
...
edx_proctoring/static/proctoring/templates/student-proctored-exam-attempts.underscore
View file @
4336daf4
<div class="wrapper-content wrapper">
<div class="wrapper-content wrapper">
<section class="content">
<section class="content">
<%
var 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;
}
%>
<div class="top-header">
<div class="top-header">
<div class='search-attempts'>
<div class='search-attempts'>
<input type="text" id="search_attempt_id" placeholder="e.g johndoe or john.do@gmail.com" />
<input type="text" id="search_attempt_id" placeholder="e.g johndoe or john.do@gmail.com" />
...
@@ -143,7 +92,7 @@
...
@@ -143,7 +92,7 @@
<td>
<td>
<%- 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> <%=
humanized_time(proctored_exam_attempt.allowed_time_limit_mins)
%></td>
<td> <%=
proctored_exam_attempt.allowed_time_limit_mins
%></td>
<td>
<td>
<% if (proctored_exam_attempt.started_at){ %>
<% if (proctored_exam_attempt.started_at){ %>
<%= new Date(proctored_exam_attempt.started_at).toString("MMMM dd, yyyy HH:MM") %>
<%= new Date(proctored_exam_attempt.started_at).toString("MMMM dd, yyyy HH:MM") %>
...
@@ -165,7 +114,7 @@
...
@@ -165,7 +114,7 @@
<% } %>
<% } %>
<td>
<td>
<% if (proctored_exam_attempt.status){ %>
<% if (proctored_exam_attempt.status){ %>
<a class="remove-attempt" data-attempt-id="<%= proctored_exam_attempt.id %>" >[x]</a>
<a
href="#"
class="remove-attempt" data-attempt-id="<%= proctored_exam_attempt.id %>" >[x]</a>
</td>
</td>
<% } else { %>
<% } else { %>
N/A
N/A
...
...
edx_proctoring/views.py
View file @
4336daf4
...
@@ -42,7 +42,7 @@ from edx_proctoring.serializers import ProctoredExamSerializer
...
@@ -42,7 +42,7 @@ from edx_proctoring.serializers import ProctoredExamSerializer
from
.utils
import
AuthenticatedAPIView
from
.utils
import
AuthenticatedAPIView
ATTEMPTS_PER_PAGE
=
1
ATTEMPTS_PER_PAGE
=
3
LOG
=
logging
.
getLogger
(
"edx_proctoring_views"
)
LOG
=
logging
.
getLogger
(
"edx_proctoring_views"
)
...
...
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