Skip to content

Commit

Permalink
feat(ScheduleController): unordered tasks & unsorted schedule list
Browse files Browse the repository at this point in the history
  • Loading branch information
KaylaBrady committed Nov 8, 2024
1 parent 83e238b commit 25330fd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/mobile_app_backend_web/controllers/schedule_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ defmodule MobileAppBackendWeb.ScheduleController do
filters
|> Task.async_stream(fn filter_params ->
{filter_params, fetch_schedules(filter_params)}
end)
end, ordered: false)
|> Enum.reduce_while(%{schedules: [], trips: %{}}, fn result, acc ->
case result do
{:ok, {_params, %{schedules: schedules, trips: trips}}} ->
Expand All @@ -94,7 +94,7 @@ defmodule MobileAppBackendWeb.ScheduleController do
%{schedules: [MBTAV3API.Schedule.t()], trips: JsonApi.Object.trip_map()}
| :error
defp fetch_schedules(filter) do
case Repository.schedules(filter: filter, include: :trip, sort: {:departure_time, :asc}) do
case Repository.schedules(filter: filter, include: :trip) do
{:ok, %{data: schedules, included: %{trips: trips}}} ->
%{schedules: schedules, trips: trips}

Expand Down

0 comments on commit 25330fd

Please sign in to comment.