Skip to content

Commit

Permalink
Clean some things in data_checker
Browse files Browse the repository at this point in the history
  • Loading branch information
vdegove committed Dec 17, 2024
1 parent 8c8d2de commit 38e932a
Showing 1 changed file with 3 additions and 16 deletions.
19 changes: 3 additions & 16 deletions apps/transport/lib/transport/data_checker.ex
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,9 @@ defmodule Transport.DataChecker do
end)
end

@spec send_outdated_data_producer_notifications(delay_and_records(), integer()) :: delay_and_records()
def send_outdated_data_producer_notifications({delay, records} = payload, job_id) do
# A different email is sent to producers for every delay, containing in a single email all datasets expiring on this given delay
@spec send_outdated_data_producer_notifications(delay_and_records(), integer()) :: :ok
def send_outdated_data_producer_notifications({delay, records}, job_id) do
Enum.each(records, fn {%DB.Dataset{} = dataset, resources} ->
@expiration_reason
|> DB.NotificationSubscription.subscriptions_for_reason_dataset_and_role(dataset, :producer)
Expand All @@ -171,20 +172,6 @@ defmodule Transport.DataChecker do
DB.Notification.insert!(dataset, subscription, %{delay: delay, job_id: job_id})
end)
end)

payload
end

@doc """
iex> resource_titles([%DB.Resource{title: "B"}])
"B"
iex> resource_titles([%DB.Resource{title: "B"}, %DB.Resource{title: "A"}])
"A, B"
"""
def resource_titles(resources) do
resources
|> Enum.sort_by(fn %DB.Resource{title: title} -> title end)
|> Enum.map_join(", ", fn %DB.Resource{title: title} -> title end)
end

@spec send_outdated_data_admin_mail([delay_and_records()]) :: [delay_and_records()]
Expand Down

0 comments on commit 38e932a

Please sign in to comment.