diff --git a/src/main/java/goormthon/team28/startup_valley/dto/type/EPart.java b/src/main/java/goormthon/team28/startup_valley/dto/type/EPart.java index 09a7ae0..83e82ad 100644 --- a/src/main/java/goormthon/team28/startup_valley/dto/type/EPart.java +++ b/src/main/java/goormthon/team28/startup_valley/dto/type/EPart.java @@ -15,7 +15,8 @@ public enum EPart { FRONTEND("FRONTEND"), FULLSTACK("FULLSTACK"), PM("PM"), - DESIGN("DESIGN"); + DESIGN("DESIGN"), + UNSELECTED("UNSELECTED"); private final String name; public static EPart fromName(String name, SlashCommandInteractionEvent event) { diff --git a/src/main/java/goormthon/team28/startup_valley/repository/MemberRepository.java b/src/main/java/goormthon/team28/startup_valley/repository/MemberRepository.java index 45d3a32..42bd2a4 100644 --- a/src/main/java/goormthon/team28/startup_valley/repository/MemberRepository.java +++ b/src/main/java/goormthon/team28/startup_valley/repository/MemberRepository.java @@ -111,10 +111,11 @@ public interface MemberRepository extends JpaRepository { @Query( value = "SELECT m.id, " + - "COALESCE(w.len, 0) " + + "COALESCE(w.len, 0), " + + "COALESCE(w.counts, 0) " + "FROM members m " + "LEFT JOIN (" + - "SELECT w.member_id, SUM(LENGTH(w.content)) AS len " + + "SELECT w.member_id, SUM(LENGTH(w.content)) AS len, COUNT(w.content) AS counts " + "FROM works w " + "WHERE DATE(w.end_at) >= :startDate " + "GROUP BY w.member_id" + diff --git a/src/main/java/goormthon/team28/startup_valley/service/MemberService.java b/src/main/java/goormthon/team28/startup_valley/service/MemberService.java index d4dde42..1df3d6f 100644 --- a/src/main/java/goormthon/team28/startup_valley/service/MemberService.java +++ b/src/main/java/goormthon/team28/startup_valley/service/MemberService.java @@ -50,7 +50,7 @@ public MemberListDto listTeamMember(Long userId, Long teamsId) { .map(member -> MemberDto.of( member.getId(), member.getUser().getNickname(), - member.getPart(), + member.getPart() != null ? member.getPart() : EPart.UNSELECTED, member.getUser().getProfileImage() )) .toList(); diff --git a/src/main/java/goormthon/team28/startup_valley/service/WorkService.java b/src/main/java/goormthon/team28/startup_valley/service/WorkService.java index 031d3fa..8918f1e 100644 --- a/src/main/java/goormthon/team28/startup_valley/service/WorkService.java +++ b/src/main/java/goormthon/team28/startup_valley/service/WorkService.java @@ -234,8 +234,8 @@ private List getDetailedBacklog(Long teamId, LocalDateTime st Member tempMember = memberRepository.findById((Long) object[0]) .orElseThrow(() -> new CommonException(ErrorCode.INTERNAL_SERVER_ERROR)); return RankingElementDto.of( - MemberInfoDto.of(tempMember), - ((Number) object[1]).longValue() + MemberInfoDto.of(tempMember), + (long) Math.floor(((Number) object[1]).doubleValue() / ((Number) object[2]).doubleValue()) ); } ) @@ -330,8 +330,12 @@ public WorkMeasureDto measureAllWork(Long userId, Long membersId) { Member targetMember = memberRepository.findById(membersId) .orElseThrow(() -> new CommonException(ErrorCode.NOT_FOUND_MEMBER)); User targetUser = targetMember.getUser(); + + boolean isCurrentUserAndTargetUserSame = targetUser.getId().equals(userId); List memberList = memberRepository.findAllByUser(targetUser).stream() - .filter(Member::getIsPublic) + .filter(member -> + isCurrentUserAndTargetUserSame || member.getIsPublic() + ) .toList(); List workDateDtoList = new ArrayList<>();