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
da21783b
Commit
da21783b
authored
Oct 31, 2014
by
Waheed Ahmed
Committed by
Zia Fazal
Apr 07, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed jump_to_id in problem solution.
TNL-729
parent
eea961b4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
1 deletions
+30
-1
common/lib/xmodule/xmodule/capa_base.py
+4
-1
common/lib/xmodule/xmodule/tests/test_capa_module.py
+26
-0
No files found.
common/lib/xmodule/xmodule/capa_base.py
View file @
da21783b
...
...
@@ -811,7 +811,10 @@ class CapaMixin(CapaFields):
new_answers
=
dict
()
for
answer_id
in
answers
:
try
:
new_answer
=
{
answer_id
:
self
.
runtime
.
replace_urls
(
answers
[
answer_id
])}
answer_content
=
self
.
runtime
.
replace_urls
(
answers
[
answer_id
])
if
self
.
runtime
.
replace_jump_to_id_urls
:
answer_content
=
self
.
runtime
.
replace_jump_to_id_urls
(
answer_content
)
new_answer
=
{
answer_id
:
answer_content
}
except
TypeError
:
log
.
debug
(
u'Unable to perform URL substitution on answers[
%
s]:
%
s'
,
answer_id
,
answers
[
answer_id
])
...
...
common/lib/xmodule/xmodule/tests/test_capa_module.py
View file @
da21783b
...
...
@@ -1890,3 +1890,29 @@ class TestProblemCheckTracking(unittest.TestCase):
'variant'
:
''
}
})
def
test_get_answer_with_jump_to_id_urls
(
self
):
"""
Make sure replace_jump_to_id_urls() is called in get_answer.
"""
problem_xml
=
textwrap
.
dedent
(
"""
<problem>
<p>What is 1+4?</p>
<numericalresponse answer="5">
<formulaequationinput />
</numericalresponse>
<solution>
<div class="detailed-solution">
<p>Explanation</p>
<a href="/jump_to_id/c0f8d54964bc44a4a1deb8ecce561ecd">here's the same link to the hint page.</a>
</div>
</solution>
</problem>
"""
)
data
=
dict
()
problem
=
CapaFactory
.
create
(
showanswer
=
'always'
,
xml
=
problem_xml
)
problem
.
runtime
.
replace_jump_to_id_urls
=
Mock
()
problem
.
get_answer
(
data
)
self
.
assertTrue
(
problem
.
runtime
.
replace_jump_to_id_urls
.
called
)
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