Commit a49f740e by Vik Paruchuri

Fix rubric and make images display with tooltips

parent 14372a40
...@@ -22,7 +22,7 @@ from .xml_module import XmlDescriptor ...@@ -22,7 +22,7 @@ from .xml_module import XmlDescriptor
from xmodule.modulestore import Location from xmodule.modulestore import Location
import self_assessment_module import self_assessment_module
import open_ended_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 from .stringify import stringify_children
import dateutil import dateutil
import dateutil.parser import dateutil.parser
...@@ -467,6 +467,12 @@ class CombinedOpenEndedV1Module(): ...@@ -467,6 +467,12 @@ class CombinedOpenEndedV1Module():
grader_type = grader_types[0] grader_type = grader_types[0]
else: else:
grader_type = "IN" 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 = { last_response_dict = {
'response': last_response, 'response': last_response,
'score': last_score, 'score': last_score,
...@@ -483,6 +489,7 @@ class CombinedOpenEndedV1Module(): ...@@ -483,6 +489,7 @@ class CombinedOpenEndedV1Module():
'grader_types' : grader_types, 'grader_types' : grader_types,
'feedback_items' : feedback_items, 'feedback_items' : feedback_items,
'grader_type' : grader_type, 'grader_type' : grader_type,
'human_grader_type' : human_grader_name,
} }
return last_response_dict return last_response_dict
...@@ -563,6 +570,15 @@ class CombinedOpenEndedV1Module(): ...@@ -563,6 +570,15 @@ class CombinedOpenEndedV1Module():
html = self.system.render_template('combined_open_ended_results.html', context) html = self.system.render_template('combined_open_ended_results.html', context)
return {'html': html, 'success': True} 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): def handle_ajax(self, dispatch, get):
""" """
This is called by courseware.module_render, to handle an AJAX call. This is called by courseware.module_render, to handle an AJAX call.
...@@ -579,6 +595,7 @@ class CombinedOpenEndedV1Module(): ...@@ -579,6 +595,7 @@ class CombinedOpenEndedV1Module():
'reset': self.reset, 'reset': self.reset,
'get_results': self.get_results, 'get_results': self.get_results,
'get_combined_rubric': self.get_rubric, 'get_combined_rubric': self.get_rubric,
'get_status' : self.get_status_ajax,
} }
if dispatch not in handlers: if dispatch not in handlers:
......
...@@ -10,6 +10,13 @@ GRADER_TYPE_IMAGE_DICT = { ...@@ -10,6 +10,13 @@ GRADER_TYPE_IMAGE_DICT = {
'IN' : '/static/images/peer_grading_icon.png', '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): class RubricParsingError(Exception):
def __init__(self, msg): def __init__(self, msg):
self.msg = msg self.msg = msg
...@@ -184,6 +191,7 @@ class CombinedOpenEndedRubric(object): ...@@ -184,6 +191,7 @@ class CombinedOpenEndedRubric(object):
'max_score': max_score, 'max_score': max_score,
'combined_rubric' : True, 'combined_rubric' : True,
'grader_type_image_dict' : GRADER_TYPE_IMAGE_DICT, 'grader_type_image_dict' : GRADER_TYPE_IMAGE_DICT,
'human_grader_types' : HUMAN_GRADER_TYPE,
}) })
return html return html
......
...@@ -51,6 +51,7 @@ class @CombinedOpenEnded ...@@ -51,6 +51,7 @@ class @CombinedOpenEnded
@reset_button.click @reset @reset_button.click @reset
@next_problem_button = @$('.next-step-button') @next_problem_button = @$('.next-step-button')
@next_problem_button.click @next_problem @next_problem_button.click @next_problem
@status_container = @$('.status-elements')
@show_results_button=@$('.show-results-button') @show_results_button=@$('.show-results-button')
@show_results_button.click @show_results @show_results_button.click @show_results
...@@ -130,6 +131,13 @@ class @CombinedOpenEnded ...@@ -130,6 +131,13 @@ class @CombinedOpenEnded
@combined_rubric_container.after(response.html).remove() @combined_rubric_container.after(response.html).remove()
@combined_rubric_container= $('div.combined_rubric_container') @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)=> message_post: (event)=>
Logger.log 'message_post', @answers Logger.log 'message_post', @answers
external_grader_message=$(event.target).parent().parent().parent() external_grader_message=$(event.target).parent().parent().parent()
...@@ -171,7 +179,7 @@ class @CombinedOpenEnded ...@@ -171,7 +179,7 @@ class @CombinedOpenEnded
@next_problem_button.hide() @next_problem_button.hide()
@hide_file_upload() @hide_file_upload()
@hint_area.attr('disabled', false) @hint_area.attr('disabled', false)
@show_status_current()
if @task_number>1 if @task_number>1
@show_combined_rubric_current() @show_combined_rubric_current()
if @task_number==1 and @child_state=='assessing' if @task_number==1 and @child_state=='assessing'
......
...@@ -9,8 +9,11 @@ ...@@ -9,8 +9,11 @@
%endif %endif
%if status['grader_type'] in grader_type_image_dict: %if status['grader_type'] in grader_type_image_dict:
<% grader_image = grader_type_image_dict[status['grader_type']]%> <% grader_image = grader_type_image_dict[status['grader_type']]%>
<img src="${grader_image}" title=${status['human_grader_type']}>
%else:
${status['human_task']}
%endif %endif
${status['human_task']}(${status['human_state']}) ${status['score']} / ${status['max_score']} (${status['human_state']}) ${status['score']} / ${status['max_score']}
</div> </div>
%endfor %endfor
</section> </section>
......
...@@ -29,8 +29,13 @@ ...@@ -29,8 +29,13 @@
<div class="rubric-label"> <div class="rubric-label">
%for grader_type in category['options'][j]['grader_types']: %for grader_type in category['options'][j]['grader_types']:
% if grader_type in grader_type_image_dict: % if grader_type in grader_type_image_dict:
<% grader_image = grader_type_image_dict[grader_type]%> <% grader_image = grader_type_image_dict[grader_type] %>
<img src="${grader_image}"/> % 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 % endif
%endfor %endfor
${option['points']} points : ${option['text']} ${option['points']} points : ${option['text']}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment