Browse Source

Rename "locations" assign into "all_locations"

theenglishway (time) 4 years ago
parent
commit
f487702843
1 changed files with 7 additions and 7 deletions
  1. 7 7
      lib/vaccins_web/live/index.ex

+ 7 - 7
lib/vaccins_web/live/index.ex

@@ -4,7 +4,7 @@ defmodule VaccinsWeb.IndexLive do
 
   @impl true
   def mount(_params, %{"is_local?" => is_local?}, socket) do
-    locations = LocationStore.get_locations()
+    all_locations = LocationStore.get_locations()
     Phoenix.PubSub.subscribe(Vaccins.PubSub, "locations")
 
     {:ok,
@@ -12,7 +12,7 @@ defmodule VaccinsWeb.IndexLive do
      |> assign(
        noob_mode: false,
        is_local?: is_local?,
-       locations: locations,
+       all_locations: all_locations,
        locations_with_early_slots: MapSet.new(),
        locations_with_slots: MapSet.new(),
        pending: %{},
@@ -71,7 +71,7 @@ defmodule VaccinsWeb.IndexLive do
 
   def handle_event("reload_file", _, socket) do
     :ok = LocationStore.reload()
-    {:noreply, socket |> assign(locations: LocationStore.get_locations())}
+    {:noreply, socket |> assign(all_locations: LocationStore.get_locations())}
   end
 
   def handle_event("toggle_form", _, socket = %{assigns: %{display_cs: display}}),
@@ -118,11 +118,11 @@ defmodule VaccinsWeb.IndexLive do
       |> Enum.filter(&(&1.geographic_area in filters))
 
   defp locations_by_availability(%{
-         locations: locations,
+         all_locations: all_locations,
          locations_with_slots: with_slots,
          locations_with_early_slots: with_early_slots
        }) do
-    locations
+    all_locations
     |> Enum.sort(fn e1, e2 ->
       e1_has_early_spot? = e1.id in with_early_slots
       e1_has_spot? = e1.id in with_slots
@@ -142,6 +142,6 @@ defmodule VaccinsWeb.IndexLive do
 
   defp init_area_filters(socket), do: socket |> assign(area_filters: socket.assigns.all_areas)
 
-  defp get_all_areas(%{assigns: %{locations: locations}}),
-    do: locations |> Enum.map(& &1.geographic_area) |> MapSet.new()
+  defp get_all_areas(%{assigns: %{all_locations: all_locations}}),
+    do: all_locations |> Enum.map(& &1.geographic_area) |> MapSet.new()
 end