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
617e0295
Commit
617e0295
authored
Nov 05, 2012
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
moved everything to templates, added hint prompt
parent
ffcbdb26
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
9 deletions
+16
-9
common/lib/xmodule/xmodule/self_assessment_module.py
+14
-6
lms/templates/self_assessment_prompt.html
+1
-2
lms/templates/self_assessment_rubric.html
+1
-1
No files found.
common/lib/xmodule/xmodule/self_assessment_module.py
View file @
617e0295
...
...
@@ -52,8 +52,9 @@ class SelfAssessmentModule(XModule):
instance_state
,
shared_state
,
**
kwargs
)
"""
Definition file should have 3 blocks -- prompt, rubric, submitmessage, and one optional attribute, attempts,
which should be an integer that defaults to 1. If it's >1, the student will be able to re-submit after they see
Definition file should have 4 blocks -- prompt, rubric, submitmessage, hintprompt,
and one optional attribute, attempts, which should be an integer that defaults to 1.
If it's >1, the student will be able to re-submit after they see
the rubric. Note: all the submissions are stored.
Sample file:
...
...
@@ -65,6 +66,9 @@ class SelfAssessmentModule(XModule):
<rubric>
Insert grading rubric here. (arbitrary html)
</rubric>
<hintprompt>
Please enter a hint below: (arbitrary html)
</hintprompt>
<submitmessage>
Thanks for submitting! (arbitrary html)
</submitmessage>
...
...
@@ -103,10 +107,11 @@ class SelfAssessmentModule(XModule):
#Try setting maxattempts, use default if not available in metadata
self
.
max_attempts
=
int
(
self
.
metadata
.
get
(
'attempts'
,
MAX_ATTEMPTS
))
#Extract prompt, submission message and rubric from definition file
#Extract prompt, submission message
, hint prompt,
and rubric from definition file
self
.
rubric
=
definition
[
'rubric'
]
self
.
prompt
=
definition
[
'prompt'
]
self
.
submit_message
=
definition
[
'submitmessage'
]
self
.
hint_prompt
=
definition
[
'hintprompt'
]
#set context variables and render template
previous_answer
=
''
...
...
@@ -116,6 +121,7 @@ class SelfAssessmentModule(XModule):
self
.
context
=
{
'prompt'
:
self
.
prompt
,
'rubric'
:
self
.
rubric
,
'hint_prompt'
:
self
.
hint_prompt
,
'previous_answer_given'
:
len
(
self
.
student_answers
)
>
0
,
'previous_answer'
:
previous_answer
,
'ajax_url'
:
system
.
ajax_url
,
...
...
@@ -287,7 +293,7 @@ class SelfAssessmentDescriptor(XmlDescriptor, EditingDescriptor):
'submitmessage' : 'some-html'
}
"""
expected_children
=
[
'rubric'
,
'prompt'
,
'submitmessage'
]
expected_children
=
[
'rubric'
,
'prompt'
,
'submitmessage'
,
'hintprompt'
]
for
child
in
expected_children
:
if
len
(
xml_object
.
xpath
(
child
))
!=
1
:
raise
ValueError
(
"Self assessment definition must include exactly one '{0}' tag"
.
format
(
child
))
...
...
@@ -298,7 +304,9 @@ class SelfAssessmentDescriptor(XmlDescriptor, EditingDescriptor):
return
{
'rubric'
:
parse
(
'rubric'
),
'prompt'
:
parse
(
'prompt'
),
'submitmessage'
:
parse
(
'submitmessage'
),}
'submitmessage'
:
parse
(
'submitmessage'
),
'hintprompt'
:
parse
(
'hintprompt'
),
}
def
definition_to_xml
(
self
,
resource_fs
):
...
...
@@ -310,7 +318,7 @@ class SelfAssessmentDescriptor(XmlDescriptor, EditingDescriptor):
child_node
=
etree
.
fromstring
(
child_str
)
elt
.
append
(
child_node
)
for
child
in
[
'rubric'
,
'prompt'
,
'submitmessage'
]:
for
child
in
[
'rubric'
,
'prompt'
,
'submitmessage'
,
'hintprompt'
]:
add_child
(
child
)
return
elt
lms/templates/self_assessment_prompt.html
View file @
617e0295
<section
class=
"${ section_name }"
>
${ prompt }
% if previous_answer_given:
:
<br/>
Previous answer: ${ previous_answer }
<br/>
<br/>
Previous answer: ${ previous_answer }
<br/>
% endif
<textarea
name=
"answer"
id=
"answer"
cols=
"50"
rows=
"5"
/>
<br/>
<input
type=
"button"
value=
"Check"
id =
"show"
name=
"show"
/>
...
...
lms/templates/self_assessment_rubric.html
View file @
617e0295
...
...
@@ -7,7 +7,7 @@
<option
value=
"correct"
>
Correct
</option>
</select>
<br/>
What hint about this problem would you give to someone?
${ hint_prompt }
<textarea
name=
"hint"
id=
"hint"
cols=
"50"
rows=
"5"
/>
<br/>
<input
type=
"button"
value=
"Save"
id=
"save"
name=
"save"
/>
...
...
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