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");
}
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");
}
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();
}
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);
}
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);
}
Aggregations