Skip to content

Commit

Permalink
1770 - Ensure consistent peer review status update (#1780)
Browse files Browse the repository at this point in the history
  • Loading branch information
SnehaHS65 authored Jul 25, 2024
2 parents 8d42bd1 + 1843c81 commit 4fcd92b
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,17 @@ public String handleSubmit(
logger.info("approvedCount: " + approvedCount);
logger.info("notApprovedCount: " + notApprovedCount);
LetterSound letterSound = letterSoundContributionEvent.getLetterSound();
updatePeerReviewStatus(letterSound, approvedCount, notApprovedCount);

return "redirect:/content/letter-sound/edit/" + letterSoundContributionEvent.getLetterSound().getId() + "#contribution-events";
}

private void updatePeerReviewStatus(LetterSound letterSound, int approvedCount, int notApprovedCount) {
if (approvedCount >= notApprovedCount) {
letterSound.setPeerReviewStatus(PeerReviewStatus.APPROVED);
} else {
letterSound.setPeerReviewStatus(PeerReviewStatus.NOT_APPROVED);
}
letterSoundDao.update(letterSound);

return "redirect:/content/letter-sound/edit/" + letterSoundContributionEvent.getLetterSound().getId() + "#contribution-events";
}
}

0 comments on commit 4fcd92b

Please sign in to comment.