Skip to content

Commit

Permalink
fix: 심사논문 관련 추가 수정 (#129)
Browse files Browse the repository at this point in the history
* fix: 논문 제출이 안된 학생의 심사를 진행할 수 없도록 수정

* fix: 심사위원장이 전원 심사완료가 아닐시 심사할수 없도록 수정

* 추가수정

* fix: filter 조건 수정

* fix: 누락된 query 조건 추가

* fix(be): query typo 수정
  • Loading branch information
jcy0308 authored May 9, 2024
1 parent ced92dc commit d4b05b5
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/modules/reviews/reviews.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,7 @@ export class ReviewsService {
reviewer: true,
thesisInfo: {
include: {
thesisFiles: true,
process: {
include: {
student: {
Expand All @@ -692,6 +693,12 @@ export class ReviewsService {
},
},
});
const submitted = foundReview.thesisInfo.thesisFiles.filter((file) => {
return file.fileId == null;
});
if (submitted.length != 0) {
throw new BadRequestException("미제출파일이 있는 학생은 심사할 수 없습니다.");
}
if (!foundReview) throw new NotFoundException("존재하지 않는 심사정보입니다");
if (userType == UserType.PROFESSOR && foundReview.reviewerId != userId) {
throw new BadRequestException("본인의 논문 심사가 아닙니다.");
Expand Down Expand Up @@ -1070,6 +1077,19 @@ export class ReviewsService {
},
},
});
const otherReviews = await this.prismaService.review.findMany({
where: {
thesisInfoId: foundReview.thesisInfoId,
isFinal: false,
},
});
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("심사가 완료되지 않았습니다.");
if (!foundReview) throw new NotFoundException("존재하지 않는 심사정보입니다");
if (userType == UserType.PROFESSOR) {
if (foundReview.reviewerId != userId) throw new BadRequestException("본인의 논문 심사가 아닙니다.");
Expand Down

0 comments on commit d4b05b5

Please sign in to comment.