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
1e6ddec4
Commit
1e6ddec4
authored
Nov 02, 2012
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add some documentation
parent
5bcfba9e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
common/lib/xmodule/xmodule/self_assessment_module.py
+5
-2
No files found.
common/lib/xmodule/xmodule/self_assessment_module.py
View file @
1e6ddec4
...
...
@@ -28,6 +28,7 @@ log = logging.getLogger("mitx.courseware")
#Set the default number of max attempts. Should be 1 for production
#Set higher for debugging/testing
#maxattempts specified in xml definition overrides this
max_attempts
=
1
def
only_one
(
lst
,
default
=
""
,
process
=
lambda
x
:
x
):
...
...
@@ -98,16 +99,18 @@ class SelfAssessmentModule(XModule):
self
.
max_attempts
=
self
.
metadata
.
get
(
'attempts'
,
None
)
self
.
hint
=
""
#
Pull variables from instance state if available
#
Try setting maxattempts, use default if not available in metadata
if
self
.
max_attempts
is
not
None
:
self
.
max_attempts
=
int
(
self
.
max_attempts
)
else
:
self
.
max_attempts
=
max_attempts
#Load instance state
if
instance_state
is
not
None
:
instance_state
=
json
.
loads
(
instance_state
)
log
.
debug
(
instance_state
)
#Pull variables from instance state if available
if
instance_state
is
not
None
and
'attempts'
in
instance_state
:
self
.
attempts
=
instance_state
[
'attempts'
]
...
...
@@ -131,8 +134,8 @@ class SelfAssessmentModule(XModule):
#Parse definition file
dom2
=
etree
.
fromstring
(
"<selfassessment>"
+
self
.
definition
[
'data'
]
+
"</selfassessment>"
)
#Try setting max_attempts from definition xml
max_attempt_parsed
=
dom2
.
xpath
(
'maxattempts'
)[
0
]
.
text
try
:
self
.
max_attempts
=
int
(
max_attempt_parsed
)
except
:
...
...
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