|
|
@@ -50,7 +50,7 @@ defmodule VaccinsWeb.IndexLive do
|
|
|
end
|
|
|
|
|
|
def handle_event("trigger_all", _, socket) do
|
|
|
- {:noreply, socket |> trigger_global_refresh}
|
|
|
+ {:noreply, socket}
|
|
|
end
|
|
|
|
|
|
def handle_event("toggle_form", _, socket = %{assigns: %{display_cs: display}}),
|
|
|
@@ -65,20 +65,6 @@ defmodule VaccinsWeb.IndexLive do
|
|
|
do: {:noreply, socket |> push_patch(to: Routes.index_path(socket, :index, noob: true))}
|
|
|
|
|
|
@impl true
|
|
|
- def handle_info({:query_sent, id, ref}, socket = %{assigns: %{pending: pending}}) do
|
|
|
- {:noreply, socket}
|
|
|
- end
|
|
|
-
|
|
|
- def handle_info(:periodic_refresh, socket = %{assigns: %{display_cs: false}}),
|
|
|
- do:
|
|
|
- {:noreply,
|
|
|
- socket
|
|
|
- |> trigger_global_refresh
|
|
|
- |> trigger_periodic_refresh}
|
|
|
-
|
|
|
- def handle_info(:periodic_refresh, socket = %{assigns: %{display_cs: true}}),
|
|
|
- do: {:noreply, socket |> trigger_periodic_refresh}
|
|
|
-
|
|
|
def handle_info({:location_has_slots, id, true}, socket) do
|
|
|
{:noreply,
|
|
|
socket |> update(:locations_with_early_slots, &(&1 |> MapSet.put(id))) |> set_title}
|
|
|
@@ -100,35 +86,11 @@ defmodule VaccinsWeb.IndexLive do
|
|
|
do: socket |> push_patch(to: Routes.index_path(socket, :index))
|
|
|
|
|
|
@impl true
|
|
|
- def handle_info(
|
|
|
- {:query_result, ref, res},
|
|
|
- socket = %{assigns: %{locations: valid, pending: pending}}
|
|
|
- ) do
|
|
|
- {:noreply, socket}
|
|
|
- end
|
|
|
-
|
|
|
- def handle_info({:location_availabilities, id, res}, socket = %{assigns: %{locations: valid}}) do
|
|
|
- send_update(VaccinsWeb.LocationComponent, id: id, availabilities: res)
|
|
|
- {:noreply, socket}
|
|
|
- end
|
|
|
-
|
|
|
def handle_info({:new_availabilities, id, res}, socket = %{assigns: %{locations: valid}}) do
|
|
|
send_update(VaccinsWeb.LocationComponent, id: id, availabilities: res)
|
|
|
{:noreply, socket}
|
|
|
end
|
|
|
|
|
|
- defp trigger_global_refresh(socket = %{assigns: %{locations: locations}}) do
|
|
|
- locations
|
|
|
- |> Enum.each(&send_update(VaccinsWeb.LocationComponent, id: &1.id, force_refresh: true))
|
|
|
-
|
|
|
- socket
|
|
|
- end
|
|
|
-
|
|
|
- defp trigger_periodic_refresh(socket) do
|
|
|
- Process.send_after(self(), :periodic_refresh, @refresh_period_ms)
|
|
|
- socket
|
|
|
- end
|
|
|
-
|
|
|
defp locations_by_availability(
|
|
|
assigns = %{
|
|
|
locations: locations,
|