Skip to content

Commit

Permalink
tweak: Mis-commit in detours.ex
Browse files Browse the repository at this point in the history
  • Loading branch information
hannahpurcell authored Dec 11, 2024
1 parent b55e03f commit 59910e7
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions lib/skate/detours/detours.ex
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,10 @@ defmodule Skate.Detours.Detours do
def categorize_detour(%{state: %{"value" => %{"Detour Drawing" => "Past"}}}, _user_id),
do: :past

@doc """
Takes a `Skate.Detours.Db.Detour` struct and a `Skate.Settings.Db.User` id
and returns a `t:detour_type/0` based on the state of the detour.
otherwise returns `nil` if it is a draft but does not belong to the provided
user
"""
def categorize_detour(_detour_context, nil = _user_id), do: :draft
def categorize_detour(%{author_id: author_id}, user_id) when author_id == user_id, do: :draft
def categorize_detour(_, _), do: nil

@spec get_detour_route(detour :: map()) :: String.t()
def get_detour_route(%{state: %{"context" => %{"route" => %{"name" => route_name}}}}),
do: route_name
Expand Down

0 comments on commit 59910e7

Please sign in to comment.