Commit 8602e159 by Vik Paruchuri

Pass proper parameters, fix templating

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