Commit 0bc06579 by Vik Paruchuri

Add in support for ordering tags properly in feedback box

parent 1eaf424c
...@@ -2017,6 +2017,10 @@ class OpenEndedResponse(LoncapaResponse): ...@@ -2017,6 +2017,10 @@ class OpenEndedResponse(LoncapaResponse):
String String
""" """
#Tags that need to be shown at the end of the feedback block (in this order)
tags_displayed_last=['markup-text', 'markup_text']
tags_displayed_first=['spelling', 'grammar']
feedback_item_start='<div class="{feedback_key}">' feedback_item_start='<div class="{feedback_key}">'
feedback_item_end='</div>' feedback_item_end='</div>'
...@@ -2032,12 +2036,21 @@ class OpenEndedResponse(LoncapaResponse): ...@@ -2032,12 +2036,21 @@ class OpenEndedResponse(LoncapaResponse):
success=response_items['success'] success=response_items['success']
if success: if success:
feedback_long="" feedback_long=""
#Add in feedback that needs to be shown first
for k,v in feedback_items.items():
if k in tags_displayed_first:
feedback_long+= feedback_item_start.format(feedback_key=k) +str(v) + feedback_item_end
#Add in feedback whose order does not matter
for k,v in feedback_items.items():
if k not in tags_displayed_last and k not in tags_displayed_first:
feedback_long+= feedback_item_start.format(feedback_key=k) +str(v) + feedback_item_end
#Add in feedback that needs to be displayed last
for k,v in feedback_items.items(): for k,v in feedback_items.items():
feedback_long+=feedback_item_start.format(feedback_key=k) if k in tags_displayed_last:
feedback_long+=str(v) feedback_long+= feedback_item_start.format(feedback_key=k) +str(v) + feedback_item_end
feedback_long+=feedback_item_end
if len(feedback_items)==0: if len(feedback_items)==0:
feedback_long=feedback_item_start.format(feedback_key="feedback") + "No feedback available." + feedback_item_end feedback_long=feedback_item_start.format(feedback_key="feedback") + "No feedback available." + feedback_item_end
......
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