Skip to content

Commit

Permalink
fix: allow querying services that ended before the current date
Browse files Browse the repository at this point in the history
  • Loading branch information
Whoops committed Apr 26, 2024
1 parent bf8950e commit c71a631
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions apps/state/lib/state/service.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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 """
Expand Down
2 changes: 1 addition & 1 deletion apps/state/lib/state/service_by_date.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit c71a631

Please sign in to comment.