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
2a0c9d0c
Commit
2a0c9d0c
authored
Nov 30, 2012
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle templating within lms
parent
7330bef8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
12 deletions
+13
-12
common/lib/capa/capa/responsetypes.py
+5
-6
lms/templates/open_ended_error.html
+2
-1
lms/templates/open_ended_feedback.html
+6
-5
No files found.
common/lib/capa/capa/responsetypes.py
View file @
2a0c9d0c
...
...
@@ -2035,13 +2035,12 @@ class OpenEndedResponse(LoncapaResponse):
Input:
Dictionary called feedback. Must contain keys seen below.
Output:
Return
success/fail,
error message or feedback template
Return error message or feedback template
"""
if
not
response_items
[
'success'
]:
return
True
,
render_to_string
(
"open_ended_error.html"
,
{
'errors'
:
response_items
[
'feedback'
]})
return
render_to_string
(
"open_ended_error.html"
,
{
'errors'
:
response_items
[
'feedback'
]})
problem_areas
=
response_items
[
'feedback'
]
.
count
(
"</div>"
)
feedback
=
response_items
[
'feedback'
]
...
...
@@ -2049,10 +2048,9 @@ class OpenEndedResponse(LoncapaResponse):
'grader_type'
:
response_items
[
'grader_type'
],
'score'
:
response_items
[
'score'
],
'feedback'
:
feedback
,
'problem_areas'
:
problem_areas
,
})
return
True
,
feedback_template
return
feedback_template
def
_parse_score_msg
(
self
,
score_msg
):
...
...
@@ -2080,7 +2078,7 @@ class OpenEndedResponse(LoncapaResponse):
log
.
error
(
"External grader message should be a JSON-serialized dict."
" Received score_result =
%
s"
%
score_result
)
return
fail
for
tag
in
[
'score'
,
'feedback'
,
'grader_type'
,
'success'
,
'errors'
]:
for
tag
in
[
'score'
,
'feedback'
,
'grader_type'
,
'success'
]:
if
tag
not
in
score_result
:
log
.
error
(
"External grader message is missing required tag: {0}"
.
format
(
tag
))
return
fail
...
...
@@ -2098,6 +2096,7 @@ class OpenEndedResponse(LoncapaResponse):
if
score_ratio
>=.
66
:
correct
=
True
log
.
debug
(
feedback
)
try
:
etree
.
fromstring
(
feedback
)
except
etree
.
XMLSyntaxError
as
err
:
...
...
lms/templates/open_ended_error.html
View file @
2a0c9d0c
...
...
@@ -6,7 +6,7 @@
</div>
<div
class=
"longform"
>
<div
class=
"result-errors"
>
{
errors
}
{
{errors}
}
</div>
</div>
</section>
\ No newline at end of file
lms/templates/open_ended_feedback.html
View file @
2a0c9d0c
...
...
@@ -2,15 +2,15 @@
<header>
Feedback
</header>
<div
class=
"shortform"
>
<div
class=
"result-output"
>
<p>
Score:
${score
}
</p>
% if grader_type=="ML"
<p>
Number of potential problem areas identified: ${problem_areas}
</p>
% endif
<p>
Score:
{{score}
}
</p>
{% if grader_type == "ML" %}
<p>
Check below for full feedback:
</p>
{% endif %}
</div>
</div>
<div
class=
"longform"
>
<div
class=
"result-output"
>
${feedback
}
{% autoescape off %} {{feedback |safe }} {% endautoescape %
}
</div>
</div>
</section>
\ No newline at end of file
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