diff --git a/gymboard-api/src/main/java/nl/andrewlalis/gymboard_api/controller/GymController.java b/gymboard-api/src/main/java/nl/andrewlalis/gymboard_api/controller/GymController.java index 41dc25f..351fa94 100644 --- a/gymboard-api/src/main/java/nl/andrewlalis/gymboard_api/controller/GymController.java +++ b/gymboard-api/src/main/java/nl/andrewlalis/gymboard_api/controller/GymController.java @@ -2,7 +2,6 @@ package nl.andrewlalis.gymboard_api.controller; import nl.andrewlalis.gymboard_api.controller.dto.*; import nl.andrewlalis.gymboard_api.service.GymService; -import nl.andrewlalis.gymboard_api.service.LeaderboardService; import nl.andrewlalis.gymboard_api.service.UploadService; import nl.andrewlalis.gymboard_api.service.submission.ExerciseSubmissionService; import org.springframework.http.MediaType; diff --git a/gymboard-api/src/main/java/nl/andrewlalis/gymboard_api/service/submission/SubmissionProcessingService.java b/gymboard-api/src/main/java/nl/andrewlalis/gymboard_api/service/submission/SubmissionProcessingService.java index 200a639..8690662 100644 --- a/gymboard-api/src/main/java/nl/andrewlalis/gymboard_api/service/submission/SubmissionProcessingService.java +++ b/gymboard-api/src/main/java/nl/andrewlalis/gymboard_api/service/submission/SubmissionProcessingService.java @@ -90,7 +90,7 @@ public class SubmissionProcessingService { // Set the status to processing. submission.setStatus(ExerciseSubmission.Status.PROCESSING); - exerciseSubmissionRepository.save(submission); + exerciseSubmissionRepository.saveAndFlush(submission); // Then try and fetch the temporary video file associated with it. Optional optionalTempFile = tempFileRepository.findBySubmission(submission); @@ -105,7 +105,7 @@ public class SubmissionProcessingService { if (!Files.exists(tempFilePath) || !Files.isReadable(tempFilePath)) { log.error("Submission {} failed because the temporary video file {} isn't readable.", submission.getId(), tempFilePath); submission.setStatus(ExerciseSubmission.Status.FAILED); - exerciseSubmissionRepository.save(submission); + exerciseSubmissionRepository.saveAndFlush(submission); return; } @@ -135,7 +135,7 @@ public class SubmissionProcessingService { e.getMessage() ); submission.setStatus(ExerciseSubmission.Status.FAILED); - exerciseSubmissionRepository.save(submission); + exerciseSubmissionRepository.saveAndFlush(submission); return; }