From 521b4efbe6eb26ca6ec2b92c7efc16505d60bb54 Mon Sep 17 00:00:00 2001 From: Simon Dalvai Date: Tue, 23 Jan 2024 16:31:59 +0100 Subject: [PATCH] flighdata-skyalps-gtfs: really remove duplicates of calendar.txt --- .../src/main/java/com/opendatahub/dto/CalendarValues.java | 1 - .../main/java/com/opendatahub/scheduler/JobScheduler.java | 7 +++++-- .../java/com/opendatahub/service/GTFSWriteCalendar.java | 1 - 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/flighdata-skyalps-gtfs/src/main/java/com/opendatahub/dto/CalendarValues.java b/flighdata-skyalps-gtfs/src/main/java/com/opendatahub/dto/CalendarValues.java index 914d3f2a..c08e04e8 100644 --- a/flighdata-skyalps-gtfs/src/main/java/com/opendatahub/dto/CalendarValues.java +++ b/flighdata-skyalps-gtfs/src/main/java/com/opendatahub/dto/CalendarValues.java @@ -9,7 +9,6 @@ import com.opendatahub.enumClasses.service_operation; public class CalendarValues implements Serializable { - private static final long serialVersionUID = 1L; @NonNull private String service_id; // to be taken from scode @NonNull diff --git a/flighdata-skyalps-gtfs/src/main/java/com/opendatahub/scheduler/JobScheduler.java b/flighdata-skyalps-gtfs/src/main/java/com/opendatahub/scheduler/JobScheduler.java index b33186a5..0342c60b 100644 --- a/flighdata-skyalps-gtfs/src/main/java/com/opendatahub/scheduler/JobScheduler.java +++ b/flighdata-skyalps-gtfs/src/main/java/com/opendatahub/scheduler/JobScheduler.java @@ -358,12 +358,15 @@ public void calculateGtfs() // remove duplicates from calendar values // because well, who knows how the above works? - calendarValues = calendarValues.stream().distinct().collect(Collectors.toList()); + Map calendarValuesMap = new HashMap<>(); + for(CalendarValues value:calendarValues ){ + calendarValuesMap.put(value.getService_id(), value); + } GTFSWriteAgency.writeAgency(agencyValues); GTFSWriteCalendar_Dates.writeCalendar_Dates(calendarDatesValues); GTFSStop_Times.writeStop_Times(stoptimesvalues); - GTFSWriteCalendar.writeCalendar(calendarValues); + GTFSWriteCalendar.writeCalendar(new ArrayList<>(calendarValuesMap.values())); GTFSWriteStops.writeStops(stopsvalueslist); GTFSWriteRoutes.writeRoutes(routesvaluelist); GTFSWriteTrips.writeTrips(tripsvalueslist); diff --git a/flighdata-skyalps-gtfs/src/main/java/com/opendatahub/service/GTFSWriteCalendar.java b/flighdata-skyalps-gtfs/src/main/java/com/opendatahub/service/GTFSWriteCalendar.java index 576f11e2..c2a018d0 100644 --- a/flighdata-skyalps-gtfs/src/main/java/com/opendatahub/service/GTFSWriteCalendar.java +++ b/flighdata-skyalps-gtfs/src/main/java/com/opendatahub/service/GTFSWriteCalendar.java @@ -8,7 +8,6 @@ import java.io.IOException; import java.net.MalformedURLException; -import java.util.ArrayList; import java.util.List; import com.opendatahub.constantsClasses.Calendar;