Consider extracting the peer review status update logic into a separate method for better readability and maintainability.
+ 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);
}
LetterSound letterSound = letterSoundContributionEvent.getLetterSound();
updatePeerReviewStatus(letterSound, approvedCount, notApprovedCount);
Committable suggestion
> :bangbang: **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
`````suggestion
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);
}
LetterSound letterSound = letterSoundContributionEvent.getLetterSound();
updatePeerReviewStatus(letterSound, approvedCount, notApprovedCount);
`````
Consider extracting the peer review status update logic into a separate method for better readability and maintainability.
Committable suggestion
> :bangbang: **IMPORTANT** > Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements. `````suggestion 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); } LetterSound letterSound = letterSoundContributionEvent.getLetterSound(); updatePeerReviewStatus(letterSound, approvedCount, notApprovedCount); `````_Originally posted by @coderabbitai[bot] in https://github.com/elimu-ai/webapp/pull/1725#discussion_r1676883586_