Exemplo n.º 1
0
def create_ml_model(student_id, location):
    sub = get_sub("IN", student_id, location, "ML")
    sub.state = SubmissionState.finished
    sub.save()

    pl = PeerLocation(location, student_id)
    control = SubmissionControl(pl.latest_submission())

    # Create enough instructor graded submissions that ML will work.
    for i in xrange(0, control.minimum_to_use_ai):
        sub = get_sub("IN", student_id, location, "ML")
        sub.state = SubmissionState.finished
        sub.save()

        grade = get_grader("IN")
        grade.submission = sub
        grade.save()

    # Create ML Model
    ml_model_creation.handle_single_location(location)
Exemplo n.º 2
0
def create_ml_model(student_id, location):
    sub = get_sub("IN",student_id,location, "ML")
    sub.state = SubmissionState.finished
    sub.save()

    pl = PeerLocation(location, student_id)
    control = SubmissionControl(pl.latest_submission())

    # Create enough instructor graded submissions that ML will work.
    for i in xrange(0, control.minimum_to_use_ai):
        sub = get_sub("IN", student_id, location, "ML")
        sub.state = SubmissionState.finished
        sub.save()

        grade = get_grader("IN")
        grade.submission = sub
        grade.save()

    # Create ML Model
    ml_model_creation.handle_single_location(location)
    def test_subs_to_peer_grading(self):
        submission = test_util.get_sub(
            "BC",
            STUDENT_ID,
            LOCATION,
            course_id=COURSE_ID,
            preferred_grader_type="PE",
            student_response="This is answer."
        )
        submission.preferred_grader_type = "NA"
        submission.save()

        handle_submission(submission)

        submission = Submission.objects.get(id=submission.id)
        self.assertEqual(
            submission.state, SubmissionState.waiting_to_be_graded
        )
        self.assertEqual(submission.preferred_grader_type, "PE")
        self.assertEqual(submission.next_grader_type, "IN")

        # Skipping submission from instructor to ML.
        set_instructor_grading_item_back_to_preferred_grader(submission.id)
        submission = Submission.objects.get(id=submission.id)
        submission.next_grader_type = "ML"
        submission.save()

        # Divert skipped submission to peer grading.
        update_subs_skipped_by_instructor(COURSE_ID, dry_run=False)

        # Next grader type should be PE.
        submission = Submission.objects.get(id=submission.id)
        self.assertEqual(submission.next_grader_type, "PE")

        peer_location = PeerLocation(student_id="123", location=LOCATION)
        pending_submissions = peer_location.pending()
        self.assertEqual(pending_submissions.count(), 1)