From 6b7ba3799993c2a8a48d78f6b39fccc4e303ae5b Mon Sep 17 00:00:00 2001 From: Vik Paruchuri Date: Tue, 22 Jan 2013 12:09:34 -0500 Subject: [PATCH] Combined notification view --- .../open_ended_notifications.py | 6 +++++ lms/djangoapps/open_ended_grading/views.py | 25 +++++++++++++++++++ .../combined_notifications.html | 6 ++--- 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/lms/djangoapps/open_ended_grading/open_ended_notifications.py b/lms/djangoapps/open_ended_grading/open_ended_notifications.py index 31b7a40dff..516b19e326 100644 --- a/lms/djangoapps/open_ended_grading/open_ended_notifications.py +++ b/lms/djangoapps/open_ended_grading/open_ended_notifications.py @@ -7,6 +7,12 @@ from student.models import unique_id_for_user import open_ended_util from courseware.models import StudentModule +NOTIFICATION_TYPES = ( + ('student_needs_to_peer_grade', 'peer_grading', 'Peer Grading'), + ('staff_needs_to_grade', 'staff_grading', 'Staff Grading'), + ('overall_need_to_check', 'open_ended_problems', 'Problems you have submitted') + ) + def staff_grading_notifications(course_id): staff_gs = StaffGradingService(settings.STAFF_GRADING_INTERFACE) pending_grading=False diff --git a/lms/djangoapps/open_ended_grading/views.py b/lms/djangoapps/open_ended_grading/views.py index 3797c2fbb2..a1907ae230 100644 --- a/lms/djangoapps/open_ended_grading/views.py +++ b/lms/djangoapps/open_ended_grading/views.py @@ -168,6 +168,31 @@ def combined_notifications(request, course_id): user = request.user notifications = open_ended_notifications.combined_notifications(course_id, user) response = notifications['response'] + notificaton_tuples=open_ended_notifications.NOTIFICATION_TYPES + notification_list = [] + for response_num in xrange(0,len(notification_tuples)): + tag=notification_tuples[response_num][0] + if tag in response: + url_name = notification_tuples[response_num][1] + human_name = notification_tuples[response_num][2] + url = _reverse_with_slash(url_name, course_id) + has_img = response[tag] + img_path = "/static/images/slider-handle.png" + + notification_item = { + 'url' : url, + 'name' : human_name, + 'has_img' : has_img, + 'img' : img_path, + } + notification_list.append(notification_item) + + combined_dict = { + 'error_text' : "", + 'notification_list' : notification_list, + } + + return combined_dict diff --git a/lms/templates/open_ended_problems/combined_notifications.html b/lms/templates/open_ended_problems/combined_notifications.html index 6cd2a095dc..9fdedb2555 100644 --- a/lms/templates/open_ended_problems/combined_notifications.html +++ b/lms/templates/open_ended_problems/combined_notifications.html @@ -18,7 +18,7 @@

Instructions

Here are items that could potentially need your attention.

% if success: - % if len(item_list) == 0: + % if len(notification_list) == 0:
No items require attention at the moment.
@@ -28,8 +28,8 @@
  • {notification['name']} - % if notification.has_img == True: - + % if notification['has_img'] == True: + %endif