Skip to content

Commit

Permalink
perf(#123): 원서 PDF 저장 시 진로 선택 과목 위치 변경
Browse files Browse the repository at this point in the history
- 선생님들의 요청에 따라 진로 선택 과목인 음악, 미술, 체육 과목은 성적 일람표의 맨 밑에 위치하도록 수정했어요.
  • Loading branch information
cabbage16 committed Sep 7, 2024
1 parent be07047 commit b4cf53c
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import com.bamdoliro.maru.domain.form.domain.type.AchievementLevel;
import com.bamdoliro.maru.domain.form.domain.value.Subject;
import com.bamdoliro.maru.domain.form.domain.value.SubjectMap;
import com.bamdoliro.maru.domain.form.exception.FormAlreadySubmittedException;
import com.bamdoliro.maru.domain.form.service.FormFacade;
import com.bamdoliro.maru.domain.user.domain.User;
import com.bamdoliro.maru.infrastructure.pdf.GeneratePdfService;
Expand Down Expand Up @@ -69,15 +68,25 @@ public ByteArrayResource execute(User user) {

private List<SubjectVO> getSubjectList(Form form) {
List<SubjectVO> value = new ArrayList<>();
List<String> careerElectiveCourses = List.of("음악", "미술", "체육");
Map<String, List<Subject>> subjectMap = form.getGrade()
.getSubjectListValue()
.stream()
.filter(subject -> !careerElectiveCourses.contains(subject.getSubjectName()))
.collect(Collectors.groupingBy(
Subject::getSubjectName,
LinkedHashMap::new,
Collectors.toList()
));

careerElectiveCourses.forEach(course -> {
List<Subject> subjects = form.getGrade().getSubjectListValue()
.stream()
.filter(subject -> course.equals(subject.getSubjectName()))
.collect(Collectors.toList());
if (!subjects.isEmpty()) {
subjectMap.put(course, subjects);
}
});

subjectMap.forEach((key, values) -> {
SubjectVO subject = new SubjectVO(key);
Expand Down

0 comments on commit b4cf53c

Please sign in to comment.