Skip to content

Commit

Permalink
feat: filter maps only in the game mode form
Browse files Browse the repository at this point in the history
  • Loading branch information
tvillegas98 committed Feb 5, 2025
1 parent 0039ad3 commit 5573e57
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ defmodule ConfiguratorWeb.GameModeConfigurationsLive.Form do
%{"game_mode_configuration" => game_mode_configuration, "version" => version},
socket
) do
maps = Configuration.list_map_configurations_by_version(version.id)
maps = Configuration.list_map_configurations_by_version(version.id) |> Enum.filter(& &1.active)
changeset = Configuration.change_game_mode_configuration(game_mode_configuration)

socket =
Expand All @@ -32,7 +32,7 @@ defmodule ConfiguratorWeb.GameModeConfigurationsLive.Form do
socket
) do
changeset = Configuration.change_game_mode_configuration(%GameModeConfiguration{})
maps = Configuration.list_map_configurations_by_version(version.id)
maps = Configuration.list_map_configurations_by_version(version.id) |> Enum.filter(& &1.active)

socket =
assign(socket,
Expand Down
4 changes: 1 addition & 3 deletions apps/game_backend/lib/game_backend/configuration.ex
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,7 @@ defmodule GameBackend.Configuration do
"""
def list_map_configurations_by_version(version_id) do
Repo.all(
from(m in MapConfiguration, where: m.version_id == ^version_id and m.active, order_by: [desc: m.inserted_at])
)
Repo.all(from(m in MapConfiguration, where: m.version_id == ^version_id, order_by: [desc: m.inserted_at]))
end

@doc """
Expand Down

0 comments on commit 5573e57

Please sign in to comment.