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
9e14e22c
Commit
9e14e22c
authored
Jan 08, 2013
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move prompt and rubric to combined open ended instead of defining them in each task
parent
3bf532e1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
16 deletions
+18
-16
common/lib/xmodule/xmodule/combined_open_ended_module.py
+9
-3
common/lib/xmodule/xmodule/open_ended_module.py
+6
-11
common/lib/xmodule/xmodule/openendedchild.py
+3
-0
common/lib/xmodule/xmodule/self_assessment_module.py
+0
-2
No files found.
common/lib/xmodule/xmodule/combined_open_ended_module.py
View file @
9e14e22c
...
...
@@ -98,6 +98,8 @@ class CombinedOpenEndedModule(XModule):
self
.
static_data
=
{
'max_score'
:
self
.
_max_score
,
'max_attempts'
:
self
.
max_attempts
,
'prompt'
:
definition
[
'prompt'
],
'rubric'
:
definition
[
'rubric'
]
}
self
.
task_xml
=
definition
[
'task_xml'
]
...
...
@@ -371,16 +373,20 @@ class CombinedOpenEndedDescriptor(XmlDescriptor, EditingDescriptor):
'hintprompt': 'some-html'
}
"""
expected_children
=
[
'task'
]
expected_children
=
[
'task'
,
'rubric'
,
'prompt'
]
for
child
in
expected_children
:
if
len
(
xml_object
.
xpath
(
child
))
==
0
:
raise
ValueError
(
"Combined Open Ended definition must include at least one '{0}' tag"
.
format
(
child
))
def
parse
(
k
):
def
parse
_task
(
k
):
"""Assumes that xml_object has child k"""
return
[
stringify_children
(
xml_object
.
xpath
(
k
)[
i
])
for
i
in
xrange
(
0
,
len
(
xml_object
.
xpath
(
k
)))]
return
{
'task_xml'
:
parse
(
'task'
)}
def
parse
(
k
):
"""Assumes that xml_object has child k"""
return
xml_object
.
xpath
(
k
)[
0
]
return
{
'task_xml'
:
parse_task
(
'task'
),
'prompt'
:
parse
(
'prompt'
),
'rubric'
:
parse
(
'rubric'
)}
def
definition_to_xml
(
self
,
resource_fs
):
...
...
common/lib/xmodule/xmodule/open_ended_module.py
View file @
9e14e22c
...
...
@@ -40,8 +40,6 @@ class OpenEndedModule(openendedchild.OpenEndedChild):
def
setup_response
(
self
,
system
,
location
,
definition
,
descriptor
):
oeparam
=
definition
[
'oeparam'
]
prompt
=
definition
[
'prompt'
]
rubric
=
definition
[
'rubric'
]
self
.
url
=
definition
.
get
(
'url'
,
None
)
self
.
queue_name
=
definition
.
get
(
'queuename'
,
self
.
DEFAULT_QUEUE
)
...
...
@@ -53,12 +51,12 @@ class OpenEndedModule(openendedchild.OpenEndedChild):
if
oeparam
is
None
:
raise
ValueError
(
"No oeparam found in problem xml."
)
if
prompt
is
None
:
if
self
.
prompt
is
None
:
raise
ValueError
(
"No prompt found in problem xml."
)
if
rubric
is
None
:
if
self
.
rubric
is
None
:
raise
ValueError
(
"No rubric found in problem xml."
)
self
.
_parse
(
oeparam
,
prompt
,
rubric
,
system
)
self
.
_parse
(
oeparam
,
self
.
prompt
,
self
.
rubric
,
system
)
if
self
.
created
==
"True"
and
self
.
state
==
self
.
ASSESSING
:
self
.
created
=
"False"
...
...
@@ -530,7 +528,7 @@ class OpenEndedDescriptor(XmlDescriptor, EditingDescriptor):
}
"""
for
child
in
[
'openended
rubric'
,
'prompt'
,
'openended
param'
]:
for
child
in
[
'openendedparam'
]:
if
len
(
xml_object
.
xpath
(
child
))
!=
1
:
raise
ValueError
(
"Open Ended definition must include exactly one '{0}' tag"
.
format
(
child
))
...
...
@@ -538,10 +536,7 @@ class OpenEndedDescriptor(XmlDescriptor, EditingDescriptor):
"""Assumes that xml_object has child k"""
return
xml_object
.
xpath
(
k
)[
0
]
return
{
'rubric'
:
parse
(
'openendedrubric'
),
'prompt'
:
parse
(
'prompt'
),
'oeparam'
:
parse
(
'openendedparam'
),
}
return
{
'oeparam'
:
parse
(
'openendedparam'
),}
def
definition_to_xml
(
self
,
resource_fs
):
...
...
@@ -553,7 +548,7 @@ class OpenEndedDescriptor(XmlDescriptor, EditingDescriptor):
child_node
=
etree
.
fromstring
(
child_str
)
elt
.
append
(
child_node
)
for
child
in
[
'openended
rubric'
,
'prompt'
,
'openended
param'
]:
for
child
in
[
'openendedparam'
]:
add_child
(
child
)
return
elt
...
...
common/lib/xmodule/xmodule/openendedchild.py
View file @
9e14e22c
...
...
@@ -127,6 +127,9 @@ class OpenEndedChild():
self
.
attempts
=
instance_state
.
get
(
'attempts'
,
0
)
self
.
max_attempts
=
static_data
[
'max_attempts'
]
self
.
prompt
=
static_data
[
'prompt'
]
self
.
rubric
=
static_data
[
'rubric'
]
# Used for progress / grading. Currently get credit just for
# completion (doesn't matter if you self-assessed correct/incorrect).
self
.
_max_score
=
static_data
[
'max_score'
]
...
...
common/lib/xmodule/xmodule/self_assessment_module.py
View file @
9e14e22c
...
...
@@ -33,8 +33,6 @@ log = logging.getLogger("mitx.courseware")
class
SelfAssessmentModule
(
openendedchild
.
OpenEndedChild
):
def
setup_response
(
self
,
system
,
location
,
definition
,
descriptor
):
self
.
rubric
=
definition
[
'rubric'
]
self
.
prompt
=
definition
[
'prompt'
]
self
.
submit_message
=
definition
[
'submitmessage'
]
self
.
hint_prompt
=
definition
[
'hintprompt'
]
...
...
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