Removed unused import, changed to save and flush submission during processing.
This commit is contained in:
parent
75c0fdcff6
commit
1034f7e65a
|
@ -2,7 +2,6 @@ package nl.andrewlalis.gymboard_api.controller;
|
||||||
|
|
||||||
import nl.andrewlalis.gymboard_api.controller.dto.*;
|
import nl.andrewlalis.gymboard_api.controller.dto.*;
|
||||||
import nl.andrewlalis.gymboard_api.service.GymService;
|
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.UploadService;
|
||||||
import nl.andrewlalis.gymboard_api.service.submission.ExerciseSubmissionService;
|
import nl.andrewlalis.gymboard_api.service.submission.ExerciseSubmissionService;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
|
|
|
@ -90,7 +90,7 @@ public class SubmissionProcessingService {
|
||||||
|
|
||||||
// Set the status to processing.
|
// Set the status to processing.
|
||||||
submission.setStatus(ExerciseSubmission.Status.PROCESSING);
|
submission.setStatus(ExerciseSubmission.Status.PROCESSING);
|
||||||
exerciseSubmissionRepository.save(submission);
|
exerciseSubmissionRepository.saveAndFlush(submission);
|
||||||
|
|
||||||
// Then try and fetch the temporary video file associated with it.
|
// Then try and fetch the temporary video file associated with it.
|
||||||
Optional<ExerciseSubmissionTempFile> optionalTempFile = tempFileRepository.findBySubmission(submission);
|
Optional<ExerciseSubmissionTempFile> optionalTempFile = tempFileRepository.findBySubmission(submission);
|
||||||
|
@ -105,7 +105,7 @@ public class SubmissionProcessingService {
|
||||||
if (!Files.exists(tempFilePath) || !Files.isReadable(tempFilePath)) {
|
if (!Files.exists(tempFilePath) || !Files.isReadable(tempFilePath)) {
|
||||||
log.error("Submission {} failed because the temporary video file {} isn't readable.", submission.getId(), tempFilePath);
|
log.error("Submission {} failed because the temporary video file {} isn't readable.", submission.getId(), tempFilePath);
|
||||||
submission.setStatus(ExerciseSubmission.Status.FAILED);
|
submission.setStatus(ExerciseSubmission.Status.FAILED);
|
||||||
exerciseSubmissionRepository.save(submission);
|
exerciseSubmissionRepository.saveAndFlush(submission);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ public class SubmissionProcessingService {
|
||||||
e.getMessage()
|
e.getMessage()
|
||||||
);
|
);
|
||||||
submission.setStatus(ExerciseSubmission.Status.FAILED);
|
submission.setStatus(ExerciseSubmission.Status.FAILED);
|
||||||
exerciseSubmissionRepository.save(submission);
|
exerciseSubmissionRepository.saveAndFlush(submission);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue