Commit 9b2faa49 by Diana Huang

Merge branch 'master' into feature/diana/rubric-input

parents 8ff77329 39655bff
......@@ -22,6 +22,7 @@ from courseware.access import has_access
from static_replace import replace_urls
from open_ended_grading.peer_grading_service import PeerGradingService
from open_ended_grading.staff_grading_service import StaffGradingService
from student.models import unique_id_for_user
log = logging.getLogger(__name__)
......@@ -108,7 +109,24 @@ def _textbooks(tab, user, course, active_page):
def _staff_grading(tab, user, course, active_page):
if has_access(user, course, 'staff'):
link = reverse('staff_grading', args=[course.id])
return [CourseTab('Staff grading', link, active_page == "staff_grading")]
staff_gs = StaffGradingService(settings.STAFF_GRADING_INTERFACE)
pending_grading=False
tab_name = "Staff grading"
img_path= ""
try:
notifications = json.loads(staff_gs.get_notifications(course.id))
if notifications['success']:
if notifications['staff_needs_to_grade']:
pending_grading=True
except:
#Non catastrophic error, so no real action
log.info("Problem with getting notifications from staff grading service.")
if pending_grading:
img_path = "/static/images/slider-handle.png"
tab = [CourseTab(tab_name, link, active_page == "staff_grading", pending_grading, img_path)]
return tab
return []
def _peer_grading(tab, user, course, active_page):
......
......@@ -68,6 +68,7 @@ class StaffGradingService(GradingService):
self.get_next_url = self.url + '/get_next_submission/'
self.save_grade_url = self.url + '/save_grade/'
self.get_problem_list_url = self.url + '/get_problem_list/'
self.get_notifications_url = self.url + "/get_notifications/"
def get_problem_list(self, course_id, grader_id):
......@@ -137,6 +138,12 @@ class StaffGradingService(GradingService):
return self.post(self.save_grade_url, data=data)
def get_notifications(self, course_id):
params = {'course_id': course_id}
response = self.get(self.get_notifications_url, params)
return response
# don't initialize until staff_grading_service() is called--means that just
# importing this file doesn't create objects that may not have the right config
_service = None
......
......@@ -368,7 +368,7 @@ class StaffGrading
problem_link:(problem) ->
link = $('<a>').attr('href', "javascript:void(0)").append(
"#{problem.problem_name} (#{problem.num_graded} graded, #{problem.num_pending} pending)")
"#{problem.problem_name} (#{problem.num_graded} graded, #{problem.num_pending} pending, required to grade #{problem.num_required} more)")
.click =>
@get_next_submission problem.location
......
$(document).ready(function() {
var open_question = "";
var question_id;
$('.response').click(function(){
$(this).toggleClass('opened');
answer = $(this).find(".answer");
answer.slideToggle('fast');
});
});
......@@ -194,9 +194,30 @@
margin-bottom: 40px;
h3 {
background: url('/static/images/bullet-closed.png') no-repeat left 0.25em;
font-family: $sans-serif;
font-weight: 700;
margin-bottom: 15px;
margin-bottom: 10px;
padding-left: 20px;
cursor: pointer;
}
.answer {
display: none;
color: #3c3c3c;
padding-left: 16px;
font-family: $serif;
li {
line-height: 1.6em;
}
}
// opened states
&.opened {
h3 {
background: url('/static/images/bullet-open.png') no-repeat left 0.25em;
}
}
}
}
......
......@@ -29,7 +29,7 @@
<ul class="problem-list">
%for problem in problem_list:
<li>
<a href="${ajax_url}problem?location=${problem['location']}">${problem['problem_name']} (${problem['num_graded']} graded, ${problem['num_pending']} pending)</a>
<a href="${ajax_url}problem?location=${problem['location']}">${problem['problem_name']} (${problem['num_graded']} graded, ${problem['num_pending']} pending, required to grade ${problem['num_required']} more)</a>
</li>
%endfor
</ul>
......
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