Skip to content

Commit

Permalink
fix(#132): 검정고시 원서 3학년 1학기 성적 산출 시 오류 수정
Browse files Browse the repository at this point in the history
- 검정고시는 특정 학기의 성적을 구할 수 없으므로 null로 하여서 오류를 방지했어요.
- 입학요강에 따라 검정고시 원서의 경우 동점자 처리 중 3학년 1학기 성적에서 일반 원서보다 우선순위가 낮아요. 따라서 FormRepositoryImpl에서 order by절에 3학년 1학기 성적에 nullsLast 옵션을 추가하여 명시적으로 수정했어요.
  • Loading branch information
cabbage16 committed Sep 26, 2024
1 parent e474597 commit 6cfe868
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class Score {
@Column(nullable = false)
private Double subjectGradeScore;

@Column(nullable = false)
@Column(nullable = true)
private Double thirdGradeFirstSemesterSubjectGradeScore;

@Column(nullable = false)
Expand Down Expand Up @@ -53,6 +53,14 @@ public Score(Double subjectGradeScore, Double thirdGradeFirstSemesterSubjectGrad
this.firstRoundScore = MathUtil.roundTo(subjectGradeScore + attendanceScore + volunteerScore + bonusScore, 3);
}

public Score(Double subjectGradeScore, Integer attendanceScore, Integer volunteerScore, Integer bonusScore) {
this.subjectGradeScore = subjectGradeScore;
this.attendanceScore = attendanceScore;
this.volunteerScore = volunteerScore;
this.bonusScore = bonusScore;
this.firstRoundScore = MathUtil.roundTo(subjectGradeScore + attendanceScore + volunteerScore + bonusScore, 3);
}

public void updateSubjectScore(Double subjectGradeScore) {
this.subjectGradeScore = subjectGradeScore;
this.firstRoundScore = subjectGradeScore + attendanceScore + volunteerScore + bonusScore;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,27 @@ public class CalculateFormScoreService {

public void execute(Form form) {
Double subjectGradeScore = calculateSubjectGradeScore(form);
Double thirdGradeFirstSemesterSubjectGradeScore = form.getGrade().getSubjectList().getSubjectMap().getScoreOf(3, 1);
Integer attendanceScore = calculateAttendanceScore(form);
Integer volunteerScore = calculateVolunteerScore(form);
Integer bonusScore = calculateBonusScore(form);

form.updateScore(new Score(
subjectGradeScore,
thirdGradeFirstSemesterSubjectGradeScore,
attendanceScore,
volunteerScore,
bonusScore
));
if (form.getEducation().isQualificationExamination()) {
form.updateScore(new Score(
subjectGradeScore,
attendanceScore,
volunteerScore,
bonusScore
));
} else {
Double thirdGradeFirstSemesterSubjectGradeScore = form.getGrade().getSubjectList().getSubjectMap().getScoreOf(3, 1);
form.updateScore(new Score(
subjectGradeScore,
thirdGradeFirstSemesterSubjectGradeScore,
attendanceScore,
volunteerScore,
bonusScore
));
}
}

public Double calculateSubjectGradeScore(Form form) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public List<Form> findFirstPassedSpecialForm() {
form.score.subjectGradeScore.desc(),
form.score.depthInterviewScore.desc(),
form.score.ncsScore.desc(),
form.score.thirdGradeFirstSemesterSubjectGradeScore.desc(),
form.score.thirdGradeFirstSemesterSubjectGradeScore.desc().nullsLast(),
form.score.attendanceScore.desc(),
form.score.volunteerScore.desc()
)
Expand All @@ -156,7 +156,7 @@ public List<Form> findFirstPassedRegularForm() {
form.score.subjectGradeScore.desc(),
form.score.depthInterviewScore.desc(),
form.score.ncsScore.desc(),
form.score.thirdGradeFirstSemesterSubjectGradeScore.desc(),
form.score.thirdGradeFirstSemesterSubjectGradeScore.desc().nullsLast(),
form.score.attendanceScore.desc(),
form.score.volunteerScore.desc()
)
Expand All @@ -178,7 +178,7 @@ public List<Form> findFirstPassedSupernumeraryForm() {
form.score.subjectGradeScore.desc(),
form.score.depthInterviewScore.desc(),
form.score.ncsScore.desc(),
form.score.thirdGradeFirstSemesterSubjectGradeScore.desc(),
form.score.thirdGradeFirstSemesterSubjectGradeScore.desc().nullsLast(),
form.score.attendanceScore.desc(),
form.score.volunteerScore.desc()
)
Expand Down

0 comments on commit 6cfe868

Please sign in to comment.