elimu-ai / webapp

🖥 Web application for hosting Android applications and educational content
https://hin.elimu.ai
MIT License
31 stars 57 forks source link

Ensure consistent peer review status update #1770

Closed jo-elimu closed 3 months ago

jo-elimu commented 3 months ago
          **Ensure consistent peer review status update.**

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); `````

_Originally posted by @coderabbitai[bot] in https://github.com/elimu-ai/webapp/pull/1725#discussion_r1676883586_

SnehaHS65 commented 3 months ago

Hi , I will work on this

SnehaHS65 commented 3 months ago

https://github.com/elimu-ai/webapp/pull/1780