Search in sources :

Example 76 with StudentParticipation

use of de.tum.in.www1.artemis.domain.participation.StudentParticipation in project ArTEMiS by ls1intum.

the class AssessmentServiceTest method createModelingExerciseSubmissionAndCalculateScore.

@Test
@WithMockUser(username = "instructor1", roles = "INSTRUCTOR")
public void createModelingExerciseSubmissionAndCalculateScore() {
    ModelingExercise exercise = createModelingExerciseWithSGI(course1);
    Submission submissionWithoutResult = new ModelingSubmission();
    submissionWithoutResult.setSubmissionDate(pastTimestamp.plusMinutes(3L));
    submissionWithoutResult = database.addSubmission(exercise, submissionWithoutResult, "student1");
    database.addSubmission((StudentParticipation) submissionWithoutResult.getParticipation(), submissionWithoutResult);
    List<Feedback> feedbacks = createFeedback(exercise);
    var result = new Result();
    result.setSubmission(submissionWithoutResult);
    result.setFeedbacks(feedbacks);
    result.setParticipation(submissionWithoutResult.getParticipation());
    submissionWithoutResult.addResult(result);
    resultRepository.submitResult(result, exercise, exerciseDateService.getDueDate(result.getParticipation()));
    resultRepository.save(result);
    assertThat(result.getResultString()).isEqualTo("6 of 7 points");
}
Also used : ModelingSubmission(de.tum.in.www1.artemis.domain.modeling.ModelingSubmission) ModelingSubmission(de.tum.in.www1.artemis.domain.modeling.ModelingSubmission) ModelingExercise(de.tum.in.www1.artemis.domain.modeling.ModelingExercise) WithMockUser(org.springframework.security.test.context.support.WithMockUser) AbstractSpringIntegrationBambooBitbucketJiraTest(de.tum.in.www1.artemis.AbstractSpringIntegrationBambooBitbucketJiraTest) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 77 with StudentParticipation

use of de.tum.in.www1.artemis.domain.participation.StudentParticipation in project ArTEMiS by ls1intum.

the class AssessmentServiceTest method createTextExerciseSubmissionAndCalculateScore.

@Test
@WithMockUser(username = "instructor1", roles = "INSTRUCTOR")
public void createTextExerciseSubmissionAndCalculateScore() {
    TextExercise exercise = createTextExerciseWithSGI(course1);
    Submission submissionWithoutResult = new TextSubmission();
    submissionWithoutResult.setSubmissionDate(pastTimestamp.plusMinutes(3L));
    submissionWithoutResult = database.addSubmission(exercise, submissionWithoutResult, "student1");
    database.addSubmission((StudentParticipation) submissionWithoutResult.getParticipation(), submissionWithoutResult);
    List<Feedback> feedbacks = createFeedback(exercise);
    var result = new Result();
    result.setSubmission(submissionWithoutResult);
    result.setFeedbacks(feedbacks);
    result.setParticipation(submissionWithoutResult.getParticipation());
    submissionWithoutResult.addResult(result);
    resultRepository.submitResult(result, exercise, exerciseDateService.getDueDate(result.getParticipation()));
    resultRepository.save(result);
    assertThat(result.getResultString()).isEqualTo("6 of 7 points");
}
Also used : ModelingSubmission(de.tum.in.www1.artemis.domain.modeling.ModelingSubmission) WithMockUser(org.springframework.security.test.context.support.WithMockUser) AbstractSpringIntegrationBambooBitbucketJiraTest(de.tum.in.www1.artemis.AbstractSpringIntegrationBambooBitbucketJiraTest) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 78 with StudentParticipation

use of de.tum.in.www1.artemis.domain.participation.StudentParticipation in project ArTEMiS by ls1intum.

the class AssessmentServiceTest method testNotRatedAfterSubmitResultWithDueDateBeforeSubmissionDateOfResult.

@Test
@WithMockUser(username = "instructor1", roles = "INSTRUCTOR")
public void testNotRatedAfterSubmitResultWithDueDateBeforeSubmissionDateOfResult() {
    TextExercise exercise = createTextExerciseWithSGI(course1);
    Submission submissionWithoutResult = new TextSubmission();
    submissionWithoutResult.setSubmissionDate(futureFutureTimestamp);
    submissionWithoutResult = database.addSubmission(exercise, submissionWithoutResult, "student1");
    database.addSubmission((StudentParticipation) submissionWithoutResult.getParticipation(), submissionWithoutResult);
    List<Feedback> feedbacks = createFeedback(exercise);
    var result = new Result();
    result.setSubmission(submissionWithoutResult);
    result.setFeedbacks(feedbacks);
    result.setParticipation(submissionWithoutResult.getParticipation());
    submissionWithoutResult.addResult(result);
    resultRepository.submitResult(result, exercise, exerciseDateService.getDueDate(result.getParticipation()));
    resultRepository.save(result);
    assertThat(result.isRated()).isFalse();
}
Also used : ModelingSubmission(de.tum.in.www1.artemis.domain.modeling.ModelingSubmission) WithMockUser(org.springframework.security.test.context.support.WithMockUser) AbstractSpringIntegrationBambooBitbucketJiraTest(de.tum.in.www1.artemis.AbstractSpringIntegrationBambooBitbucketJiraTest) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 79 with StudentParticipation

