diff --git a/app/src/main/java/org/transitclock/api/resources/ReportsApi.java b/app/src/main/java/org/transitclock/api/resources/ReportsApi.java index cc5c4d44d..4612fd7d0 100644 --- a/app/src/main/java/org/transitclock/api/resources/ReportsApi.java +++ b/app/src/main/java/org/transitclock/api/resources/ReportsApi.java @@ -105,7 +105,7 @@ ResponseEntity scheduleAdhReport( StandardParameters stdParameters, @Parameter(description = "Route id") @RequestParam(value = "r") String routeId, @Parameter(description = "Begin date(MM-DD-YYYY.") @RequestParam(value = "beginDate") String beginDate, - @Parameter(description = "Num days.", required = false) @RequestParam(value = "numDays", required = false) int numDays, + @Parameter(description = "Num days.") @RequestParam(value = "numDays", defaultValue = "1", required = false) int numDays, @Parameter(description = "Begin time(HH:MM)") @RequestParam(value = "beginTime") String beginTime, @Parameter(description = "End time(HH:MM)") @RequestParam(value = "endTime") String endTime, @Parameter(description = "Allowable early in mins(default 1.0)") diff --git a/app/src/main/java/org/transitclock/core/reports/Reports.java b/app/src/main/java/org/transitclock/core/reports/Reports.java index c9673ffc3..17c312375 100644 --- a/app/src/main/java/org/transitclock/core/reports/Reports.java +++ b/app/src/main/java/org/transitclock/core/reports/Reports.java @@ -251,7 +251,8 @@ public static String getScheduleAdhByStops( // + " abs(((ad.time / 1000) - (ad.scheduled_time / 1000))) AS // difference_in_seconds, \n" + " s.id AS stop_id, \n" - + " ad.stop_order AS stop_order \n" + + " ad.stop_order AS stop_order, \n" + + " ad.vehicle_id AS v_id \n" + " FROM arrivals_departures ad, stops s \n" + "WHERE " // To get stop name @@ -276,7 +277,8 @@ public static String getScheduleAdhByStops( // + " ((ad.time / 1000) - (ad.scheduled_time / 1000)) AS // difference_in_seconds, \n" + " s.id AS stop_id, \n" - + " ad.stop_order AS stop_order \n" + + " ad.stop_order AS stop_order, \n" + + " ad.vehicle_id AS v_id \n" + " FROM arrivals_departures ad, Stops s \n" + "WHERE " // To get stop name @@ -294,18 +296,18 @@ public static String getScheduleAdhByStops( + " \n" + " ORDER BY direction_id, ad.stop_order, s.name \n" + "), \n" - + "trips_late_query_v2 AS ( SELECT" - + " array_to_string(array_agg(trips_late::text || ' (' ||" - + " difference_in_seconds::text || ')' order by trips_late::text), '; ') AS" - + " trips_late, \n" + + "trips_late_query_v2 AS ( SELECT \n" + + " array_to_string(array_agg('trip: ' || trips_late::text || ' (' ||" + + " difference_in_seconds::text || '), vehicle: ' || v_id::text order by trips_late::text), '; ')" + + " AS trips_late, \n" + " stop_id, \n" + " stop_order \n" + " FROM trips_late_query_with_time \n" + " GROUP BY stop_id, stop_order \n" + " ), \n" - + " trips_early_query_v2 AS ( \n" - + " SELECT array_to_string(array_agg(trips_early::text || ' (' ||" - + " difference_in_seconds::text || ')' order by trips_early::text), '; ')" + + " trips_early_query_v2 AS ( SELECT \n" + + " array_to_string(array_agg('trip: ' || trips_early::text || ' (' ||" + + " difference_in_seconds::text || '), vehicle: ' || v_id::text order by trips_early::text), '; ')" + " AS trips_early, \n" + " stop_id, \n" + " stop_order \n"