Skip to content

Commit

Permalink
[FIX] 최종심사 가능 조건 변경 (#159)
Browse files Browse the repository at this point in the history
* fix: 최종심사 가능 조건 변경

* fix: 과반수로 변경
  • Loading branch information
hynseok authored Nov 29, 2024
1 parent e8ae31c commit 7b570b3
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions src/modules/reviews/reviews.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1134,13 +1134,25 @@ export class ReviewsService {
isFinal: false,
},
});
const notSubmitted = otherReviews.filter((review) => {
if (review.contentStatus == Status.FAIL || review.contentStatus == Status.PASS) {
return false;

// 합격인 심사의 개수를 카운트
const passCount = otherReviews.filter((review) => review.contentStatus === Status.PASS).length;
const threshold = Math.ceil(otherReviews.length / 2);

// 합격인 심사의 개수가 과반수 미만이면 심사가 모두 완료되어야 함
if (passCount < threshold) {
const notSubmitted = otherReviews.filter((review) => {
if (review.contentStatus == Status.FAIL || review.contentStatus == Status.PASS) {
return false;
}
return true;
});

if (notSubmitted.length > 0) {
throw new BadRequestException("심사가 완료되지 않았습니다.");
}
return true;
});
if (notSubmitted.length != 0) throw new BadRequestException("심사가 완료되지 않았습니다.");
}

if (!foundReview) throw new NotFoundException("존재하지 않는 심사정보입니다");
if (userType == UserType.PROFESSOR) {
if (foundReview.reviewerId != userId) throw new BadRequestException("본인의 논문 심사가 아닙니다.");
Expand Down

0 comments on commit 7b570b3

Please sign in to comment.