diff --git a/lms/djangoapps/courseware/tabs.py b/lms/djangoapps/courseware/tabs.py index dfe5cb14b9..7a8367a42b 100644 --- a/lms/djangoapps/courseware/tabs.py +++ b/lms/djangoapps/courseware/tabs.py @@ -108,8 +108,8 @@ 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" - - notifications = open_ended_notifications.staff_grading_notifications(course) + + notifications = open_ended_notifications.staff_grading_notifications(course_id) pending_grading = notifications['pending_grading'] img_path = notifications['img_path'] @@ -122,7 +122,7 @@ def _peer_grading(tab, user, course, active_page): link = reverse('peer_grading', args=[course.id]) tab_name = "Peer grading" - notifications = open_ended_notifications.peer_grading_notifications(course, user) + notifications = open_ended_notifications.peer_grading_notifications(course_id, user) pending_grading = notifications['pending_grading'] img_path = notifications['img_path'] @@ -135,7 +135,7 @@ def _combined_open_ended_grading(tab, user, course, active_page): link = reverse('open_ended_problems', args=[course.id]) tab_name = "Open Ended Questions" - notifications = open_ended_notifications.combined_notifications(course, user) + notifications = open_ended_notifications.combined_notifications(course_id, user) pending_grading = notifications['pending_grading'] img_path = notifications['img_path'] diff --git a/lms/djangoapps/open_ended_grading/open_ended_notifications.py b/lms/djangoapps/open_ended_grading/open_ended_notifications.py index d394769f1e..31b7a40dff 100644 --- a/lms/djangoapps/open_ended_grading/open_ended_notifications.py +++ b/lms/djangoapps/open_ended_grading/open_ended_notifications.py @@ -7,12 +7,12 @@ from student.models import unique_id_for_user import open_ended_util from courseware.models import StudentModule -def staff_grading_notifications(course): +def staff_grading_notifications(course_id): staff_gs = StaffGradingService(settings.STAFF_GRADING_INTERFACE) pending_grading=False img_path= "" try: - notifications = json.loads(staff_gs.get_notifications(course.id)) + notifications = json.loads(staff_gs.get_notifications(course_id)) if notifications['success']: if notifications['staff_needs_to_grade']: pending_grading=True @@ -25,12 +25,12 @@ def staff_grading_notifications(course): return {'pending_grading' : pending_grading, 'img_path' : img_path, 'response' : notifications} -def peer_grading_notifications(course, user): +def peer_grading_notifications(course_id, user): peer_gs = PeerGradingService(settings.PEER_GRADING_INTERFACE) pending_grading=False img_path= "" try: - notifications = json.loads(peer_gs.get_notifications(course.id,unique_id_for_user(user))) + notifications = json.loads(peer_gs.get_notifications(course_id,unique_id_for_user(user))) if notifications['success']: if notifications['student_needs_to_peer_grade']: pending_grading=True @@ -43,11 +43,10 @@ def peer_grading_notifications(course, user): return {'pending_grading' : pending_grading, 'img_path' : img_path, 'response' : notifications} -def combined_notifications(course, user): +def combined_notifications(course_id, user): controller_url = open_ended_util.get_controller_url() controller_qs = ControllerQueryService(controller_url) student_id = unique_id_for_user(user) - course_id = course.id user_is_staff = has_access(user, course, 'staff') min_time_to_query = user.last_login diff --git a/lms/djangoapps/open_ended_grading/views.py b/lms/djangoapps/open_ended_grading/views.py index e6841ccbd3..3797c2fbb2 100644 --- a/lms/djangoapps/open_ended_grading/views.py +++ b/lms/djangoapps/open_ended_grading/views.py @@ -163,8 +163,11 @@ def student_problem_list(request, course_id): # Checked above 'staff_access': False, }) +@cache_control(no_cache=True, no_store=True, must_revalidate=True) def combined_notifications(request, course_id): user = request.user + notifications = open_ended_notifications.combined_notifications(course_id, user) + response = notifications['response']