use of de.tum.in.www1.artemis.domain.participation.Participation in project Artemis by ls1intum.
the class DatabaseUtilService method addModelingSubmissionWithEmptyResult.
/**
* Stores for the given model a submission of the user and initiates the corresponding Result
*
* @param exercise exercise the submission belongs to
* @param model ModelingSubmission json as string contained in the submission
* @param login of the user the submission belongs to
* @return submission stored in the modelingSubmissionRepository
*/
public ModelingSubmission addModelingSubmissionWithEmptyResult(ModelingExercise exercise, String model, String login) {
StudentParticipation participation = createAndSaveParticipationForExercise(exercise, login);
ModelingSubmission submission = ModelFactory.generateModelingSubmission(model, true);
submission = modelSubmissionService.save(submission, exercise, login);
Result result = new Result();
result = resultRepo.save(result);
result.setSubmission(submission);
submission.addResult(result);
participation.addResult(result);
studentParticipationRepo.save(participation);
modelingSubmissionRepo.save(submission);
resultRepo.save(result);
return submission;
}
use of de.tum.in.www1.artemis.domain.participation.Participation in project Artemis by ls1intum.
the class DatabaseUtilService method saveTextSubmissionWithResultAndAssessor.
private TextSubmission saveTextSubmissionWithResultAndAssessor(TextExercise exercise, TextSubmission submission, String studentLogin, Long teamId, String assessorLogin) {
StudentParticipation participation = Optional.ofNullable(studentLogin).map(login -> createAndSaveParticipationForExercise(exercise, login)).orElseGet(() -> addTeamParticipationForExercise(exercise, teamId));
submissionRepository.save(submission);
participation.addSubmission(submission);
Result result = new Result();
result.setAssessor(getUserByLogin(assessorLogin));
result.setScore(100D);
if (exercise.getReleaseDate() != null) {
result.setCompletionDate(exercise.getReleaseDate());
} else {
// exam exercises do not have a release date
result.setCompletionDate(ZonedDateTime.now());
}
result = resultRepo.save(result);
result.setSubmission(submission);
submission.setParticipation(participation);
submission.addResult(result);
submission.getParticipation().addResult(result);
submission = textSubmissionRepo.save(submission);
resultRepo.save(result);
studentParticipationRepo.save(participation);
submission = textSubmissionRepo.save(submission);
return submission;
}
use of de.tum.in.www1.artemis.domain.participation.Participation in project Artemis by ls1intum.
the class DatabaseUtilService method saveFileUploadSubmissionWithResultAndAssessorFeedback.
public FileUploadSubmission saveFileUploadSubmissionWithResultAndAssessorFeedback(FileUploadExercise exercise, FileUploadSubmission fileUploadSubmission, String login, String assessorLogin, List<Feedback> feedbacks) {
StudentParticipation participation = createAndSaveParticipationForExercise(exercise, login);
submissionRepository.save(fileUploadSubmission);
participation.addSubmission(fileUploadSubmission);
Result result = new Result();
result.setAssessor(getUserByLogin(assessorLogin));
result.setScore(100D);
result.setParticipation(participation);
result.setResultString(exercise.getMaxPoints(), exercise.getMaxPoints());
if (exercise.getReleaseDate() != null) {
result.setCompletionDate(exercise.getReleaseDate());
} else {
// exam exercises do not have a release date
result.setCompletionDate(ZonedDateTime.now());
}
result.setFeedbacks(feedbacks);
result = resultRepo.save(result);
for (Feedback feedback : feedbacks) {
feedback.setResult(result);
}
result = resultRepo.save(result);
result.setSubmission(fileUploadSubmission);
fileUploadSubmission.setParticipation(participation);
fileUploadSubmission.addResult(result);
fileUploadSubmission.getParticipation().addResult(result);
fileUploadSubmission = fileUploadSubmissionRepo.save(fileUploadSubmission);
studentParticipationRepo.save(participation);
return fileUploadSubmission;
}
use of de.tum.in.www1.artemis.domain.participation.Participation in project Artemis by ls1intum.
the class DatabaseUtilService method addComplaints.
public void addComplaints(String studentLogin, Participation participation, int numberOfComplaints, ComplaintType complaintType) {
for (int i = 0; i < numberOfComplaints; i++) {
Result dummyResult = new Result().participation(participation);
dummyResult = resultRepo.save(dummyResult);
Complaint complaint = new Complaint().participant(getUserByLogin(studentLogin)).result(dummyResult).complaintType(complaintType);
complaintRepo.save(complaint);
}
}
use of de.tum.in.www1.artemis.domain.participation.Participation in project ArTEMiS by ls1intum.
the class RepositoryResource method pullChanges.
/**
* Pull into the participation repository.
*
* @param domainId that serves as an abstract identifier for retrieving the repository.
* @return ResponseEntity with appropriate status (e.g. ok or forbidden).
*/
public ResponseEntity<Void> pullChanges(Long domainId) {
log.debug("REST request to commit Repository for domainId : {}", domainId);
return executeAndCheckForExceptions(() -> {
Repository repository = getRepository(domainId, RepositoryActionType.READ, true);
repositoryService.pullChanges(repository);
return new ResponseEntity<>(HttpStatus.OK);
});
}
Aggregations