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
95042b75
Commit
95042b75
authored
Sep 10, 2015
by
Chris Dodge
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
better handle accessible remaining time when under one minute
parent
68904231
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
3 deletions
+21
-3
edx_proctoring/tests/test_views.py
+11
-0
edx_proctoring/views.py
+10
-3
No files found.
edx_proctoring/tests/test_views.py
View file @
95042b75
...
@@ -505,6 +505,17 @@ class TestStudentProctoredExamAttempt(LoggedInTestCase):
...
@@ -505,6 +505,17 @@ class TestStudentProctoredExamAttempt(LoggedInTestCase):
# make sure we have the accessible human string
# make sure we have the accessible human string
self
.
assertEqual
(
response_data
[
'accessibility_time_string'
],
'you have 1 hour and 30 minutes remaining'
)
self
.
assertEqual
(
response_data
[
'accessibility_time_string'
],
'you have 1 hour and 30 minutes remaining'
)
# check the special casing of the human string when under a minute
reset_time
=
datetime
.
now
(
pytz
.
UTC
)
+
timedelta
(
minutes
=
90
,
seconds
=
30
)
with
freeze_time
(
reset_time
):
response
=
self
.
client
.
get
(
reverse
(
'edx_proctoring.proctored_exam.attempt'
,
args
=
[
attempt_id
])
)
self
.
assertEqual
(
response
.
status_code
,
200
)
response_data
=
json
.
loads
(
response
.
content
)
self
.
assertEqual
(
response_data
[
'accessibility_time_string'
],
'you have less than a minute remaining'
)
def
test_attempt_ready_to_start
(
self
):
def
test_attempt_ready_to_start
(
self
):
"""
"""
Test to get an attempt with ready_to_start status
Test to get an attempt with ready_to_start status
...
...
edx_proctoring/views.py
View file @
95042b75
...
@@ -296,9 +296,16 @@ class StudentProctoredExamAttempt(AuthenticatedAPIView):
...
@@ -296,9 +296,16 @@ class StudentProctoredExamAttempt(AuthenticatedAPIView):
time_remaining_seconds
=
get_time_remaining_for_attempt
(
attempt
)
time_remaining_seconds
=
get_time_remaining_for_attempt
(
attempt
)
attempt
[
'time_remaining_seconds'
]
=
time_remaining_seconds
attempt
[
'time_remaining_seconds'
]
=
time_remaining_seconds
attempt
[
'accessibility_time_string'
]
=
_
(
'you have {remaining_time} remaining'
)
.
format
(
remaining_time
=
humanized_time
(
int
(
round
(
time_remaining_seconds
/
60.0
,
0
)))
accessibility_time_string
=
_
(
'you have {remaining_time} remaining'
)
.
format
(
)
remaining_time
=
humanized_time
(
int
(
round
(
time_remaining_seconds
/
60.0
,
0
))))
# special case if we are less than a minute, since we don't produce
# text translations of granularity at the seconds range
if
time_remaining_seconds
<
60
:
accessibility_time_string
=
_
(
'you have less than a minute remaining'
)
attempt
[
'accessibility_time_string'
]
=
accessibility_time_string
return
Response
(
return
Response
(
data
=
attempt
,
data
=
attempt
,
...
...
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