Change status bar UI

This commit is contained in:
Vik Paruchuri
2013-07-12 14:13:53 -04:00
parent e7bb85dee1
commit 0cadc8af36
3 changed files with 25 additions and 15 deletions

View File

@@ -56,13 +56,16 @@ section.legend-container {
section.combined-open-ended-status {
padding: 20px 20px 20px 0px;
.statusitem {
color: #2C2C2C;
background-color : #d4d4d4;
font-size: .9em;
padding: 2px;
padding: 20px;
display: inline;
width: 20%;
margin-right: 20px;
.show-results {
margin-top: .3em;
text-align:right;

View File

@@ -33,6 +33,8 @@ TRUE_DICT = ["True", True, "TRUE", "true"]
HUMAN_TASK_TYPE = {
'selfassessment': "Self Assessment",
'openended': "edX Assessment",
'ml_grading.conf' : "AI Assessment",
'peer_grading.conf' : "Peer Assessment",
}
# Default value that controls whether or not to skip basic spelling checks in the controller
@@ -468,6 +470,19 @@ class CombinedOpenEndedV1Module():
}
return last_response_dict
def extract_human_name_from_task(self, task_xml):
tree = etree.fromstring(task_xml)
log.info(etree.tostring(tree))
payload = tree.xpath("/openended/openendedparam/grader_payload")
if len(payload)==0:
task_name = "selfassessment"
else:
inner_payload = json.loads(payload[0].text)
task_name = inner_payload['grader_settings']
human_task = HUMAN_TASK_TYPE[task_name]
return human_task
def update_task_states(self):
"""
Updates the task state of the combined open ended module with the task state of the current child module.
@@ -689,9 +704,10 @@ class CombinedOpenEndedV1Module():
Output: The status html to be rendered
"""
status = []
for i in xrange(0, self.current_task_number + 1):
task_data = self.get_last_response(i)
task_data.update({'task_number': i + 1})
for i in xrange(0, len(self.task_xml)):
human_task_name = self.extract_human_name_from_task(self.task_xml[i])
task_data = {'task_number': i + 1, 'human_task' : human_task_name, 'current' : self.current_task_number==i}
status.append(task_data)
context = {

View File

@@ -1,22 +1,13 @@
<div class="status-elements">
<section id="combined-open-ended-status" class="combined-open-ended-status">
<div class="statusitem">
Status
</div>
%for i in xrange(0,len(status_list)):
<%status=status_list[i]%>
%if i==len(status_list)-1:
%if status['current']:
<div class="statusitem statusitem-current" data-status-number="${i}">
%else:
<div class="statusitem" data-status-number="${i}">
%endif
%if status['grader_type'] in grader_type_image_dict and render_via_ajax:
<% 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_state']})
${status['human_task']}
</div>
%endfor
</section>