diff --git a/src/main/java/com/bamdoliro/maru/domain/form/domain/value/Score.java b/src/main/java/com/bamdoliro/maru/domain/form/domain/value/Score.java index 67508820..3ce6f087 100644 --- a/src/main/java/com/bamdoliro/maru/domain/form/domain/value/Score.java +++ b/src/main/java/com/bamdoliro/maru/domain/form/domain/value/Score.java @@ -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) @@ -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; diff --git a/src/main/java/com/bamdoliro/maru/domain/form/service/CalculateFormScoreService.java b/src/main/java/com/bamdoliro/maru/domain/form/service/CalculateFormScoreService.java index 339dab3d..7fd6b7f6 100644 --- a/src/main/java/com/bamdoliro/maru/domain/form/service/CalculateFormScoreService.java +++ b/src/main/java/com/bamdoliro/maru/domain/form/service/CalculateFormScoreService.java @@ -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) { diff --git a/src/main/java/com/bamdoliro/maru/infrastructure/persistence/form/FormRepositoryImpl.java b/src/main/java/com/bamdoliro/maru/infrastructure/persistence/form/FormRepositoryImpl.java index dd202285..f53faf73 100644 --- a/src/main/java/com/bamdoliro/maru/infrastructure/persistence/form/FormRepositoryImpl.java +++ b/src/main/java/com/bamdoliro/maru/infrastructure/persistence/form/FormRepositoryImpl.java @@ -134,7 +134,7 @@ public List