use of de.tum.in.www1.artemis.domain.participation.StudentParticipation in project ArTEMiS by ls1intum.

the class ResultListenerIntegrationTest method createNewResult.

public Result createNewResult(boolean isTeamTest, boolean isRated) {
    StudentParticipation studentParticipation;
    SecurityUtils.setAuthorizationObject();
    if (isTeamTest) {
        studentParticipation = studentParticipationRepository.findByExerciseIdAndTeamId(idOfTeamTextExercise, idOfTeam1).get(0);
    } else {
        studentParticipation = studentParticipationRepository.findByExerciseIdAndStudentId(idOfIndividualTextExercise, idOfStudent1).get(0);
    }
    return database.createSubmissionAndResult(studentParticipation, 100, isRated);
}
Also used : StudentParticipation(de.tum.in.www1.artemis.domain.participation.StudentParticipation)

Example 80 with StudentParticipation

use of de.tum.in.www1.artemis.domain.participation.StudentParticipation in project ArTEMiS by ls1intum.

the class ResultServiceIntegrationTest method setupExamModelingExerciseWithResults.

private void setupExamModelingExerciseWithResults() {
    var now = ZonedDateTime.now();
    for (int i = 1; i <= 5; i++) {
        ModelingSubmission modelingSubmission = new ModelingSubmission();
        modelingSubmission.model("Testingsubmission");
        modelingSubmission.submitted(true);
        modelingSubmission.submissionDate(now.minusHours(2));
        database.addSubmission(this.examModelingExercise, modelingSubmission, "student" + i);
        database.addResultToSubmission(modelingSubmission, AssessmentType.MANUAL, database.getUserByLogin("instructor1"), 12D, true);
    }
    // empty participation with submission
    StudentParticipation participation = new StudentParticipation();
    participation.setInitializationDate(ZonedDateTime.now());
    participation.setParticipant(null);
    participation.setExercise(this.examModelingExercise);
    studentParticipationRepository.save(participation);
    ModelingSubmission modelingSubmission = new ModelingSubmission();
    modelingSubmission.model("Text");
    modelingSubmission.submitted(true);
    modelingSubmission.submissionDate(now.minusHours(3));
    participation.addSubmission(modelingSubmission);
    modelingSubmission.setParticipation(participation);
    submissionRepository.save(modelingSubmission);
    studentParticipationRepository.save(participation);
}
Also used : ModelingSubmission(de.tum.in.www1.artemis.domain.modeling.ModelingSubmission) ProgrammingExerciseStudentParticipation(de.tum.in.www1.artemis.domain.participation.ProgrammingExerciseStudentParticipation) StudentParticipation(de.tum.in.www1.artemis.domain.participation.StudentParticipation)

Aggregations

StudentParticipation (de.tum.in.www1.artemis.domain.participation.StudentParticipation)219 Test (org.junit.jupiter.api.Test)118 WithMockUser (org.springframework.security.test.context.support.WithMockUser)112 ModelingSubmission (de.tum.in.www1.artemis.domain.modeling.ModelingSubmission)60 ModelingExercise (de.tum.in.www1.artemis.domain.modeling.ModelingExercise)50 ProgrammingExerciseStudentParticipation (de.tum.in.www1.artemis.domain.participation.ProgrammingExerciseStudentParticipation)48 ZonedDateTime (java.time.ZonedDateTime)44 QuizExercise (de.tum.in.www1.artemis.domain.quiz.QuizExercise)42 EntityNotFoundException (de.tum.in.www1.artemis.web.rest.errors.EntityNotFoundException)40 AbstractSpringIntegrationBambooBitbucketJiraTest (de.tum.in.www1.artemis.AbstractSpringIntegrationBambooBitbucketJiraTest)36 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)36 Exam (de.tum.in.www1.artemis.domain.exam.Exam)30 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)30 TextPlagiarismResult (de.tum.in.www1.artemis.domain.plagiarism.text.TextPlagiarismResult)28 de.tum.in.www1.artemis.repository (de.tum.in.www1.artemis.repository)28 ModelingPlagiarismResult (de.tum.in.www1.artemis.domain.plagiarism.modeling.ModelingPlagiarismResult)26 de.tum.in.www1.artemis.domain (de.tum.in.www1.artemis.domain)24 StudentExam (de.tum.in.www1.artemis.domain.exam.StudentExam)24 Participation (de.tum.in.www1.artemis.domain.participation.Participation)24 Collectors (java.util.stream.Collectors)24