3231 Handle grading service being down when approving phase two

This commit is contained in:
Andreas Svanberg 2023-11-27 13:03:44 +01:00
parent a69784091f
commit d63ed58330
2 changed files with 20 additions and 6 deletions

@ -145,13 +145,25 @@ public class RoughDraftApprovalDecisionPage extends ReviewerPage {
public void onSubmit() {
super.onSubmit();
Project project = approval.getObject().getProject();
for (User author : project.getProjectParticipants()) {
reportGrade(author, project);
try {
for (User author : project.getProjectParticipants()) {
reportGrade(author, project);
}
reviewerDecisionService.approve(
approval.getObject(),
feedback.getModelObject(),
WicketFileUpload.ofOptional(attachment.getFileUpload()));
} catch (RuntimeException e) {
// When the grade service is down
LOGGER.log(
System.Logger.Level.ERROR,
"Failed to report phase two grades to Daisy: %s (%d)"
.formatted(
project.getTitle(),
project.getId()),
e);
error(getString("error_while_reporting_phase_two_grades"));
}
reviewerDecisionService.approve(
approval.getObject(),
feedback.getModelObject(),
WicketFileUpload.ofOptional(attachment.getFileUpload()));
}
});
}

@ -9,3 +9,5 @@ report_halfway_explanation=If you choose to approve the rough draft of this proj
the appropriate passing grade(s) for the author(s) according to the following.
failed_to_report_phase_two_grade=Could not report all the grades, please contact the supervisor and let them know \
they will have to report it themselves.
error_while_reporting_phase_two_grades=Failed to report the grades so the approval was not accepted, \
please try again later. If the problem persists, contact the support.