From c71a6310b70bc7be962f035576ffde3d24d17a18 Mon Sep 17 00:00:00 2001 From: Walton Hoops Date: Fri, 26 Apr 2024 11:39:54 -0600 Subject: [PATCH] fix: allow querying services that ended before the current date --- apps/state/lib/state/service.ex | 8 ++++---- apps/state/lib/state/service_by_date.ex | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/state/lib/state/service.ex b/apps/state/lib/state/service.ex index c5ff93a2..45440701 100644 --- a/apps/state/lib/state/service.ex +++ b/apps/state/lib/state/service.ex @@ -34,11 +34,11 @@ defmodule State.Service do end @doc """ - Returns all Services that are valid today or any date in the future. + Returns all Services that are valid at the feed start or any day in the future. """ - def valid_in_future do - now = Parse.Time.service_date() - Enum.filter(all(), &Service.valid_after?(&1, now)) + def valid_in_feed do + {_, feed_start, _} = State.Feed.feed_metadata() + Enum.filter(all(), &Service.valid_after?(&1, feed_start)) end @doc """ diff --git a/apps/state/lib/state/service_by_date.ex b/apps/state/lib/state/service_by_date.ex index dded79c4..1974e5a2 100644 --- a/apps/state/lib/state/service_by_date.ex +++ b/apps/state/lib/state/service_by_date.ex @@ -63,7 +63,7 @@ defmodule State.ServiceByDate do def update_state(state) do items = - State.Service.valid_in_future() + State.Service.valid_in_feed() |> service_with_date @table |> :ets.delete_all_objects()