Ejemplo n.º 1
0
def reset_subs_in_basic_check(subs):
    #Reset submissions that are stuck in basic check state
    subs_stuck_in_basic_check=subs.filter(
        next_grader_type="BC",
        state__in=[SubmissionState.waiting_to_be_graded, SubmissionState.being_graded]
    )

    count=0
    for sub in subs_stuck_in_basic_check:
        handle_submission(sub)
        count+=1

    if count>0:
        statsd.increment("open_ended_assessment.grading_controller.expire_submissions.reset_subs_in_basic_check",
            tags=["counter:{0}".format(count)])
        log.debug("Reset {0} basic check subs properly.".format(count))
    return True
Ejemplo n.º 2
0
def reset_subs_in_basic_check():
    #Reset submissions that are stuck in basic check state
    subs_stuck_in_basic_check=Submission.objects.filter(
        next_grader_type="BC",
        state__in=[SubmissionState.waiting_to_be_graded, SubmissionState.being_graded]
    )

    count=0
    for sub in subs_stuck_in_basic_check:
        handle_submission(sub)
        count+=1

    if count>0:
        statsd.increment("open_ended_assessment.grading_controller.expire_submissions.reset_subs_in_basic_check",
            tags=["counter:{0}".format(count)])
        log.debug("Reset {0} basic check subs properly.".format(count))
    return True
Ejemplo n.º 3
0
def reset_failed_subs_in_basic_check(subs):
    #Reset submissions that are stuck in basic check state
    subs_failed_basic_check=subs.filter(
        grader__grader_type="BC",
        grader__status_code= GraderStatus.failure,
        state=SubmissionState.waiting_to_be_graded,
    ).exclude(grader__status_code=GraderStatus.success)

    count=0
    for sub in subs_failed_basic_check:
        handle_submission(sub)
        count+=1

    if count>0:
        statsd.increment("open_ended_assessment.grading_controller.expire_submissions.reset_subs_failed_basic_check",
            tags=["counter:{0}".format(count)])
        log.debug("Reset {0} basic check failed subs properly.".format(count))
    return True
Ejemplo n.º 4
0
def reset_failed_subs_in_basic_check():
    #Reset submissions that are stuck in basic check state
    subs_failed_basic_check=Submission.objects.filter(
        grader__grader_type="BC",
        grader__status_code= GraderStatus.failure,
        state=SubmissionState.waiting_to_be_graded,
    ).exclude(grader__status_code=GraderStatus.success)

    count=0
    for sub in subs_failed_basic_check:
        handle_submission(sub)
        count+=1

    if count>0:
        statsd.increment("open_ended_assessment.grading_controller.expire_submissions.reset_subs_failed_basic_check",
            tags=["counter:{0}".format(count)])
        log.debug("Reset {0} basic check failed subs properly.".format(count))
    return True
Ejemplo n.º 5
0
    def test_check_if_grading_finished_for_duplicates(self):

        for i in xrange(0,settings.MIN_TO_USE_PEER):
            test_sub = test_util.get_sub("PE", STUDENT_ID, LOCATION, "PE")
            test_sub.save()
            handle_submission(test_sub)
            test_grader = test_util.get_grader("IN")
            test_grader.submission=test_sub
            test_grader.save()

            test_sub.state = SubmissionState.finished
            test_sub.previous_grader_type = "IN"
            test_sub.posted_results_back_to_queue = True
            test_sub.save()

        test_sub2 = test_util.get_sub("PE", STUDENT_ID, LOCATION, "PE")
        test_sub2.save()
        handle_submission(test_sub2)
        self.assertTrue(test_sub2.is_duplicate)

        success = expire_submissions.check_if_grading_finished_for_duplicates()
        self.assertEqual(success, True)
        test_sub2.is_duplicate = False
        test_sub2.save()

        test_sub3 = test_util.get_sub("PE", STUDENT_ID, LOCATION, "PE")
        test_sub3.is_duplicate = False
        test_sub3.save()

        self.assertEqual(test_sub3.is_duplicate, False)
        test_sub3.has_been_duplicate_checked = False
        test_sub3.save()
        expire_submissions.mark_student_duplicate_submissions()
        test_sub3 = Submission.objects.get(id=test_sub3.id)
        self.assertEqual(test_sub3.is_duplicate,True)

        test_sub3.duplicate_submission_id = None
        test_sub3.is_plagiarized = False
        test_sub3.save()
        expire_submissions.add_in_duplicate_ids()
        test_sub3 = Submission.objects.get(id=test_sub3.id)
        self.assertTrue(test_sub3.duplicate_submission_id is not None)
Ejemplo n.º 6
0
    def test_check_if_grading_finished_for_duplicates(self):

        for i in xrange(0, settings.MIN_TO_USE_PEER):
            test_sub = test_util.get_sub("PE", STUDENT_ID, LOCATION, "PE")
            test_sub.save()
            handle_submission(test_sub)
            test_grader = test_util.get_grader("IN")
            test_grader.submission = test_sub
            test_grader.save()

            test_sub.state = SubmissionState.finished
            test_sub.previous_grader_type = "IN"
            test_sub.posted_results_back_to_queue = True
            test_sub.save()

        test_sub2 = test_util.get_sub("PE", STUDENT_ID, LOCATION, "PE")
        test_sub2.save()
        handle_submission(test_sub2)
        self.assertTrue(test_sub2.is_duplicate)

        success = expire_submissions.check_if_grading_finished_for_duplicates()
        self.assertEqual(success, True)
        test_sub2.is_duplicate = False
        test_sub2.save()

        test_sub3 = test_util.get_sub("PE", STUDENT_ID, LOCATION, "PE")
        test_sub3.is_duplicate = False
        test_sub3.save()

        self.assertEqual(test_sub3.is_duplicate, False)
        test_sub3.has_been_duplicate_checked = False
        test_sub3.save()
        expire_submissions.mark_student_duplicate_submissions()
        test_sub3 = Submission.objects.get(id=test_sub3.id)
        self.assertEqual(test_sub3.is_duplicate, True)

        test_sub3.duplicate_submission_id = None
        test_sub3.is_plagiarized = False
        test_sub3.save()
        expire_submissions.add_in_duplicate_ids()
        test_sub3 = Submission.objects.get(id=test_sub3.id)
        self.assertTrue(test_sub3.duplicate_submission_id is not None)