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
0958485b
Commit
0958485b
authored
Jul 17, 2012
by
kimth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update_score: edit existing CorrectMap rather than starting with empty CorrectMap
parent
093ac9d1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
10 deletions
+11
-10
common/lib/capa/capa/capa_problem.py
+6
-6
common/lib/capa/capa/responsetypes.py
+5
-4
No files found.
common/lib/capa/capa/capa_problem.py
View file @
0958485b
...
...
@@ -22,6 +22,7 @@ import random
import
re
import
scipy
import
struct
import
json
from
lxml
import
etree
from
xml.sax.saxutils
import
unescape
...
...
@@ -186,14 +187,13 @@ class LoncapaProblem(object):
Returns an updated CorrectMap
'''
oldcmap
=
self
.
correct_map
newcmap
=
CorrectMap
()
cmap
=
self
.
correct_map
for
responder
in
self
.
responders
.
values
():
if
hasattr
(
responder
,
'update_score'
):
# TODO: Is this the best way to target 'update_score' of CodeResponse?
results
=
responder
.
update_score
(
score_msg
,
oldcmap
,
queuekey
)
newcmap
.
update
(
results
)
self
.
correct_map
=
new
cmap
return
newcmap
# Each LoncapaResponse will update the specific entries of 'cmap' that it's responsible for
cmap
=
responder
.
update_score
(
score_msg
,
cmap
,
queuekey
)
self
.
correct_map
=
cmap
return
cmap
def
is_queued
(
self
):
'''
...
...
common/lib/capa/capa/responsetypes.py
View file @
0958485b
...
...
@@ -695,8 +695,9 @@ class SymbolicResponse(CustomResponse):
class
CodeResponse
(
LoncapaResponse
):
'''
Grade student code using an external server. Unlike ExternalResponse, CodeResponse:
1) Goes through a queueing system (xqueue)
Grade student code using an external server, called 'xqueue'
In contrast to ExternalResponse, CodeResponse has following behavior:
1) Goes through a queueing system
2) Does not do external request for 'get_answers'
'''
...
...
@@ -740,7 +741,7 @@ class CodeResponse(LoncapaResponse):
# Non-null CorrectMap['queuekey'] indicates that the problem has been submitted
cmap
=
CorrectMap
()
for
answer_id
in
idset
:
cmap
.
set
(
answer_id
,
queuekey
=
queuekey
)
cmap
.
set
(
answer_id
,
queuekey
=
queuekey
,
msg
=
'Submitted to queue'
)
return
cmap
...
...
@@ -804,7 +805,7 @@ class CodeResponse(LoncapaResponse):
queuekey
=
random
.
randint
(
0
,
2
**
32
-
1
)
header
.
update
({
'queuekey'
:
queuekey
})
payload
=
{
'xqueue_header'
:
json
.
dumps
(
header
),
# TODO: 'xqueue_header' should eventually be derived from config file
payload
=
{
'xqueue_header'
:
json
.
dumps
(
header
),
# TODO: 'xqueue_header' should eventually be derived from
a
config file
'xml'
:
xmlstr
,
'edX_cmd'
:
'get_score'
,
'edX_tests'
:
self
.
tests
,
...
...
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