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
4dabb4ce
Commit
4dabb4ce
authored
Mar 14, 2013
by
Will Daly
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Save button no longer appears for non-randomized problems unlimited attempts
parent
753cc9ec
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
3 deletions
+20
-3
common/lib/xmodule/xmodule/capa_module.py
+7
-1
common/lib/xmodule/xmodule/tests/test_capa_module.py
+13
-2
No files found.
common/lib/xmodule/xmodule/capa_module.py
View file @
4dabb4ce
...
...
@@ -310,11 +310,17 @@ class CapaModule(XModule):
is_survey_question
=
(
self
.
max_attempts
==
0
)
needs_reset
=
self
.
is_completed
()
and
self
.
rerandomize
==
"always"
# If the student has unlimited attempts, and their answers
# are not randomized, then we do not need a save button
# because they can use the "Check" button
if
self
.
max_attempts
is
None
and
self
.
rerandomize
!=
"always"
:
return
False
# If the problem is closed (and not a survey question with max_attempts==0),
# then do NOT show the reset button
# If we're waiting for the user to reset a randomized problem
# then do NOT show the reset button
if
(
self
.
closed
()
and
not
is_survey_question
)
or
needs_reset
:
el
if
(
self
.
closed
()
and
not
is_survey_question
)
or
needs_reset
:
return
False
else
:
return
True
...
...
common/lib/xmodule/xmodule/tests/test_capa_module.py
View file @
4dabb4ce
...
...
@@ -772,13 +772,24 @@ class CapaModuleTest(unittest.TestCase):
module
.
lcp
.
done
=
True
self
.
assertFalse
(
module
.
should_show_save_button
())
# If the user has unlimited attempts and we are not randomizing,
# then do NOT show a save button
# because they can keep using "Check"
module
=
CapaFactory
.
create
(
max_attempts
=
None
,
rerandomize
=
"never"
)
module
.
lcp
.
done
=
False
self
.
assertFalse
(
module
.
should_show_save_button
())
module
=
CapaFactory
.
create
(
max_attempts
=
None
,
rerandomize
=
"never"
)
module
.
lcp
.
done
=
True
self
.
assertFalse
(
module
.
should_show_save_button
())
# Otherwise, DO show the save button
module
=
CapaFactory
.
create
()
module
.
lcp
.
done
=
False
self
.
assertTrue
(
module
.
should_show_save_button
())
# If we're not randomizing
, then we can re-
save
module
=
CapaFactory
.
create
(
rerandomize
=
"never"
)
# If we're not randomizing
and we have limited attempts, then we can
save
module
=
CapaFactory
.
create
(
rerandomize
=
"never"
,
max_attempts
=
2
)
module
.
lcp
.
done
=
True
self
.
assertTrue
(
module
.
should_show_save_button
())
...
...
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