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
f580bafd
Commit
f580bafd
authored
Aug 22, 2012
by
Calen Pennington
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #496 from MITx/kimth/fix-choiceresponse
Fix for 500 on showanswer for choiceresponse
parents
aa933cb3
edefa04d
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 @
f580bafd
...
...
@@ -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 @
f580bafd
...
...
@@ -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