From 4112f8ad8e0949823863f3af1e016536fe0fbc66 Mon Sep 17 00:00:00 2001 From: Vik Paruchuri Date: Tue, 22 Jan 2013 11:53:46 -0500 Subject: [PATCH] Pass back dictionaries where needed from notifications functions --- lms/djangoapps/courseware/tabs.py | 16 ++++++++++++---- .../open_ended_notifications.py | 6 +++--- lms/djangoapps/open_ended_grading/views.py | 4 +++- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/lms/djangoapps/courseware/tabs.py b/lms/djangoapps/courseware/tabs.py index 326c1a5cbd..dfe5cb14b9 100644 --- a/lms/djangoapps/courseware/tabs.py +++ b/lms/djangoapps/courseware/tabs.py @@ -108,7 +108,10 @@ def _staff_grading(tab, user, course, active_page): if has_access(user, course, 'staff'): link = reverse('staff_grading', args=[course.id]) tab_name = "Staff grading" - pending_grading, img_path = open_ended_notifications.staff_grading_notifications(course) + + notifications = open_ended_notifications.staff_grading_notifications(course) + pending_grading = notifications['pending_grading'] + img_path = notifications['img_path'] tab = [CourseTab(tab_name, link, active_page == "staff_grading", pending_grading, img_path)] return tab @@ -118,7 +121,10 @@ def _peer_grading(tab, user, course, active_page): if user.is_authenticated(): link = reverse('peer_grading', args=[course.id]) tab_name = "Peer grading" - pending_grading, img_path = open_ended_notifications.peer_grading_notifications(course, user) + + notifications = open_ended_notifications.peer_grading_notifications(course, user) + pending_grading = notifications['pending_grading'] + img_path = notifications['img_path'] tab = [CourseTab(tab_name, link, active_page == "peer_grading", pending_grading, img_path)] return tab @@ -128,8 +134,10 @@ def _combined_open_ended_grading(tab, user, course, active_page): if user.is_authenticated: link = reverse('open_ended_problems', args=[course.id]) tab_name = "Open Ended Questions" - - pending_grading, img_path = open_ended_notifications.combined_notifications(course, user) + + notifications = open_ended_notifications.combined_notifications(course, user) + pending_grading = notifications['pending_grading'] + img_path = notifications['img_path'] tab = [CourseTab(tab_name, link, active_page == "controller_query", pending_grading, img_path)] return tab diff --git a/lms/djangoapps/open_ended_grading/open_ended_notifications.py b/lms/djangoapps/open_ended_grading/open_ended_notifications.py index 68f1509891..d394769f1e 100644 --- a/lms/djangoapps/open_ended_grading/open_ended_notifications.py +++ b/lms/djangoapps/open_ended_grading/open_ended_notifications.py @@ -23,7 +23,7 @@ def staff_grading_notifications(course): if pending_grading: img_path = "/static/images/slider-handle.png" - return pending_grading, img_path + return {'pending_grading' : pending_grading, 'img_path' : img_path, 'response' : notifications} def peer_grading_notifications(course, user): peer_gs = PeerGradingService(settings.PEER_GRADING_INTERFACE) @@ -41,7 +41,7 @@ def peer_grading_notifications(course, user): if pending_grading: img_path = "/static/images/slider-handle.png" - return pending_grading, img_path + return {'pending_grading' : pending_grading, 'img_path' : img_path, 'response' : notifications} def combined_notifications(course, user): controller_url = open_ended_util.get_controller_url() @@ -69,4 +69,4 @@ def combined_notifications(course, user): if pending_grading: img_path = "/static/images/slider-handle.png" - return pending_grading, img_path \ No newline at end of file + return {'pending_grading' : pending_grading, 'img_path' : img_path, 'response' : notifications} \ No newline at end of file diff --git a/lms/djangoapps/open_ended_grading/views.py b/lms/djangoapps/open_ended_grading/views.py index 3da1fb0835..e6841ccbd3 100644 --- a/lms/djangoapps/open_ended_grading/views.py +++ b/lms/djangoapps/open_ended_grading/views.py @@ -20,6 +20,7 @@ from .staff_grading import StaffGrading from student.models import unique_id_for_user import open_ended_util +import open_ended_notifications log = logging.getLogger(__name__) @@ -163,6 +164,7 @@ def student_problem_list(request, course_id): 'staff_access': False, }) def combined_notifications(request, course_id): - pass + user = request.user +