Skip to content

Commit

Permalink
wip! remove state_value vfield
Browse files Browse the repository at this point in the history
  • Loading branch information
firestack committed Feb 18, 2025
1 parent fc505f9 commit 4cc8760
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 13 deletions.
9 changes: 0 additions & 9 deletions lib/skate/detours/db/detour.ex
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ defmodule Skate.Detours.Db.Detour do
# Activated properties
field :estimated_duration, :string, virtual: true

# Temporary field to make querying the `:state` faster and avoid needing to
# pull the entire `:state` value
field :state_value, :map, virtual: true

# -------------------------------------------------------
end

Expand Down Expand Up @@ -126,7 +122,6 @@ defmodule Skate.Detours.Db.Detour do
:direction -> select_direction(query)
:nearest_intersection -> select_starting_intersection(query)
:estimated_duration -> select_estimated_duration(query)
:state_value -> select_state_value(query, :state_value)
_unknown -> query
end
end)
Expand Down Expand Up @@ -248,9 +243,5 @@ defmodule Skate.Detours.Db.Detour do
^key => d.state["context"]["selectedDuration"]
})
end

def select_state_value(query \\ base(), key \\ :state_value) do
select_merge(query, [detour: d], %{^key => %{"value" => d.state["value"]}})
end
end
end
4 changes: 0 additions & 4 deletions lib/skate/detours/detours.ex
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,6 @@ defmodule Skate.Detours.Detours do
user
"""
@spec categorize_detour(detour :: map()) :: Detour.status()
def categorize_detour(%{state_value: state_value}) when not is_nil(state_value) do
categorize_detour(%{state: state_value})
end

def categorize_detour(%{state: %{"value" => %{"Detour Drawing" => %{"Active" => _}}}}),
do: :active

Expand Down

0 comments on commit 4cc8760

Please sign in to comment.