@@ -71,10 +71,12 @@ public List<RouteMissionRecommendationResponse> getRecommendationsByUserActiveSe
7171 return recommendations .stream ().map (recommendation -> {
7272 RouteMission routeMission = recommendation .getMission ();
7373 ClimbingGym gym = routeMission .getGym ();
74- List <UserMissionAttempt > attempts = routeMission .getAttempts ().stream ().toList ();
74+ List <UserMissionAttempt > userAttempts = routeMission .getAttempts ().stream ()
75+ .filter (attempt -> attempt .getUser ().getId ().equals (userId ))
76+ .toList ();
7577 Sector sector = routeMission .getSector ();
7678
77- return RouteMissionRecommendationResponse .toDto (recommendation , routeMission , gym , attempts , sector , recommendation .getRecommendedOrder ());
79+ return RouteMissionRecommendationResponse .toDto (recommendation , routeMission , gym , userAttempts , sector , recommendation .getRecommendedOrder ());
7880 }).toList ();
7981 }
8082
@@ -84,6 +86,7 @@ public List<RouteMissionRecommendationResponse> getRecommendationsByUserAttempt(
8486 UserMissionAttempt attempt = userMissionAttemptRepository .findById (attemptId ).orElseThrow (AttemptNotFoundException ::new );
8587
8688 UserSession session = attempt .getSession ();
89+ Long userId = attempt .getUser ().getId ();
8790
8891 List <ChallengeRecommendation > recommendations = recommendationRepository .findBySession (session );
8992
@@ -108,11 +111,13 @@ public List<RouteMissionRecommendationResponse> getRecommendationsByUserAttempt(
108111
109112 RouteMission routeMission = recommendation .getMission ();
110113 ClimbingGym gym = routeMission .getGym ();
111- List <UserMissionAttempt > attempts = routeMission .getAttempts ().stream ().toList ();
114+ List <UserMissionAttempt > userAttempts = routeMission .getAttempts ().stream ()
115+ .filter (attemptRecord -> attemptRecord .getUser ().getId ().equals (userId ))
116+ .toList ();
112117 Sector sector = routeMission .getSector ();
113118
114119 recommendationResponseList .add (
115- RouteMissionRecommendationResponse .toDto (recommendation , routeMission , gym , attempts , sector , recommendation .getRecommendedOrder ())
120+ RouteMissionRecommendationResponse .toDto (recommendation , routeMission , gym , userAttempts , sector , recommendation .getRecommendedOrder ())
116121 );
117122
118123 startingIndex ++;
0 commit comments