Skip to content

Commit

Permalink
refactor: 채플 수강 학점 상수 처리
Browse files Browse the repository at this point in the history
  • Loading branch information
5uhwann committed Apr 12, 2024
1 parent b687aa0 commit 1bec144
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public class ChapelResult {

public static final String CHAPEL_LECTURE_CODE = "KMA02101";
public static final int GRADUATION_COUNT = 4;
public static final double CHAPEL_CREDIT = 0.5;

private final int takenCount;
private boolean isCompleted;
Expand All @@ -31,7 +32,7 @@ public void checkCompleted() {
}

public double getTakenChapelCredit() {
return takenCount * 0.5;
return takenCount * CHAPEL_CREDIT;
}

private static int countTakenChapel(TakenLectureInventory takenLectureInventory) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.plzgraduate.myongjigraduatebe.graduation.domain.service.commonculture;

import static com.plzgraduate.myongjigraduatebe.graduation.domain.model.ChapelResult.*;
import static com.plzgraduate.myongjigraduatebe.graduation.domain.model.GraduationCategory.*;

import java.util.Arrays;
Expand Down Expand Up @@ -38,14 +39,9 @@ public DetailGraduationResult createDetailGraduationResult(User user,

private double getTakenChapelCredits(TakenLectureInventory takenLectureInventory) {
int chapelCount = (int)takenLectureInventory.getTakenLectures().stream()
.filter(takenLecture -> takenLecture.getLecture().getLectureCode().equals(ChapelResult.CHAPEL_LECTURE_CODE))
.filter(takenLecture -> takenLecture.getLecture().getLectureCode().equals(CHAPEL_LECTURE_CODE))
.count();
return chapelCount * 0.5;
return chapelCount * CHAPEL_CREDIT;

// this.detailGraduationResults.stream()
// .filter(detailGraduationResult -> detailGraduationResult.getGraduationCategory() ==COMMON_CULTURE)
// .forEach(
// detailGraduationResult -> detailGraduationResult.addCredit(this.chapelResult.getTakenChapelCredit()));
}

}

0 comments on commit 1bec144

Please sign in to comment.