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
e70ed3fe
Commit
e70ed3fe
authored
Jul 02, 2012
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make self.rerandomize a property accessor that reads from metadata
parent
c5dd4cf3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
11 deletions
+16
-11
common/lib/xmodule/capa_module.py
+16
-11
No files found.
common/lib/xmodule/capa_module.py
View file @
e70ed3fe
...
@@ -112,16 +112,6 @@ class CapaModule(XModule):
...
@@ -112,16 +112,6 @@ class CapaModule(XModule):
if
self
.
show_answer
==
""
:
if
self
.
show_answer
==
""
:
self
.
show_answer
=
"closed"
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
:
if
instance_state
!=
None
:
instance_state
=
json
.
loads
(
instance_state
)
instance_state
=
json
.
loads
(
instance_state
)
if
instance_state
!=
None
and
'attempts'
in
instance_state
:
if
instance_state
!=
None
and
'attempts'
in
instance_state
:
...
@@ -168,6 +158,21 @@ class CapaModule(XModule):
...
@@ -168,6 +158,21 @@ class CapaModule(XModule):
else
:
else
:
raise
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
):
def
get_instance_state
(
self
):
state
=
self
.
lcp
.
get_state
()
state
=
self
.
lcp
.
get_state
()
state
[
'attempts'
]
=
self
.
attempts
state
[
'attempts'
]
=
self
.
attempts
...
@@ -221,7 +226,7 @@ class CapaModule(XModule):
...
@@ -221,7 +226,7 @@ class CapaModule(XModule):
# User submitted a problem, and hasn't reset. We don't want
# User submitted a problem, and hasn't reset. We don't want
# more submissions.
# more submissions.
if
self
.
lcp
.
done
and
self
.
metadata
[
'rerandomize'
]
==
"always"
:
if
self
.
lcp
.
done
and
self
.
rerandomize
==
"always"
:
check_button
=
False
check_button
=
False
save_button
=
False
save_button
=
False
...
...
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