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
a7a55e46
Commit
a7a55e46
authored
Feb 09, 2013
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create a combined results view
parent
4421e09d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
59 additions
and
26 deletions
+59
-26
common/lib/xmodule/xmodule/combined_open_ended_modulev1.py
+16
-4
common/lib/xmodule/xmodule/combined_open_ended_rubric.py
+27
-21
lms/templates/open_ended_result_table.html
+15
-0
lms/templates/open_ended_view_only_rubric.html
+1
-1
No files found.
common/lib/xmodule/xmodule/combined_open_ended_modulev1.py
View file @
a7a55e46
...
...
@@ -586,12 +586,24 @@ class CombinedOpenEndedV1Module():
loop_up_to_task
=
self
.
current_task_number
+
1
for
i
in
xrange
(
0
,
loop_up_to_task
):
all_responses
.
append
(
self
.
get_last_response
(
i
))
context_list
=
[]
for
ri
in
all_responses
:
for
i
in
xrange
(
0
,
len
(
ri
[
'rubric_scores'
])):
feedback
=
ri
[
'feedback_dicts'
][
i
]
.
get
(
'feedback'
,
''
)
context
=
{
'rubric_html'
:
self
.
rubric_renderer
.
render_rubric
(
stringify_children
(
self
.
static_data
[
'rubric'
]),
ri
[
'rubric_scores'
][
i
]),
'grader_type'
:
ri
[
'grader_type'
],
'grader_type_image_dict'
:
GRADER_TYPE_IMAGE_DICT
,
'human_grader_types'
:
HUMAN_GRADER_TYPE
,
'feedback'
:
feedback
,
}
context_list
.
append
(
context
)
feedback_table
=
self
.
system
.
render_template
(
'open_ended_result_table.html'
,
context_list
)
context
=
{
'results'
:
response_dict
[
'post_assessment'
],
'task_number'
:
task_number
+
1
,
'task_name'
:
response_dict
[
'human_task'
],
'results'
:
feedback_table
,
'task_name'
:
"Combined Results"
,
'class_name'
:
"result-container"
,
}
}
html
=
self
.
system
.
render_template
(
'combined_open_ended_results.html'
,
context
)
return
{
'html'
:
html
,
'success'
:
True
}
...
...
common/lib/xmodule/xmodule/combined_open_ended_rubric.py
View file @
a7a55e46
...
...
@@ -37,7 +37,7 @@ class CombinedOpenEndedRubric(object):
self
.
view_only
=
view_only
self
.
system
=
system
def
render_rubric
(
self
,
rubric_xml
):
def
render_rubric
(
self
,
rubric_xml
,
score_list
=
None
):
'''
render_rubric: takes in an xml string and outputs the corresponding
html for that xml, given the type of rubric we're generating
...
...
@@ -48,26 +48,32 @@ class CombinedOpenEndedRubric(object):
html: the html that corresponds to the xml given
'''
success
=
False
#try:
rubric_categories
=
self
.
extract_categories
(
rubric_xml
)
rubric_scores
=
[
cat
[
'score'
]
for
cat
in
rubric_categories
]
max_scores
=
map
((
lambda
cat
:
cat
[
'options'
][
-
1
][
'points'
]),
rubric_categories
)
max_score
=
max
(
max_scores
)
rubric_template
=
'open_ended_rubric.html'
if
self
.
view_only
:
rubric_template
=
'open_ended_view_only_rubric.html'
html
=
self
.
system
.
render_template
(
rubric_template
,
{
'categories'
:
rubric_categories
,
'has_score'
:
self
.
has_score
,
'view_only'
:
self
.
view_only
,
'max_score'
:
max_score
,
'combined_rubric'
:
False
})
success
=
True
#except:
# error_message = "[render_rubric] Could not parse the rubric with xml: {0}".format(rubric_xml)
# log.error(error_message)
# raise RubricParsingError(error_message)
try
:
rubric_categories
=
self
.
extract_categories
(
rubric_xml
)
if
score_list
:
for
i
in
xrange
(
0
,
len
(
rubric_categories
)):
category
=
rubric_categories
[
i
]
for
j
in
xrange
(
0
,
len
(
category
[
'options'
])):
if
score_list
[
i
]
==
j
:
rubric_categories
[
i
][
'options'
][
j
][
'selected'
]
=
True
rubric_scores
=
[
cat
[
'score'
]
for
cat
in
rubric_categories
]
max_scores
=
map
((
lambda
cat
:
cat
[
'options'
][
-
1
][
'points'
]),
rubric_categories
)
max_score
=
max
(
max_scores
)
rubric_template
=
'open_ended_rubric.html'
if
self
.
view_only
:
rubric_template
=
'open_ended_view_only_rubric.html'
html
=
self
.
system
.
render_template
(
rubric_template
,
{
'categories'
:
rubric_categories
,
'has_score'
:
self
.
has_score
,
'view_only'
:
self
.
view_only
,
'max_score'
:
max_score
,
'combined_rubric'
:
False
})
success
=
True
except
:
error_message
=
"[render_rubric] Could not parse the rubric with xml: {0}"
.
format
(
rubric_xml
)
log
.
error
(
error_message
)
raise
RubricParsingError
(
error_message
)
return
{
'success'
:
success
,
'html'
:
html
,
'rubric_scores'
:
rubric_scores
}
def
check_if_rubric_is_parseable
(
self
,
rubric_string
,
location
,
max_score_allowed
,
max_score
):
...
...
lms/templates/open_ended_result_table.html
0 → 100644
View file @
a7a55e46
% for context in context_list:
% if context['grader_type'] in grader_type_image_dict:
<
%
grader_image =
grader_type_image_dict[grader_type]
%
>
% if grader_type in human_grader_types:
<
%
human_title =
human_grader_types[grader_type]
%
>
% else:
<
%
human_title =
grader_type
%
>
% endif
<img
src=
"${grader_image}"
title=
"${human_title}"
/>
% endif
${rubric_html}
${feedback}
%endif
%endfor
\ No newline at end of file
lms/templates/open_ended_view_only_rubric.html
View file @
a7a55e46
...
...
@@ -5,7 +5,7 @@
% for j in range(len(category['options'])):
<
%
option =
category['options'][j]
%
>
% if option['selected']:
${category['description']} : ${option['points']} points
${category['description']} : ${option['points']} points
,
% endif
% endfor
% endfor
...
...
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