Skip to content

Commit

Permalink
add vehicle_id to /reports/scheduleAdh report
Browse files Browse the repository at this point in the history
  • Loading branch information
TsimurSh committed May 16, 2024
1 parent 3b6d304 commit 3c1da43
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ ResponseEntity<String> 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)")
Expand Down
20 changes: 11 additions & 9 deletions app/src/main/java/org/transitclock/core/reports/Reports.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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"
Expand Down

0 comments on commit 3c1da43

Please sign in to comment.