bugfix, stupid back and forth conversion of instant and localtime caused wrong resulting time

This commit is contained in:
2026-02-22 18:21:49 +01:00
parent dad0077279
commit cf7d847993
2 changed files with 11 additions and 14 deletions
@@ -22,7 +22,10 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import java.time.*;
import java.time.DayOfWeek;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -131,10 +134,7 @@ public class RegularTripSuggestionService {
LatLng origin = h3Service.cellToLatLng(trip.getStartH3Center());
LatLng destination = h3Service.cellToLatLng(trip.getEndH3Center());
// we plan the trip to arrive at the average arrival time of the regular trip
Instant arrivalTime = LocalDateTime.now()
.with(trip.getAverageArrivalTime())
.atZone(ZoneId.systemDefault())
.toInstant();
Instant arrivalTime = trip.getAverageArrivalTime();
Instant departureTime = arrivalTime.minusSeconds(trip.getAverageDurationMinutes() * 60L);
return RoutingAlternativeRequestDTO.builder()