Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: allow querying services that ended before the current date #795

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading