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
edefa04d
Commit
edefa04d
authored
Aug 22, 2012
by
kimth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Workaround for 500 on showanswer for choiceresponse
parent
9bcd3cd4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
3 deletions
+13
-3
common/lib/capa/capa/responsetypes.py
+1
-1
common/lib/xmodule/xmodule/capa_module.py
+12
-2
No files found.
common/lib/capa/capa/responsetypes.py
View file @
edefa04d
...
...
@@ -557,7 +557,7 @@ class ChoiceResponse(LoncapaResponse):
return
CorrectMap
(
self
.
answer_id
,
'incorrect'
)
def
get_answers
(
self
):
return
{
self
.
answer_id
:
self
.
correct_choices
}
return
{
self
.
answer_id
:
list
(
self
.
correct_choices
)
}
#-----------------------------------------------------------------------------
...
...
common/lib/xmodule/xmodule/capa_module.py
View file @
edefa04d
...
...
@@ -390,9 +390,19 @@ class CapaModule(XModule):
raise
NotFoundError
(
'Answer is not available'
)
else
:
answers
=
self
.
lcp
.
get_question_answers
()
# answers (eg <solution>) may have embedded images
answers
=
dict
(
(
k
,
self
.
system
.
replace_urls
(
answers
[
k
],
self
.
metadata
[
'data_dir'
]))
for
k
in
answers
)
return
{
'answers'
:
answers
}
# but be careful, some problems are using non-string answer dicts
new_answers
=
dict
()
for
answer_id
in
answers
:
try
:
new_answer
=
{
answer_id
:
self
.
system
.
replace_urls
(
answers
[
answer_id
],
self
.
metadata
[
'data_dir'
])}
except
TypeError
:
log
.
debug
(
'Unable to perform URL substitution on answers[
%
s]:
%
s'
%
(
answer_id
,
answers
[
answer_id
]))
new_answer
=
{
answer_id
:
answers
[
answer_id
]}
new_answers
.
update
(
new_answer
)
return
{
'answers'
:
new_answers
}
# Figure out if we should move these to capa_problem?
def
get_problem
(
self
,
get
):
...
...
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