Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
code.vt.edu will be down for maintenance from 0530-0630 EDT Wednesday, March 26th
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
7b78fa52
Commit
7b78fa52
authored
12 years ago
by
Calen Pennington
Browse files
Options
Downloads
Patches
Plain Diff
Make self.rerandomize a property accessor that reads from metadata
parent
4ae711c4
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
common/lib/xmodule/capa_module.py
+16
-11
16 additions, 11 deletions
common/lib/xmodule/capa_module.py
with
16 additions
and
11 deletions
common/lib/xmodule/capa_module.py
+
16
−
11
View file @
7b78fa52
...
...
@@ -112,16 +112,6 @@ class CapaModule(XModule):
if
self
.
show_answer
==
""
:
self
.
show_answer
=
"
closed
"
self
.
rerandomize
=
self
.
metadata
.
get
(
'
rerandomize
'
,
'
always
'
)
if
self
.
rerandomize
==
""
or
self
.
rerandomize
==
"
always
"
or
self
.
rerandomize
==
"
true
"
:
self
.
rerandomize
=
"
always
"
elif
self
.
rerandomize
==
"
false
"
or
self
.
rerandomize
==
"
per_student
"
:
self
.
rerandomize
=
"
per_student
"
elif
self
.
rerandomize
==
"
never
"
:
self
.
rerandomize
=
"
never
"
else
:
raise
Exception
(
"
Invalid rerandomize attribute
"
+
self
.
rerandomize
)
if
instance_state
!=
None
:
instance_state
=
json
.
loads
(
instance_state
)
if
instance_state
!=
None
and
'
attempts
'
in
instance_state
:
...
...
@@ -168,6 +158,21 @@ class CapaModule(XModule):
else
:
raise
@property
def
rerandomize
(
self
):
"""
Property accessor that returns self.metadata[
'
rerandomize
'
] in a canonical form
"""
rerandomize
=
self
.
metadata
.
get
(
'
rerandomize
'
,
'
always
'
)
if
rerandomize
in
(
""
,
"
always
"
,
"
true
"
):
return
"
always
"
elif
rerandomize
in
(
"
false
"
,
"
per_student
"
):
return
"
per_student
"
elif
rerandomize
==
"
never
"
:
return
"
never
"
else
:
raise
Exception
(
"
Invalid rerandomize attribute
"
+
rerandomize
)
def
get_instance_state
(
self
):
state
=
self
.
lcp
.
get_state
()
state
[
'
attempts
'
]
=
self
.
attempts
...
...
@@ -221,7 +226,7 @@ class CapaModule(XModule):
# User submitted a problem, and hasn't reset. We don't want
# more submissions.
if
self
.
lcp
.
done
and
self
.
metadata
[
'
rerandomize
'
]
==
"
always
"
:
if
self
.
lcp
.
done
and
self
.
rerandomize
==
"
always
"
:
check_button
=
False
save_button
=
False
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment