Skip to content

Commit

Permalink
Swap screen_ids handler clauses & remove redundant guard
Browse files Browse the repository at this point in the history
  • Loading branch information
jzimbel-mbta authored Sep 14, 2023
1 parent 4b1d057 commit 5e78b54
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions lib/screens/config/state.ex
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,11 @@ defmodule Screens.Config.State do
{:reply, app_params, state}
end

def handle_call({:screen_ids, filter_fn}, _from, %__MODULE__{config: config} = state)
when is_function(filter_fn, 1) do
def handle_call({:screen_ids, nil}, _from, %__MODULE__{config: config} = state) do
{:reply, Map.keys(config.screens), state}
end

def handle_call({:screen_ids, filter_fn}, _from, %__MODULE__{config: config} = state) do
ids =
config.screens
|> Enum.filter(filter_fn)
Expand All @@ -184,10 +187,6 @@ defmodule Screens.Config.State do
{:reply, ids, state}
end

def handle_call({:screen_ids, _}, _from, %__MODULE__{config: config} = state) do
{:reply, Map.keys(config.screens), state}
end

def handle_call({:mode_disabled?, mode}, _from, %__MODULE__{config: config} = state) do
%Devops{disabled_modes: disabled_modes} = config.devops

Expand Down

0 comments on commit 5e78b54

Please sign in to comment.