Do some better error checking for items.
This commit is contained in:
committed by
Vik Paruchuri
parent
a2db72e10f
commit
d4ed059975
@@ -51,6 +51,16 @@ def _reverse_without_slash(url_name, course_id):
|
||||
ajax_url = reverse(url_name, kwargs={'course_id': course_id})
|
||||
return ajax_url
|
||||
|
||||
DESCRIPTION_DICT = {
|
||||
'Peer Grading': "View all problems that require peer assessment in this particular course.",
|
||||
'Staff Grading': "View ungraded submissions submitted by students for the open ended problems in the course.",
|
||||
'Problems you have submitted': "View open ended problems that you have previously submitted for grading."
|
||||
}
|
||||
ALERT_DICT = {
|
||||
'Peer Grading': "New submissions to grade",
|
||||
'Staff Grading': "New submissions to grade",
|
||||
'Problems you have submitted': "New grades have been returned"
|
||||
}
|
||||
@cache_control(no_cache=True, no_store=True, must_revalidate=True)
|
||||
def staff_grading(request, course_id):
|
||||
"""
|
||||
@@ -193,16 +203,6 @@ def combined_notifications(request, course_id):
|
||||
notification_tuples=open_ended_notifications.NOTIFICATION_TYPES
|
||||
|
||||
notification_list = []
|
||||
description_dict = {
|
||||
'Peer Grading': "View all problems that require peer assessment in this particular course.",
|
||||
'Staff Grading': "View ungraded submissions submitted by students for the open ended problems in the course.",
|
||||
'Problems you have submitted': "View open ended problems that you have previously submitted for grading."
|
||||
}
|
||||
alert_dict = {
|
||||
'Peer Grading': "New submissions to grade",
|
||||
'Staff Grading': "New submissions to grade",
|
||||
'Problems you have submitted': "New grades have been returned"
|
||||
}
|
||||
for response_num in xrange(0,len(notification_tuples)):
|
||||
tag=notification_tuples[response_num][0]
|
||||
if tag in response:
|
||||
@@ -211,12 +211,23 @@ def combined_notifications(request, course_id):
|
||||
url = _reverse_without_slash(url_name, course_id)
|
||||
has_img = response[tag]
|
||||
|
||||
# check to make sure we have descriptions and alert messages
|
||||
if human_name in DESCRIPTION_DICT:
|
||||
description = DESCRIPTION_DICT[human_name]
|
||||
else:
|
||||
description = ""
|
||||
|
||||
if human_name in ALERT_DICT:
|
||||
alert_message = ALERT_DICT[human_name]
|
||||
else:
|
||||
alert_message = ""
|
||||
|
||||
notification_item = {
|
||||
'url' : url,
|
||||
'name' : human_name,
|
||||
'alert' : has_img,
|
||||
'description': description_dict[human_name],
|
||||
'alert_message': alert_dict[human_name]
|
||||
'description': description,
|
||||
'alert_message': alert_message
|
||||
}
|
||||
notification_list.append(notification_item)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user