From 0bc692d64a07e4d9b1af3e49250564607243f44b Mon Sep 17 00:00:00 2001 From: David Neuhauss Date: Sun, 22 Feb 2026 17:51:06 +0100 Subject: [PATCH] fix logic bug, no exception should be thrown if weather is bad --- .../backend/routing/services/AlternativeFilterService.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/SuMoC/backend/routing/services/AlternativeFilterService.java b/src/main/java/SuMoC/backend/routing/services/AlternativeFilterService.java index 13e659b..2ab9d4e 100644 --- a/src/main/java/SuMoC/backend/routing/services/AlternativeFilterService.java +++ b/src/main/java/SuMoC/backend/routing/services/AlternativeFilterService.java @@ -82,14 +82,16 @@ public class AlternativeFilterService { ArrayList filteredAlternatives = new ArrayList<>(); for (RouteDTO route : alternatives) { if (route.isPhysicalActivity()) { + if (!route.isCyclingRoute() && !route.isWalkingRoute()) { + throw new RuntimeException("Unexpected case of a physical activity route that is not pure cycling or walking"); + } var weatherConditions = forecast.getWeatherConditionsBetween(route.getStartDateTime(), route.getEndDateTime()); if (route.isCyclingRoute() && allConditionsAcceptable(weatherConditions, routingProperties.getAcceptableCyclingConditions())) { filteredAlternatives.add(route); } else if (route.isWalkingRoute() && allConditionsAcceptable(weatherConditions, routingProperties.getAcceptableWalkingConditions())) { filteredAlternatives.add(route); - } else { - throw new RuntimeException("Unexpected case of a physical activity route that is not pure cycling or walking"); } + // else: weather conditions not acceptable, route is silently dropped } else { filteredAlternatives.add(route); }