From 20d63802269bd69eb0a9555f5163ab953205c1c1 Mon Sep 17 00:00:00 2001 From: "Begerad, Stefan" Date: Wed, 31 Jan 2024 15:19:05 +0100 Subject: [PATCH] fix: adjust schema for route trip-updates-odd-routes and trip-updates-odd-trips --- src/service/trip-updates-odd-routes.js | 4 +++- src/service/trip-updates-odd-trips.js | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/service/trip-updates-odd-routes.js b/src/service/trip-updates-odd-routes.js index c1593e4..601bad7 100644 --- a/src/service/trip-updates-odd-routes.js +++ b/src/service/trip-updates-odd-routes.js @@ -16,7 +16,9 @@ async function get(day = '2024-01-30') { const query = `SELECT pdts.trip_route_id, max(pdts.timestamp_pgsql) AS timestamp_pgsql FROM ` + schema - + `.trip_updates AS pdts LEFT JOIN mblthk.vw_join_gncy_rts_trps_srvcs AS trps ON pdts.trip_route_id = trps.route_id WHERE trps.route_id IS NULL AND timestamp_pgsql >= '${day}' AND timestamp_pgsql < '` + + `.trip_updates AS pdts LEFT JOIN ` + + schema + + `.vw_join_gncy_rts_trps_srvcs AS trps ON pdts.trip_route_id = trps.route_id WHERE trps.route_id IS NULL AND timestamp_pgsql >= '${day}' AND timestamp_pgsql < '` + tomorrow.toISOString().substring(0, 10) + `' GROUP BY pdts.trip_route_id ORDER BY pdts.trip_route_id ASC;`; diff --git a/src/service/trip-updates-odd-trips.js b/src/service/trip-updates-odd-trips.js index cd032e2..830cac5 100644 --- a/src/service/trip-updates-odd-trips.js +++ b/src/service/trip-updates-odd-trips.js @@ -16,7 +16,9 @@ async function get(day = '2024-01-31') { const query = `SELECT pdts.trip_trip_id, pdts.trip_route_id, pdts.timestamp_pgsql FROM ` + schema - + `.trip_updates AS pdts LEFT JOIN mblthk.vw_join_gncy_rts_trps_srvcs AS trps ON pdts.trip_trip_id = trps.trip_id WHERE trps.trip_id IS NULL AND timestamp_pgsql >= '${day}' AND timestamp_pgsql < '` + + `.trip_updates AS pdts LEFT JOIN ` + + schema + + `.vw_join_gncy_rts_trps_srvcs AS trps ON pdts.trip_trip_id = trps.trip_id WHERE trps.trip_id IS NULL AND timestamp_pgsql >= '${day}' AND timestamp_pgsql < '` + tomorrow.toISOString().substring(0, 10) + `' ORDER BY pdts.trip_trip_id ASC;`