Skip to content

Commit

Permalink
Merge pull request #154 from HSLdevcom/AB#32085_departures_function
Browse files Browse the repository at this point in the history
AB#32085: Refactor departure query to include both directions
  • Loading branch information
e-halinen authored Apr 8, 2024
2 parents ec5c8d7 + 8b3a6de commit 711431f
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/setup/createFunctions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1104,7 +1104,7 @@ $$
END
$$;

create or replace function jore.get_route_departures_for_timed_stops(route_identifier text, route_direction text, date date) returns setof jore.route_timed_stop_departure as
create or replace function jore.get_route_departures_for_timed_stops(route_identifier text, date date) returns setof jore.route_timed_stop_departure as
$$
SELECT departure.stop_id,
departure.route_id,
Expand All @@ -1119,7 +1119,6 @@ SELECT departure.stop_id,
JOIN jore.route_segment segment
ON segment.stop_id = departure.stop_id AND segment.route_id = departure.route_id AND segment.direction = departure.direction AND date between segment.date_begin and segment.date_end
WHERE departure.route_id = route_identifier
AND departure.direction = route_direction
AND date between departure.date_begin and departure.date_end
AND ((segment.timing_stop_type = 1) OR (segment.timing_stop_type = 2) OR (segment.stop_index = 1))
GROUP BY departure.stop_id, departure.departure_id, departure.day_type,
Expand Down

0 comments on commit 711431f

Please sign in to comment.