def teacher_endpoint(self): if self.override: return HWCentralJsonResponse([ TeacherSubjectRoomSelectOverrideElem(subjectroom) for subjectroom in self.user.subjects_managed_set.all() ]) else: return HWCentralJsonResponse([ TeacherSubjectRoomSelectElem(subjectroom) for subjectroom in self.user.subjects_managed_set.all() ])
def teacher_endpoint(self): if (is_student_classteacher_relationship( self.student, self.user)) or (self.subjectroom.teacher == self.user): return HWCentralJsonResponse( StudentEdgeData(self.student, self.subjectroom)) return Json404Response()
def all_subjectroom_data(self): chart_data = [] focus = self.subjectteacher.userinfo.school.schoolprofile.focus for subjectroom in self.subjectteacher.subjects_managed_set.all(): chart_data.append(RoomPerformanceBreakdown.for_subjectroom(subjectroom)) if focus: chart_data.append(RoomPerformanceBreakdown.for_focusroom(subjectroom.focusroom)) return HWCentralJsonResponse(chart_data)
def classroom_data(self): chart_data = [] focus = self.classteacher.userinfo.school.schoolprofile.focus for subjectroom in SubjectRoom.objects.filter(classRoom=self.classroom): chart_data.append(RoomPerformanceBreakdown.for_subjectroom(subjectroom)) if focus: chart_data.append(RoomPerformanceBreakdown.for_focusroom(subjectroom.focusroom)) return HWCentralJsonResponse(chart_data)
def completion_chart_data(self): if not is_assignment_active(self.assignment): return HWCentralJsonResponse([AssignmentCompletionElement.build_shell(student) for student in self.assignment.content_object.students.all()]) chart_data = [] submission_exists_student_pks = [] # assignment is active for submission in Submission.objects.filter(assignment=self.assignment).order_by('-completion'): submission_exists_student_pks.append(submission.student.pk) chart_data.append(AssignmentCompletionElement.build_from_submission(submission)) # Only if assignment is uncorrected - # add assignment completion elements for all students that did not have submission if not is_assignment_corrected(self.assignment): for student in self.assignment.content_object.students.exclude(pk__in=submission_exists_student_pks): chart_data.append(AssignmentCompletionElement.build_shell(student)) return HWCentralJsonResponse(chart_data)
def anon_open_assignment_chart_data(self): chart_data = [] for submission in get_adjacent_open_submissions(self.assignment): chart_data.append(AnonAssignmentPerformanceElement(submission)) return HWCentralJsonResponse(chart_data)
def parent_endpoint(self): if not is_parent_child_relationship(self.user, self.student): return Json404Response() return HWCentralJsonResponse( StudentEdgeData(self.student, self.subjectroom))
def open_student_endpoint(self): return HWCentralJsonResponse([ OpenSubjectRoomSelectElem(subjectroom) for subjectroom in self.user.subjects_enrolled_set.all() ])
def anon_assignment_chart_data(self): chart_data = [] for submission in Submission.objects.filter(assignment=self.assignment): chart_data.append(AnonAssignmentPerformanceElement(submission)) return HWCentralJsonResponse(chart_data)
def single_focusroom_data(self): return HWCentralJsonResponse(RoomPerformanceBreakdown.for_focusroom(self.focusroom))
def sphinx_failure_response(message): return HWCentralJsonResponse({'success': False, 'message': message})
def student_chart_data(self): return HWCentralJsonResponse(PerformanceBreakdown.for_subjectroom(self.student, self.subjectroom))
def sphinx_success_response(data): return HWCentralJsonResponse({'success': True, 'payload': data})
def anon_assignment_chart_data(self): chart_data = [] for submission in self.get_standard_submissions(): chart_data.append(AnonAssignmentPerformanceElement(submission)) return HWCentralJsonResponse(chart_data)
def student_endpoint(self): if self.user != self.student: return Json404Response() return HWCentralJsonResponse( StudentEdgeData(self.student, self.subjectroom))
def admin_endpoint(self): if self.user.userinfo.school == self.subjectroom.classRoom.school: return HWCentralJsonResponse( SubjectRoomEdgeData(self.user, self.subjectroom)) return Json404Response()
def teacher_endpoint(self): if self.user == self.subjectroom.teacher or self.user == self.subjectroom.classRoom.classTeacher: return HWCentralJsonResponse( SubjectRoomEdgeData(self.user, self.subjectroom)) return Json404Response()
def admin_endpoint(self): if self.user.userinfo.school == self.student.userinfo.school: return HWCentralJsonResponse( StudentEdgeData(self.student, self.subjectroom)) return Json404Response()
def open_student_chart_data(self): return HWCentralJsonResponse(OpenStudentPerformance(self.student))
def single_subjectroom_data(self): return HWCentralJsonResponse(RoomPerformanceBreakdown.for_subjectroom(self.subjectroom))
def open_student_chart_data(self): return HWCentralJsonResponse(OpenPerformanceBreakdown(self.student, self.subjectroom))
def formatted_response(cls, utils): return HWCentralJsonResponse([ AnnouncementRow(announcement) for announcement in utils.get_announcements() ])