Commit 14372a40 by Vik Paruchuri

Address some issues with robustness, make images work properly throughout flow

parent 68eb8025
...@@ -8,6 +8,7 @@ from lxml.html import rewrite_links ...@@ -8,6 +8,7 @@ from lxml.html import rewrite_links
from path import path from path import path
import os import os
import sys import sys
import re
from pkg_resources import resource_string from pkg_resources import resource_string
...@@ -462,6 +463,10 @@ class CombinedOpenEndedV1Module(): ...@@ -462,6 +463,10 @@ class CombinedOpenEndedV1Module():
human_state = task.HUMAN_NAMES[state] human_state = task.HUMAN_NAMES[state]
else: else:
human_state = state human_state = state
if len(grader_types)>0:
grader_type = grader_types[0]
else:
grader_type = "IN"
last_response_dict = { last_response_dict = {
'response': last_response, 'response': last_response,
'score': last_score, 'score': last_score,
...@@ -477,7 +482,7 @@ class CombinedOpenEndedV1Module(): ...@@ -477,7 +482,7 @@ class CombinedOpenEndedV1Module():
'rubric_scores' : rubric_scores, 'rubric_scores' : rubric_scores,
'grader_types' : grader_types, 'grader_types' : grader_types,
'feedback_items' : feedback_items, 'feedback_items' : feedback_items,
'grader_type' : grader_types[0], 'grader_type' : grader_type,
} }
return last_response_dict return last_response_dict
...@@ -648,6 +653,7 @@ class CombinedOpenEndedV1Module(): ...@@ -648,6 +653,7 @@ class CombinedOpenEndedV1Module():
task_data = self.get_last_response(i) task_data = self.get_last_response(i)
task_data.update({'task_number': i + 1}) task_data.update({'task_number': i + 1})
status.append(task_data) status.append(task_data)
context = {'status_list': status, 'grader_type_image_dict' : GRADER_TYPE_IMAGE_DICT} context = {'status_list': status, 'grader_type_image_dict' : GRADER_TYPE_IMAGE_DICT}
status_html = self.system.render_template("combined_open_ended_status.html", context) status_html = self.system.render_template("combined_open_ended_status.html", context)
......
...@@ -429,7 +429,7 @@ class OpenEndedModule(openendedchild.OpenEndedChild): ...@@ -429,7 +429,7 @@ class OpenEndedModule(openendedchild.OpenEndedChild):
correct: Correctness of submission (Boolean) correct: Correctness of submission (Boolean)
score: Points to be assigned (numeric, can be float) score: Points to be assigned (numeric, can be float)
""" """
fail = {'valid': False, 'score': 0, 'feedback': '', 'rubric_scores' : [], 'grader_types' : [], 'feedback_items' : []} fail = {'valid': False, 'score': 0, 'feedback': '', 'rubric_scores' : [[0,0]], 'grader_types' : [''], 'feedback_items' : ['']}
try: try:
score_result = json.loads(score_msg) score_result = json.loads(score_msg)
except (TypeError, ValueError): except (TypeError, ValueError):
......
...@@ -7,8 +7,9 @@ ...@@ -7,8 +7,9 @@
%else: %else:
<div class="statusitem" data-status-number="${i}"> <div class="statusitem" data-status-number="${i}">
%endif %endif
%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']]%>
%endif
${status['human_task']}(${status['human_state']}) ${status['score']} / ${status['max_score']} ${status['human_task']}(${status['human_state']}) ${status['score']} / ${status['max_score']}
</div> </div>
%endfor %endfor
......
...@@ -28,8 +28,10 @@ ...@@ -28,8 +28,10 @@
% elif combined_rubric == True: % elif combined_rubric == True:
<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']:
<% grader_image = grader_type_image_dict[grader_type]%> % if grader_type in grader_type_image_dict:
<img src="${grader_image}"/> <% grader_image = grader_type_image_dict[grader_type]%>
<img src="${grader_image}"/>
% endif
%endfor %endfor
${option['points']} points : ${option['text']} ${option['points']} points : ${option['text']}
</div> </div>
......
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