Beispiel #1
0
 def open_student_endpoint(self):
     return Json404Response()
Beispiel #2
0
 def open_student_endpoint(self):
     if is_open_student_corrected_assignment_relationship(self.user, self.assignment):
         return self.anon_open_assignment_chart_data()
     return Json404Response()
Beispiel #3
0
    def open_student_endpoint(self):
        # validation - only the logged in open student should be able to see his/her own chart
        if self.student != self.user:
            return Json404Response()

        return self.open_student_chart_data()
Beispiel #4
0
    def admin_endpoint(self):
        # validation - the logged in admin should only see the subjectteacher's subjectrooms if the subjectteacher belongs to same school
        if self.user.userinfo.school != self.subjectteacher.userinfo.school:
            return Json404Response()

        return self.all_subjectroom_data()
Beispiel #5
0
    def admin_endpoint(self):
        # validation - the logged in admin should only see the classteacher's classroom if the classteacher belongs to same school
        if self.user.userinfo.school != self.classteacher.userinfo.school:
            return Json404Response()

        return self.classroom_data()
Beispiel #6
0
    def parent_endpoint(self):
        #validation - the logged in parent should only see the chart of his/her child
        if not is_parent_child_relationship(self.user, self.student):
            return Json404Response()

        return self.student_chart_data()
Beispiel #7
0
 def admin_endpoint(self):
     if self.user.userinfo.school == self.student.userinfo.school:
         return HWCentralJsonResponse(
             StudentEdgeData(self.student, self.subjectroom))
     return Json404Response()
Beispiel #8
0
def focusroom_chart_get(request, focusroom_id):
    statsd.increment('core.hits.chart.focusroom')
    try:
        focusroom = get_object_or_404(FocusRoom, pk=focusroom_id)
    except Http404, e:
        return Json404Response(e)
Beispiel #9
0
def subject_id_get(request, subjectroom_id):
    statsd.increment('edge.hits.get.subject_id')
    try:
        subjectroom = get_object_or_404(SubjectRoom, pk=subjectroom_id)
    except Http404, e:
        return Json404Response(e)
Beispiel #10
0
 def parent_endpoint(self):
     if not is_parent_child_relationship(self.user, self.student):
         return Json404Response()
     return HWCentralJsonResponse(
         StudentEdgeData(self.student, self.subjectroom))
Beispiel #11
0
        raise Http404
    else:
        raise InvalidHWCentralAssignmentTypeError(assignment_type)


@login_required
@statsd.timed('core.chart.student')
def student_chart_get(request, student_id):
    statsd.increment('core.hits.chart.student')

    try:
        student = get_object_or_404(User, pk=student_id)
    except Http404, e:
        return Json404Response(e)
    if student.userinfo.group != HWCentralGroup.refs.STUDENT and student.userinfo.group != HWCentralGroup.refs.OPEN_STUDENT:
        return Json404Response()

    return StudentChartGet(request, student).handle()


@login_required
@statsd.timed('core.chart.single_subject_student')
def single_subject_student_chart_get(request, student_id, subjectroom_id):
    statsd.increment('core.hits.chart.single_subject_student')

    try:
        student = get_object_or_404(User, pk=student_id)
    except Http404, e:
        return Json404Response(e)
    try:
        subjectroom = get_object_or_404(SubjectRoom, pk=subjectroom_id)
Beispiel #12
0
 def student_endpoint(self):
     if self.user != self.student:
         return Json404Response()
     return HWCentralJsonResponse(
         StudentEdgeData(self.student, self.subjectroom))
Beispiel #13
0
 def admin_endpoint(self):
     if self.user.userinfo.school == self.subjectroom.classRoom.school:
         return HWCentralJsonResponse(
             SubjectRoomEdgeData(self.user, self.subjectroom))
     return Json404Response()
Beispiel #14
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()
Beispiel #15
0
 def parent_endpoint(self):
     return Json404Response()
Beispiel #16
0
 def open_student_chart_data(self):
     return Json404Response()
Beispiel #17
0
    def admin_endpoint(self):
        # validation - the logged in admin should only see the assignment chart if the assignment belongs to same school
        if self.user.userinfo.school != (self.assignment.get_subjectroom()).classRoom.school:
            return Json404Response()

        return self.assignment_chart_data()
Beispiel #18
0
    def admin_endpoint(self):
        # validation - the logged in admin should only see the focusroom chart if focusroom belongs to same school
        if self.user.userinfo.school != self.focusroom.subjectRoom.classRoom.school:
            return Json404Response()

        return self.single_focusroom_data()
Beispiel #19
0
    def admin_endpoint(self):
        #validation - the logged in admin should only see the student chart if student belongs to same school
        if self.user.userinfo.school != self.student.userinfo.school:
            return Json404Response()

        return self.student_chart_data()
Beispiel #20
0
 def admin_endpoint(self):
     return Json404Response()