Commit 22a2bdaa by Vik Paruchuri

Disable student problem list caching, build out notifications

parent 4112f8ad
......@@ -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']
......
......@@ -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
......
......@@ -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']
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