Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
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
edx
edx-platform
Commits
e8501c3d
Commit
e8501c3d
authored
Aug 23, 2012
by
kimth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Student must wait XQUEUE_WAITTIME_BETWEEN_REQUESTS between queueing submissions
parent
42050c40
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
5 deletions
+25
-5
common/lib/capa/capa/capa_problem.py
+16
-0
common/lib/xmodule/xmodule/capa_module.py
+8
-5
lms/envs/dev.py
+1
-0
No files found.
common/lib/capa/capa/capa_problem.py
View file @
e8501c3d
...
@@ -29,6 +29,7 @@ from xml.sax.saxutils import unescape
...
@@ -29,6 +29,7 @@ from xml.sax.saxutils import unescape
import
calc
import
calc
from
correctmap
import
CorrectMap
from
correctmap
import
CorrectMap
from
datetime
import
datetime
import
eia
import
eia
import
inputtypes
import
inputtypes
from
util
import
contextualize_text
,
convert_files_to_filenames
from
util
import
contextualize_text
,
convert_files_to_filenames
...
@@ -204,6 +205,21 @@ class LoncapaProblem(object):
...
@@ -204,6 +205,21 @@ class LoncapaProblem(object):
'''
'''
return
any
([
self
.
correct_map
.
is_queued
(
answer_id
)
for
answer_id
in
self
.
correct_map
])
return
any
([
self
.
correct_map
.
is_queued
(
answer_id
)
for
answer_id
in
self
.
correct_map
])
def
get_recentmost_queuetime
(
self
):
'''
Returns a DateTime object that represents the timestamp of the most recent queueing request, or None if not queued
'''
if
not
self
.
is_queued
():
return
None
# Get a list of timestamps of all queueing requests, then convert it to a DateTime object
queuetimes
=
[
self
.
correct_map
.
get_queuetime_str
(
answer_id
)
for
answer_id
in
self
.
correct_map
if
self
.
correct_map
.
is_queued
(
answer_id
)]
queuetimes
=
[
datetime
.
strptime
(
qt
,
'
%
Y
%
m
%
d
%
H
%
M
%
S'
)
for
qt
in
queuetimes
]
return
max
(
queuetimes
)
def
grade_answers
(
self
,
answers
):
def
grade_answers
(
self
,
answers
):
'''
'''
Grade student responses. Called by capa_module.check_problem.
Grade student responses. Called by capa_module.check_problem.
...
...
common/lib/xmodule/xmodule/capa_module.py
View file @
e8501c3d
...
@@ -7,7 +7,8 @@ import traceback
...
@@ -7,7 +7,8 @@ import traceback
import
re
import
re
import
sys
import
sys
from
datetime
import
timedelta
from
datetime
import
datetime
,
timedelta
from
django.conf
import
settings
from
lxml
import
etree
from
lxml
import
etree
from
pkg_resources
import
resource_string
from
pkg_resources
import
resource_string
...
@@ -462,11 +463,13 @@ class CapaModule(XModule):
...
@@ -462,11 +463,13 @@ class CapaModule(XModule):
self
.
system
.
track_function
(
'save_problem_check_fail'
,
event_info
)
self
.
system
.
track_function
(
'save_problem_check_fail'
,
event_info
)
raise
NotFoundError
(
'Problem must be reset before it can be checked again'
)
raise
NotFoundError
(
'Problem must be reset before it can be checked again'
)
# Problem queued. Student should not be able to submit
# Problem queued. Students must wait XQUEUE_WAITTIME_BETWEEN_REQUESTS
'''
if
self
.
lcp
.
is_queued
():
if
self
.
lcp
.
is_queued
():
return {'success': False, 'html': 'Already queued'}
current_time
=
datetime
.
now
()
'''
prev_submit_time
=
self
.
lcp
.
get_recentmost_queuetime
()
if
(
current_time
-
prev_submit_time
)
.
total_seconds
()
<
settings
.
XQUEUE_WAITTIME_BETWEEN_REQUESTS
:
msg
=
'You must wait
%
d seconds between queueing requests'
%
settings
.
XQUEUE_WAITTIME_BETWEEN_REQUESTS
return
{
'success'
:
msg
,
'html'
:
''
}
try
:
try
:
old_state
=
self
.
lcp
.
get_state
()
old_state
=
self
.
lcp
.
get_state
()
...
...
lms/envs/dev.py
View file @
e8501c3d
...
@@ -63,6 +63,7 @@ XQUEUE_INTERFACE = {
...
@@ -63,6 +63,7 @@ XQUEUE_INTERFACE = {
},
},
"basic_auth"
:
(
'anant'
,
'agarwal'
),
"basic_auth"
:
(
'anant'
,
'agarwal'
),
}
}
XQUEUE_WAITTIME_BETWEEN_REQUESTS
=
5
# seconds
# Make the keyedcache startup warnings go away
# Make the keyedcache startup warnings go away
CACHE_TIMEOUT
=
0
CACHE_TIMEOUT
=
0
...
...
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