11package clap .server .application .mapper .response ;
22
3+ import clap .server .adapter .inbound .web .dto .task .response .TeamStatusResponse ;
34import clap .server .adapter .inbound .web .dto .task .response .TeamTaskItemResponse ;
45import clap .server .adapter .inbound .web .dto .task .response .TeamTaskResponse ;
5- import clap .server .adapter .outbound .persistense .entity .task .constant .TaskStatus ;
66import clap .server .domain .model .task .Task ;
77
88import java .util .LinkedHashMap ;
@@ -25,10 +25,10 @@ private static TeamTaskResponse toTeamTaskResponse(Map.Entry<Long, List<Task>> e
2525 .map (TeamTaskResponseMapper ::toTeamTaskItemResponse )
2626 .collect (Collectors .toList ());
2727
28- int inProgressTaskCount = (int ) entry .getValue ().stream ().filter (t -> t .getTaskStatus () == TaskStatus .IN_PROGRESS ).count ();
29- int inReviewingTaskCount = (int ) entry .getValue ().stream ().filter (t -> t .getTaskStatus () == TaskStatus .IN_REVIEWING ).count ();
30-
3128 Task firstTask = entry .getValue ().get (0 );
29+ int inProgressTaskCount = firstTask .getProcessor ().getInProgressTaskCount ();
30+ int inReviewingTaskCount = firstTask .getProcessor ().getInReviewingTaskCount ();
31+
3232 return new TeamTaskResponse (
3333 entry .getKey (),
3434 firstTask .getProcessor ().getNickname (),
@@ -65,4 +65,13 @@ private static TeamTaskItemResponse.LabelInfo toLabelInfo(Task task) {
6565 task .getLabel ().getLabelColor ()
6666 ) : null ;
6767 }
68+
69+ public static TeamStatusResponse toTeamStatusResponse (List <TeamTaskResponse > members , int totalInProgressTaskCount , int totalInReviewingTaskCount ) {
70+ return new TeamStatusResponse (
71+ (members == null ) ? List .of () : members ,
72+ totalInProgressTaskCount ,
73+ totalInReviewingTaskCount ,
74+ totalInProgressTaskCount + totalInReviewingTaskCount
75+ );
76+ }
6877}
0 commit comments