Commit 4112f8ad by Vik Paruchuri

Pass back dictionaries where needed from notifications functions

parent 68db8b0d
...@@ -108,7 +108,10 @@ def _staff_grading(tab, user, course, active_page): ...@@ -108,7 +108,10 @@ def _staff_grading(tab, user, course, active_page):
if has_access(user, course, 'staff'): if has_access(user, course, 'staff'):
link = reverse('staff_grading', args=[course.id]) link = reverse('staff_grading', args=[course.id])
tab_name = "Staff grading" 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)] tab = [CourseTab(tab_name, link, active_page == "staff_grading", pending_grading, img_path)]
return tab return tab
...@@ -118,7 +121,10 @@ def _peer_grading(tab, user, course, active_page): ...@@ -118,7 +121,10 @@ def _peer_grading(tab, user, course, active_page):
if user.is_authenticated(): if user.is_authenticated():
link = reverse('peer_grading', args=[course.id]) link = reverse('peer_grading', args=[course.id])
tab_name = "Peer grading" 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)] tab = [CourseTab(tab_name, link, active_page == "peer_grading", pending_grading, img_path)]
return tab return tab
...@@ -128,8 +134,10 @@ def _combined_open_ended_grading(tab, user, course, active_page): ...@@ -128,8 +134,10 @@ def _combined_open_ended_grading(tab, user, course, active_page):
if user.is_authenticated: if user.is_authenticated:
link = reverse('open_ended_problems', args=[course.id]) link = reverse('open_ended_problems', args=[course.id])
tab_name = "Open Ended Questions" 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)] tab = [CourseTab(tab_name, link, active_page == "controller_query", pending_grading, img_path)]
return tab return tab
......
...@@ -23,7 +23,7 @@ def staff_grading_notifications(course): ...@@ -23,7 +23,7 @@ def staff_grading_notifications(course):
if pending_grading: if pending_grading:
img_path = "/static/images/slider-handle.png" 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): def peer_grading_notifications(course, user):
peer_gs = PeerGradingService(settings.PEER_GRADING_INTERFACE) peer_gs = PeerGradingService(settings.PEER_GRADING_INTERFACE)
...@@ -41,7 +41,7 @@ def peer_grading_notifications(course, user): ...@@ -41,7 +41,7 @@ def peer_grading_notifications(course, user):
if pending_grading: if pending_grading:
img_path = "/static/images/slider-handle.png" 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): def combined_notifications(course, user):
controller_url = open_ended_util.get_controller_url() controller_url = open_ended_util.get_controller_url()
...@@ -69,4 +69,4 @@ def combined_notifications(course, user): ...@@ -69,4 +69,4 @@ def combined_notifications(course, user):
if pending_grading: if pending_grading:
img_path = "/static/images/slider-handle.png" img_path = "/static/images/slider-handle.png"
return pending_grading, img_path return {'pending_grading' : pending_grading, 'img_path' : img_path, 'response' : notifications}
\ No newline at end of file \ No newline at end of file
...@@ -20,6 +20,7 @@ from .staff_grading import StaffGrading ...@@ -20,6 +20,7 @@ from .staff_grading import StaffGrading
from student.models import unique_id_for_user from student.models import unique_id_for_user
import open_ended_util import open_ended_util
import open_ended_notifications
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
...@@ -163,6 +164,7 @@ def student_problem_list(request, course_id): ...@@ -163,6 +164,7 @@ def student_problem_list(request, course_id):
'staff_access': False, }) 'staff_access': False, })
def combined_notifications(request, course_id): def combined_notifications(request, course_id):
pass user = request.user
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