예제 #1
0
파일: tests.py 프로젝트: pombreda/edx-ora
    def test_submission_course(self):
        Submission.objects.all().delete()
        test_sub = test_util.get_sub("PE",
                                     STUDENT_ID,
                                     LOCATION,
                                     preferred_grader_type="PE")
        test_sub.save()
        test_grader = test_util.get_grader("BC")
        test_grader.submission = test_sub
        test_grader.save()

        test_sub2 = test_util.get_sub("PE",
                                      ALTERNATE_STUDENT,
                                      LOCATION,
                                      preferred_grader_type="PE")
        test_sub2.save()

        test_grader2 = test_util.get_grader("BC")
        test_grader2.submission = test_sub2
        test_grader2.save()

        sc = peer_grading_util.PeerCourse(COURSE_ID, STUDENT_ID)
        success, needs_to_grade = sc.notifications()
        self.assertTrue(needs_to_grade)
        self.assertEqual(sc.submitted().count(), 1)
예제 #2
0
파일: tests.py 프로젝트: sokratik/edx-ora
    def test_get_peer_grading_notifications(self):
        test_sub = test_util.get_sub("PE", ALTERNATE_STUDENT, LOCATION, "PE")
        test_sub.save()
        handle_submission(test_sub)
        test_sub.next_grader_type = "PE"
        test_sub.is_duplicate = False
        test_sub.save()

        test_sub = test_util.get_sub("PE", STUDENT_ID, LOCATION, "PE")
        test_sub.save()
        handle_submission(test_sub)
        test_sub.next_grader_type = "PE"
        test_sub.is_duplicate = False
        test_sub.save()

        pc = peer_grading_util.PeerCourse(COURSE_ID, ALTERNATE_STUDENT)
        success, student_needs_to_peer_grade = pc.notifications()
        self.assertEqual(success, True)
        self.assertEqual(student_needs_to_peer_grade, True)
예제 #3
0
def get_notifications(request):
    if request.method != "GET":
        error_message = "Request needs to be GET."
        log.error(error_message)
        return util._error_response(error_message, _INTERFACE_VERSION)

    course_id = request.GET.get("course_id")
    student_id = request.GET.get("student_id")

    if not course_id or not student_id:
        error_message = "Missing needed tag course_id or student_id"
        log.error(error_message)
        return util._error_response(error_message, _INTERFACE_VERSION)

    pc = peer_grading_util.PeerCourse(course_id, student_id)
    success, student_needs_to_peer_grade = pc.notifications()
    if not success:
        return util._error_response(student_needs_to_peer_grade,
                                    _INTERFACE_VERSION)

    util.log_connection_data()
    return util._success_response(
        {'student_needs_to_peer_grade': student_needs_to_peer_grade},
        _INTERFACE_VERSION)