예제 #1
0
 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()
         ])
예제 #2
0
 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()
예제 #3
0
    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)
예제 #4
0
    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)
예제 #5
0
    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)
예제 #6
0
    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)
예제 #7
0
 def parent_endpoint(self):
     if not is_parent_child_relationship(self.user, self.student):
         return Json404Response()
     return HWCentralJsonResponse(
         StudentEdgeData(self.student, self.subjectroom))
예제 #8
0
 def open_student_endpoint(self):
     return HWCentralJsonResponse([
         OpenSubjectRoomSelectElem(subjectroom)
         for subjectroom in self.user.subjects_enrolled_set.all()
     ])
예제 #9
0
    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)
예제 #10
0
 def single_focusroom_data(self):
     return HWCentralJsonResponse(RoomPerformanceBreakdown.for_focusroom(self.focusroom))
예제 #11
0
def sphinx_failure_response(message):
    return HWCentralJsonResponse({'success': False, 'message': message})
예제 #12
0
 def student_chart_data(self):
     return HWCentralJsonResponse(PerformanceBreakdown.for_subjectroom(self.student, self.subjectroom))
예제 #13
0
def sphinx_success_response(data):
    return HWCentralJsonResponse({'success': True, 'payload': data})
예제 #14
0
    def anon_assignment_chart_data(self):
        chart_data = []
        for submission in self.get_standard_submissions():
            chart_data.append(AnonAssignmentPerformanceElement(submission))

        return HWCentralJsonResponse(chart_data)
예제 #15
0
 def student_endpoint(self):
     if self.user != self.student:
         return Json404Response()
     return HWCentralJsonResponse(
         StudentEdgeData(self.student, self.subjectroom))
예제 #16
0
 def admin_endpoint(self):
     if self.user.userinfo.school == self.subjectroom.classRoom.school:
         return HWCentralJsonResponse(
             SubjectRoomEdgeData(self.user, self.subjectroom))
     return Json404Response()
예제 #17
0
 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()
예제 #18
0
 def admin_endpoint(self):
     if self.user.userinfo.school == self.student.userinfo.school:
         return HWCentralJsonResponse(
             StudentEdgeData(self.student, self.subjectroom))
     return Json404Response()
예제 #19
0
 def open_student_chart_data(self):
     return HWCentralJsonResponse(OpenStudentPerformance(self.student))
예제 #20
0
 def single_subjectroom_data(self):
     return HWCentralJsonResponse(RoomPerformanceBreakdown.for_subjectroom(self.subjectroom))
예제 #21
0
 def open_student_chart_data(self):
     return HWCentralJsonResponse(OpenPerformanceBreakdown(self.student, self.subjectroom))
예제 #22
0
 def formatted_response(cls, utils):
     return HWCentralJsonResponse([
         AnnouncementRow(announcement)
         for announcement in utils.get_announcements()
     ])