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
9af87e41
Commit
9af87e41
authored
Jul 18, 2013
by
Renzo Lucioni
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve issues with persistence and sequential bar
parent
1fc4ac86
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
22 deletions
+18
-22
common/lib/xmodule/xmodule/capa_module.py
+10
-3
common/lib/xmodule/xmodule/js/src/capa/display.coffee
+6
-3
common/lib/xmodule/xmodule/js/src/sequence/display.coffee
+1
-1
common/lib/xmodule/xmodule/tests/test_capa_module.py
+1
-15
No files found.
common/lib/xmodule/xmodule/capa_module.py
View file @
9af87e41
...
...
@@ -614,6 +614,13 @@ class CapaModule(CapaFields, XModule):
return
False
def
is_submitted
(
self
):
"""
Used to decide to show or hide RESET or CHECK buttons.
Means that student submitted problem and nothing more.
Problem can be completely wrong.
Pressing RESET button makes this function to return False.
"""
# used by conditional module
return
self
.
lcp
.
done
...
...
@@ -756,7 +763,7 @@ class CapaModule(CapaFields, XModule):
Used if we want to reconfirm we have the right thing e.g. after
several AJAX calls.
"""
return
{
'html'
:
self
.
get_problem_html
()}
return
{
'html'
:
self
.
get_problem_html
(
encapsulate
=
False
)}
@staticmethod
...
...
@@ -936,7 +943,7 @@ class CapaModule(CapaFields, XModule):
self
.
system
.
psychometrics_handler
(
self
.
get_state_for_lcp
())
# render problem into HTML
html
=
self
.
get_problem_html
()
html
=
self
.
get_problem_html
(
encapsulate
=
False
)
return
{
'success'
:
success
,
'contents'
:
html
,
...
...
@@ -1103,7 +1110,7 @@ class CapaModule(CapaFields, XModule):
self
.
system
.
track_function
(
'reset_problem'
,
event_info
)
return
{
'success'
:
True
,
'html'
:
self
.
get_problem_html
()}
'html'
:
self
.
get_problem_html
(
encapsulate
=
False
)}
class
CapaDescriptor
(
CapaFields
,
RawDescriptor
):
...
...
common/lib/xmodule/xmodule/js/src/capa/display.coffee
View file @
9af87e41
...
...
@@ -35,16 +35,19 @@ class @Problem
@
$
(
'input.math'
).
each
(
index
,
element
)
=>
MathJax
.
Hub
.
Queue
[
@
refreshMath
,
null
,
element
]
renderProgressState
:
()
=>
renderProgressState
:
=>
detail
=
@
el
.
data
(
'progress_detail'
)
status
=
@
el
.
data
(
'progress_status'
)
# i18n
progress
=
"(
#{
detail
}
points)"
if
status
==
'none'
and
detail
?
and
detail
.
indexOf
(
'/'
)
>
0
a
=
detail
.
split
(
'/'
)
possible
=
parseInt
(
a
[
1
])
if
possible
==
1
# i18n
progress
=
"(
#{
possible
}
point possible)"
else
# i18n
progress
=
"(
#{
possible
}
points possible)"
@
$
(
'.problem-progress'
).
html
(
progress
)
...
...
@@ -129,7 +132,7 @@ class @Problem
@
setupInputTypes
()
@
bind
()
@
queueing
()
@
renderProgressState
()
@
forceUpdate
response
# TODO add hooks for problem types here by inspecting response.html and doing
# stuff if a div w a class is found
...
...
@@ -256,7 +259,7 @@ class @Problem
analytics
.
track
"Problem Checked"
,
problem_id
:
@
id
answers
:
@
answers
$
.
postWithPrefix
"
#{
@
url
}
/problem_check"
,
@
answers
,
(
response
)
=>
switch
response
.
success
when
'incorrect'
,
'correct'
...
...
common/lib/xmodule/xmodule/js/src/sequence/display.coffee
View file @
9af87e41
...
...
@@ -45,7 +45,7 @@ class @Sequence
new_progress
=
"NA"
_this
=
this
$
(
'.problems-wrapper'
).
each
(
index
)
->
progress
=
$
(
this
).
attr
'progres
s'
progress
=
$
(
this
).
data
'progress_statu
s'
new_progress
=
_this
.
mergeProgress
progress
,
new_progress
@
progressTable
[
@
position
]
=
new_progress
...
...
common/lib/xmodule/xmodule/tests/test_capa_module.py
View file @
9af87e41
...
...
@@ -1248,20 +1248,6 @@ class CapaModuleTest(unittest.TestCase):
other_module
.
get_progress
()
mock_progress
.
assert_called_with
(
1
,
1
)
@patch
(
'xmodule.capa_module.Progress'
)
def
test_get_progress_calculate_progress_fraction
(
self
,
mock_progress
):
"""
Check that score and total are calculated correctly for the progress fraction.
"""
module
=
CapaFactory
.
create
()
module
.
get_progress
()
mock_progress
.
assert_called_with
(
0
,
1
)
other_module
=
CapaFactory
.
create
(
correct
=
True
)
other_module
.
get_progress
()
mock_progress
.
assert_called_with
(
1
,
1
)
def
test_get_html
(
self
):
"""
Check that get_html() calls get_progress() with no arguments.
...
...
@@ -1276,7 +1262,7 @@ class CapaModuleTest(unittest.TestCase):
Check that get_problem() returns the expected dictionary.
"""
module
=
CapaFactory
.
create
()
self
.
assertEquals
(
module
.
get_problem
(
"data"
),
{
'html'
:
module
.
get_problem_html
()})
self
.
assertEquals
(
module
.
get_problem
(
"data"
),
{
'html'
:
module
.
get_problem_html
(
encapsulate
=
False
)})
class
ComplexEncoderTest
(
unittest
.
TestCase
):
...
...
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