Skip to content

Commit d6783bc

Browse files
authored
Merge pull request #21 from enjoy-hack/jiwoo
feat: ---
2 parents 4833262 + 9d81bc4 commit d6783bc

4 files changed

Lines changed: 13 additions & 5 deletions

File tree

src/main/java/com/example/enjoy/dto/TrackProgressDto.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,6 @@ public class TrackProgressDto {
2121

2222
private List<CourseDto> completedCourses; // 이수한 과목 목록
2323
private List<CourseDto> remainingCourses; // 이수해야 할 남은 과목 목록
24+
25+
private boolean hasUploadedHistory; // 트랙 업로드 여부
2426
}

src/main/java/com/example/enjoy/repository/StudentCourseRepository.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,5 @@ public interface StudentCourseRepository extends JpaRepository<StudentCourse, Lo
2424

2525
List<StudentCourse> findAllByStudentIdAndManualIsTrue(String studentId);
2626

27+
boolean existsByStudentId(String studentId);
2728
}

src/main/java/com/example/enjoy/service/StudentDataService.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,8 @@ private StudentCourseStatus mapGradeToStatus(String grade) {
7979
default -> throw new IllegalArgumentException("잘못된 등급값: " + grade);
8080
};
8181
}
82+
83+
public boolean hasUploadedHistory(String studentId) {
84+
return studentCourseRepository.existsByStudentId(studentId);
85+
}
8286
}

src/main/java/com/example/enjoy/service/TrackService.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@
2828
public class TrackService {
2929

3030
private final TrackRepository trackRepository;
31-
private final StudentCourseRepository studentCourseRepository; // 기존 기능
32-
private final FavoriteCourseRepository favoriteCourseRepository;
33-
private final UserRepository userRepository;
31+
private final StudentCourseRepository studentCourseRepository;
32+
3433

3534
//진척률 계산
3635
public List<TrackProgressDto> calculateTrackProgress(String studentId) {
37-
Set<String> completedCourseNames = getCompletedCourseNames(studentId); // 이수 과목명 목록
3836

37+
boolean hasUploaded = studentCourseRepository.existsByStudentId(studentId);
38+
Set<String> completedCourseNames = getCompletedCourseNames(studentId); // 이수 과목명 목록
3939
List<Track> allTracks = trackRepository.findAll();
4040

4141
return allTracks.stream().map(track -> {
@@ -59,7 +59,8 @@ public List<TrackProgressDto> calculateTrackProgress(String studentId) {
5959
courses.size(),
6060
completed.size() == courses.size(),
6161
completed,
62-
remaining
62+
remaining,
63+
hasUploaded
6364
);
6465
}).toList();
6566
}

0 commit comments

Comments
 (0)