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
c7069be2
Commit
c7069be2
authored
Dec 21, 2012
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Centralize logic for standardizing rerandomize values
parent
e4c06fab
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
6 deletions
+11
-6
common/lib/xmodule/xmodule/capa_module.py
+11
-6
No files found.
common/lib/xmodule/xmodule/capa_module.py
View file @
c7069be2
...
@@ -83,6 +83,16 @@ class Timedelta(ModelType):
...
@@ -83,6 +83,16 @@ class Timedelta(ModelType):
return
' '
.
join
(
values
)
return
' '
.
join
(
values
)
class
Randomization
(
String
):
def
from_json
(
self
,
value
):
if
value
in
(
""
,
"true"
):
return
"always"
elif
value
==
"false"
:
return
"per_student"
to_json
=
from_json
class
ComplexEncoder
(
json
.
JSONEncoder
):
class
ComplexEncoder
(
json
.
JSONEncoder
):
def
default
(
self
,
obj
):
def
default
(
self
,
obj
):
if
isinstance
(
obj
,
complex
):
if
isinstance
(
obj
,
complex
):
...
@@ -103,7 +113,7 @@ class CapaModule(XModule):
...
@@ -103,7 +113,7 @@ class CapaModule(XModule):
graceperiod
=
Timedelta
(
help
=
"Amount of time after the due date that submissions will be accepted"
,
scope
=
Scope
.
settings
)
graceperiod
=
Timedelta
(
help
=
"Amount of time after the due date that submissions will be accepted"
,
scope
=
Scope
.
settings
)
show_answer
=
String
(
help
=
"When to show the problem answer to the student"
,
scope
=
Scope
.
settings
,
default
=
"closed"
)
show_answer
=
String
(
help
=
"When to show the problem answer to the student"
,
scope
=
Scope
.
settings
,
default
=
"closed"
)
force_save_button
=
Boolean
(
help
=
"Whether to force the save button to appear on the page"
,
scope
=
Scope
.
settings
,
default
=
False
)
force_save_button
=
Boolean
(
help
=
"Whether to force the save button to appear on the page"
,
scope
=
Scope
.
settings
,
default
=
False
)
rerandomize
=
String
(
help
=
"When to rerandomize the problem"
,
default
=
"always"
,
scope
=
Scope
.
settings
)
rerandomize
=
Randomization
(
help
=
"When to rerandomize the problem"
,
default
=
"always"
,
scope
=
Scope
.
settings
)
data
=
String
(
help
=
"XML data for the problem"
,
scope
=
Scope
.
content
)
data
=
String
(
help
=
"XML data for the problem"
,
scope
=
Scope
.
content
)
correct_map
=
Object
(
help
=
"Dictionary with the correctness of current student answers"
,
scope
=
Scope
.
student_state
,
default
=
{})
correct_map
=
Object
(
help
=
"Dictionary with the correctness of current student answers"
,
scope
=
Scope
.
student_state
,
default
=
{})
student_answers
=
Object
(
help
=
"Dictionary with the current student responses"
,
scope
=
Scope
.
student_state
)
student_answers
=
Object
(
help
=
"Dictionary with the current student responses"
,
scope
=
Scope
.
student_state
)
...
@@ -174,11 +184,6 @@ class CapaModule(XModule):
...
@@ -174,11 +184,6 @@ class CapaModule(XModule):
# add extra info and raise
# add extra info and raise
raise
Exception
(
msg
),
None
,
sys
.
exc_info
()[
2
]
raise
Exception
(
msg
),
None
,
sys
.
exc_info
()[
2
]
if
self
.
rerandomize
in
(
""
,
"true"
):
self
.
rerandomize
=
"always"
elif
self
.
rerandomize
==
"false"
:
self
.
rerandomize
=
"per_student"
def
new_lcp
(
self
,
state
,
text
=
None
):
def
new_lcp
(
self
,
state
,
text
=
None
):
if
text
is
None
:
if
text
is
None
:
text
=
self
.
data
text
=
self
.
data
...
...
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