Fix rubric and make images display with tooltips
This commit is contained in:
@@ -22,7 +22,7 @@ from .xml_module import XmlDescriptor
|
||||
from xmodule.modulestore import Location
|
||||
import self_assessment_module
|
||||
import open_ended_module
|
||||
from combined_open_ended_rubric import CombinedOpenEndedRubric, RubricParsingError, GRADER_TYPE_IMAGE_DICT
|
||||
from combined_open_ended_rubric import CombinedOpenEndedRubric, RubricParsingError, GRADER_TYPE_IMAGE_DICT, HUMAN_GRADER_TYPE
|
||||
from .stringify import stringify_children
|
||||
import dateutil
|
||||
import dateutil.parser
|
||||
@@ -467,6 +467,12 @@ class CombinedOpenEndedV1Module():
|
||||
grader_type = grader_types[0]
|
||||
else:
|
||||
grader_type = "IN"
|
||||
|
||||
if grader_type in HUMAN_GRADER_TYPE:
|
||||
human_grader_name = HUMAN_GRADER_TYPE[grader_type]
|
||||
else:
|
||||
human_grader_name = grader_type
|
||||
|
||||
last_response_dict = {
|
||||
'response': last_response,
|
||||
'score': last_score,
|
||||
@@ -483,6 +489,7 @@ class CombinedOpenEndedV1Module():
|
||||
'grader_types' : grader_types,
|
||||
'feedback_items' : feedback_items,
|
||||
'grader_type' : grader_type,
|
||||
'human_grader_type' : human_grader_name,
|
||||
}
|
||||
return last_response_dict
|
||||
|
||||
@@ -563,6 +570,15 @@ class CombinedOpenEndedV1Module():
|
||||
html = self.system.render_template('combined_open_ended_results.html', context)
|
||||
return {'html': html, 'success': True}
|
||||
|
||||
def get_status_ajax(self, get):
|
||||
"""
|
||||
Gets the results of a given grader via ajax.
|
||||
Input: AJAX get dictionary
|
||||
Output: Dictionary to be rendered via ajax that contains the result html.
|
||||
"""
|
||||
html = self.get_status()
|
||||
return {'html': html, 'success': True}
|
||||
|
||||
def handle_ajax(self, dispatch, get):
|
||||
"""
|
||||
This is called by courseware.module_render, to handle an AJAX call.
|
||||
@@ -579,6 +595,7 @@ class CombinedOpenEndedV1Module():
|
||||
'reset': self.reset,
|
||||
'get_results': self.get_results,
|
||||
'get_combined_rubric': self.get_rubric,
|
||||
'get_status' : self.get_status_ajax,
|
||||
}
|
||||
|
||||
if dispatch not in handlers:
|
||||
|
||||
@@ -10,6 +10,13 @@ GRADER_TYPE_IMAGE_DICT = {
|
||||
'IN' : '/static/images/peer_grading_icon.png',
|
||||
}
|
||||
|
||||
HUMAN_GRADER_TYPE = {
|
||||
'SA' : 'Self-Assessment',
|
||||
'PE' : 'Peer-Assessment',
|
||||
'IN' : 'Instructor-Assessment',
|
||||
'ML' : 'AI-Assessment',
|
||||
}
|
||||
|
||||
class RubricParsingError(Exception):
|
||||
def __init__(self, msg):
|
||||
self.msg = msg
|
||||
@@ -184,6 +191,7 @@ class CombinedOpenEndedRubric(object):
|
||||
'max_score': max_score,
|
||||
'combined_rubric' : True,
|
||||
'grader_type_image_dict' : GRADER_TYPE_IMAGE_DICT,
|
||||
'human_grader_types' : HUMAN_GRADER_TYPE,
|
||||
})
|
||||
return html
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@ class @CombinedOpenEnded
|
||||
@reset_button.click @reset
|
||||
@next_problem_button = @$('.next-step-button')
|
||||
@next_problem_button.click @next_problem
|
||||
@status_container = @$('.status-elements')
|
||||
|
||||
@show_results_button=@$('.show-results-button')
|
||||
@show_results_button.click @show_results
|
||||
@@ -130,6 +131,13 @@ class @CombinedOpenEnded
|
||||
@combined_rubric_container.after(response.html).remove()
|
||||
@combined_rubric_container= $('div.combined_rubric_container')
|
||||
|
||||
show_status_current: () =>
|
||||
data = {}
|
||||
$.postWithPrefix "#{@ajax_url}/get_status", data, (response) =>
|
||||
if response.success
|
||||
@status_container.after(response.html).remove()
|
||||
@status_container= $('.status-elements')
|
||||
|
||||
message_post: (event)=>
|
||||
Logger.log 'message_post', @answers
|
||||
external_grader_message=$(event.target).parent().parent().parent()
|
||||
@@ -171,7 +179,7 @@ class @CombinedOpenEnded
|
||||
@next_problem_button.hide()
|
||||
@hide_file_upload()
|
||||
@hint_area.attr('disabled', false)
|
||||
|
||||
@show_status_current()
|
||||
if @task_number>1
|
||||
@show_combined_rubric_current()
|
||||
if @task_number==1 and @child_state=='assessing'
|
||||
|
||||
@@ -9,8 +9,11 @@
|
||||
%endif
|
||||
%if status['grader_type'] in grader_type_image_dict:
|
||||
<% grader_image = grader_type_image_dict[status['grader_type']]%>
|
||||
<img src="${grader_image}" title=${status['human_grader_type']}>
|
||||
%else:
|
||||
${status['human_task']}
|
||||
%endif
|
||||
${status['human_task']}(${status['human_state']}) ${status['score']} / ${status['max_score']}
|
||||
(${status['human_state']}) ${status['score']} / ${status['max_score']}
|
||||
</div>
|
||||
%endfor
|
||||
</section>
|
||||
|
||||
@@ -29,8 +29,13 @@
|
||||
<div class="rubric-label">
|
||||
%for grader_type in category['options'][j]['grader_types']:
|
||||
% if grader_type in grader_type_image_dict:
|
||||
<% grader_image = grader_type_image_dict[grader_type]%>
|
||||
<img src="${grader_image}"/>
|
||||
<% 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
|
||||
%endfor
|
||||
${option['points']} points : ${option['text']}
|
||||
|
||||
Reference in New Issue
Block a user