Pass back dictionaries where needed from notifications functions

This commit is contained in:
Vik Paruchuri
2013-01-22 11:53:46 -05:00
parent 68db8b0d77
commit 4112f8ad8e
3 changed files with 18 additions and 8 deletions

View File

@@ -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

View File

@@ -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
return {'pending_grading' : pending_grading, 'img_path' : img_path, 'response' : notifications}

View File

@@ -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