Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public class RecentlyViewedTestDto {
private String category;
private String title;
private String oneLineIntro;
private String thumbnailUrl;
private List<String> tags;
private LocalDateTime viewedAt;
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public DashboardDto getDashboardData(Long userId) {
.category(post.getMainCategory().stream().map(Enum::toString).collect(Collectors.joining(", ")))
.title(post.getTitle())
.oneLineIntro(post.getServiceSummary())
.thumbnailUrl(post.getThumbnailUrl())
.tags(post.getGenreCategories().stream().map(Enum::toString).collect(Collectors.toList()))
.viewedAt(recentView.getViewedAt())
.build();
Expand Down Expand Up @@ -100,7 +101,7 @@ public TotalParticipationDto getTotalParticipationData(Long userId) {

List<Participation> participated = participationRepository.findByUserIdAndStatusWithPost(userId, ParticipationStatus.APPROVED, Pageable.unpaged()).getContent();

List<Post> participatedPosts = participated.stream().map(Participation::getPost).collect(Collectors.toList());
List<Post> participatedPosts = participated.stream().map(Participation::getPost).toList();
int totalCount = participatedPosts.size();

Map<String, Integer> countByCategory = participatedPosts.stream()
Expand Down Expand Up @@ -133,10 +134,10 @@ public ProfileDto getProfileData(Long userId) {
.build();
}

Long testsUploaded = postRepository.countByCreatedBy(userId);
Long testsParticipating = participationRepository.countByUserIdAndStatus(userId, ParticipationStatus.APPROVED);
long testsUploaded = postRepository.countByCreatedBy(userId);
long testsParticipating = participationRepository.countByUserIdAndStatus(userId, ParticipationStatus.APPROVED);

int testsOngoing = testsParticipating.intValue();
int testsOngoing = (int) testsParticipating;

String affiliation = postRepository.findFirstByCreatedByAndStatusOrderByCreatedAtDesc(userId, PostStatus.ACTIVE)
.map(Post::getCreatorIntroduction)
Expand All @@ -146,8 +147,8 @@ public ProfileDto getProfileData(Long userId) {
.profileImageUrl(user.getProfileUrl())
.name(user.getNickname())
.affiliation(affiliation)
.testsUploaded(testsUploaded.intValue())
.testsParticipating(testsParticipating.intValue())
.testsUploaded((int) testsUploaded)
.testsParticipating((int) testsParticipating)
.testsOngoing(testsOngoing)
.build();
}
Expand Down