Pass back dictionaries where needed from notifications functions
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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}
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user