Commit 8602e159 by Vik Paruchuri

Pass proper parameters, fix templating

parent 0f212cc8
......@@ -73,14 +73,16 @@ def combined_notifications(course, user):
img_path= ""
try:
notifications = json.loads(controller_qs.get_notifications(course.id,student_id, user_is_staff, last_time_viewed))
controller_response = controller_qs.check_combined_notifications(course.id,student_id, user_is_staff, last_time_viewed)
log.debug(controller_response)
notifications = json.loads(controller_response)
if notifications['success']:
if notifications['overall_need_to_check']:
pending_grading=True
except:
#Non catastrophic error, so no real action
notifications = {}
log.info("Problem with getting notifications from controller query service.")
log.exception("Problem with getting notifications from controller query service.")
if pending_grading:
img_path = "/static/images/slider-handle.png"
......
......@@ -7,6 +7,6 @@ def get_controller_url():
peer_grading_url = settings.PEER_GRADING_INTERFACE['url']
split_url = peer_grading_url.split("/")
controller_url = "http://" + split_url[2] + "/grading_controller"
controller_settings=settings.PEER_GRADING_INTERFACE
controller_settings=settings.PEER_GRADING_INTERFACE.copy()
controller_settings['url'] = controller_url
return controller_settings
......@@ -168,10 +168,10 @@ def combined_notifications(request, course_id):
course = get_course_with_access(request.user, course_id, 'load')
user = request.user
notifications = open_ended_notifications.combined_notifications(course, user)
log.debug(notifications)
response = notifications['response']
notification_tuples=open_ended_notifications.NOTIFICATION_TYPES
notification_list = []
for response_num in xrange(0,len(notification_tuples)):
tag=notification_tuples[response_num][0]
......@@ -190,12 +190,17 @@ def combined_notifications(request, course_id):
}
notification_list.append(notification_item)
ajax_url = _reverse_with_slash('open_ended_notifications', course_id)
combined_dict = {
'error_text' : "",
'notification_list' : notification_list,
'course' : course,
'success' : True,
'ajax_url' : ajax_url,
}
log.debug(combined_dict)
return render_to_response('open_ended_problems/combined_notifications.html',
combined_dict
)
......
......@@ -18,24 +18,24 @@
<h2>Instructions</h2>
<p>Here are items that could potentially need your attention.</p>
% if success:
% if len(notification_list) == 0:
<div class="message-container">
No items require attention at the moment.
</div>
%else:
<ul class="notification-list">
%for notification in notification_list:
<li>
<a href="${notification['url']}">
{notification['name']}
% if notification['has_img'] == True:
<img src="${notification['img']}"/>
%endif
</a>
</li>
%endfor
</ul>
%endif
% if len(notification_list) == 0:
<div class="message-container">
No items require attention at the moment.
</div>
%else:
<ul class="notification-list">
%for notification in notification_list:
<li>
<a href="${notification['url']}">
{notification['name']}
% if notification['has_img'] == True:
<img src="${notification['img']}"/>
%endif
</a>
</li>
%endfor
</ul>
%endif
%endif
</div>
</section>
\ No newline at end of file
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