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
e975174d
Commit
e975174d
authored
Dec 28, 2012
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert self-assessment away from xmodule
parent
4047106e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
13 deletions
+9
-13
common/lib/xmodule/setup.py
+0
-1
common/lib/xmodule/xmodule/combined_open_ended_module.py
+2
-1
common/lib/xmodule/xmodule/self_assessment_module.py
+7
-11
No files found.
common/lib/xmodule/setup.py
View file @
e975174d
...
...
@@ -29,7 +29,6 @@ setup(
"problem = xmodule.capa_module:CapaDescriptor"
,
"problemset = xmodule.seq_module:SequenceDescriptor"
,
"section = xmodule.backcompat_module:SemanticSectionDescriptor"
,
"selfassessment = xmodule.self_assessment_module:SelfAssessmentDescriptor"
,
"sequential = xmodule.seq_module:SequenceDescriptor"
,
"slides = xmodule.backcompat_module:TranslateCustomTagDescriptor"
,
"vertical = xmodule.vertical_module:VerticalDescriptor"
,
...
...
common/lib/xmodule/xmodule/combined_open_ended_module.py
View file @
e975174d
...
...
@@ -107,7 +107,8 @@ class CombinedOpenEndedModule(XModule):
return
True
def
get_html
(
self
):
return
self
.
current_task
.
get_html
()
html
=
self
.
current_task
.
get_html
(
self
.
system
)
return
rewrite_links
(
html
,
self
.
rewrite_content_links
)
def
handle_ajax
(
self
,
dispatch
,
get
):
return
self
.
current_task
.
handle_ajax
(
dispatch
,
get
)
...
...
common/lib/xmodule/xmodule/self_assessment_module.py
View file @
e975174d
...
...
@@ -38,7 +38,7 @@ MAX_ATTEMPTS = 1
# Overriden by max_score specified in xml.
MAX_SCORE
=
1
class
SelfAssessmentModule
(
XModule
):
class
SelfAssessmentModule
():
"""
States:
...
...
@@ -66,9 +66,6 @@ class SelfAssessmentModule(XModule):
def
__init__
(
self
,
system
,
location
,
definition
,
descriptor
,
instance_state
=
None
,
shared_state
=
None
,
**
kwargs
):
XModule
.
__init__
(
self
,
system
,
location
,
definition
,
descriptor
,
instance_state
,
shared_state
,
**
kwargs
)
"""
Definition file should have 4 blocks -- prompt, rubric, submitmessage, hintprompt,
and two optional attributes:
...
...
@@ -116,11 +113,11 @@ class SelfAssessmentModule(XModule):
self
.
state
=
instance_state
.
get
(
'state'
,
'initial'
)
self
.
attempts
=
instance_state
.
get
(
'attempts'
,
0
)
self
.
max_attempts
=
int
(
self
.
metadata
.
get
(
'attempts'
,
MAX_ATTEMPTS
))
self
.
max_attempts
=
int
(
instance_state
.
get
(
'attempts'
,
MAX_ATTEMPTS
))
# Used for progress / grading. Currently get credit just for
# completion (doesn't matter if you self-assessed correct/incorrect).
self
.
_max_score
=
int
(
self
.
metadata
.
get
(
'max_score'
,
MAX_SCORE
))
self
.
_max_score
=
int
(
instance_state
.
get
(
'max_score'
,
MAX_SCORE
))
self
.
rubric
=
definition
[
'rubric'
]
self
.
prompt
=
definition
[
'prompt'
]
...
...
@@ -224,7 +221,7 @@ class SelfAssessmentModule(XModule):
"""Can the module be reset?"""
return
self
.
state
==
self
.
DONE
and
self
.
attempts
<
self
.
max_attempts
def
get_html
(
self
):
def
get_html
(
self
,
system
):
#set context variables and render template
if
self
.
state
!=
self
.
INITIAL
:
latest
=
self
.
latest_answer
()
...
...
@@ -235,17 +232,16 @@ class SelfAssessmentModule(XModule):
context
=
{
'prompt'
:
self
.
prompt
,
'previous_answer'
:
previous_answer
,
'ajax_url'
:
s
elf
.
s
ystem
.
ajax_url
,
'ajax_url'
:
system
.
ajax_url
,
'initial_rubric'
:
self
.
get_rubric_html
(),
'initial_hint'
:
self
.
get_hint_html
(),
'initial_message'
:
self
.
get_message_html
(),
'state'
:
self
.
state
,
'allow_reset'
:
self
.
_allow_reset
(),
}
html
=
self
.
system
.
render_template
(
'self_assessment_prompt.html'
,
context
)
# cdodge: perform link substitutions for any references to course static content (e.g. images
)
return
rewrite_links
(
html
,
self
.
rewrite_content_links
)
html
=
system
.
render_template
(
'self_assessment_prompt.html'
,
context
)
return
html
def
max_score
(
self
):
"""
...
...
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