From 5cc71a8b6f60deaa71372fd7f710df2badc8ea1c Mon Sep 17 00:00:00 2001 From: Tristan Gosselin-Hane Date: Sat, 3 Aug 2024 12:54:48 -0400 Subject: [PATCH] Make station layout rotation display properly --- lib/lanpartyseating/logic/station_logic.ex | 1 - lib/lanpartyseating_web/live/cancellation_live.ex | 4 ++-- lib/lanpartyseating_web/live/display_live.ex | 4 ++-- lib/lanpartyseating_web/live/selfsign_live.ex | 4 ++-- lib/lanpartyseating_web/live/settings_live.ex | 3 ++- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/lanpartyseating/logic/station_logic.ex b/lib/lanpartyseating/logic/station_logic.ex index fe02c0c..58e61a0 100644 --- a/lib/lanpartyseating/logic/station_logic.ex +++ b/lib/lanpartyseating/logic/station_logic.ex @@ -163,7 +163,6 @@ defmodule Lanpartyseating.StationLogic do %{station_number: station_number, display_order: station_number, inserted_at: now_naive, updated_at: now_naive} end) end) - |> IO.inspect Repo.insert_all(Station, positions) :ok diff --git a/lib/lanpartyseating_web/live/cancellation_live.ex b/lib/lanpartyseating_web/live/cancellation_live.ex index 135f804..6246fc6 100644 --- a/lib/lanpartyseating_web/live/cancellation_live.ex +++ b/lib/lanpartyseating_web/live/cancellation_live.ex @@ -15,8 +15,8 @@ defmodule LanpartyseatingWeb.CancellationLive do socket = socket - |> assign(:columns, settings.columns) - |> assign(:rows, settings.rows) + |> assign(:columns, if(settings.is_diagonally_mirrored, do: settings.rows, else: settings.columns)) + |> assign(:rows, if(settings.is_diagonally_mirrored, do: settings.columns, else: settings.rows)) |> assign(:col_trailing, settings.vertical_trailing) |> assign(:row_trailing, settings.horizontal_trailing) |> assign(:colpad, settings.column_padding) diff --git a/lib/lanpartyseating_web/live/display_live.ex b/lib/lanpartyseating_web/live/display_live.ex index cc28250..3590082 100644 --- a/lib/lanpartyseating_web/live/display_live.ex +++ b/lib/lanpartyseating_web/live/display_live.ex @@ -17,8 +17,8 @@ defmodule LanpartyseatingWeb.DisplayLive do socket = socket - |> assign(:columns, settings.columns) - |> assign(:rows, settings.rows) + |> assign(:columns, if(settings.is_diagonally_mirrored, do: settings.rows, else: settings.columns)) + |> assign(:rows, if(settings.is_diagonally_mirrored, do: settings.columns, else: settings.rows)) |> assign(:col_trailing, settings.vertical_trailing) |> assign(:row_trailing, settings.horizontal_trailing) |> assign(:colpad, settings.column_padding) diff --git a/lib/lanpartyseating_web/live/selfsign_live.ex b/lib/lanpartyseating_web/live/selfsign_live.ex index f8a2a5b..adbceb6 100644 --- a/lib/lanpartyseating_web/live/selfsign_live.ex +++ b/lib/lanpartyseating_web/live/selfsign_live.ex @@ -16,8 +16,8 @@ defmodule LanpartyseatingWeb.SelfSignLive do socket = socket - |> assign(:columns, settings.columns) - |> assign(:rows, settings.rows) + |> assign(:columns, if(settings.is_diagonally_mirrored, do: settings.rows, else: settings.columns)) + |> assign(:rows, if(settings.is_diagonally_mirrored, do: settings.columns, else: settings.rows)) |> assign(:col_trailing, settings.vertical_trailing) |> assign(:row_trailing, settings.horizontal_trailing) |> assign(:colpad, settings.column_padding) diff --git a/lib/lanpartyseating_web/live/settings_live.ex b/lib/lanpartyseating_web/live/settings_live.ex index b327aee..62369e5 100644 --- a/lib/lanpartyseating_web/live/settings_live.ex +++ b/lib/lanpartyseating_web/live/settings_live.ex @@ -154,6 +154,7 @@ defmodule LanpartyseatingWeb.SettingsLive do socket |> assign(:rows, socket.assigns.rows) |> assign(:columns, socket.assigns.columns) + |> assign(:is_diagnoally_mirrored, !socket.assigns.is_diagonally_mirrored) |> assign(:table, transpose(socket.assigns.table)) {:noreply, socket} @@ -176,7 +177,7 @@ defmodule LanpartyseatingWeb.SettingsLive do :ok = Lanpartyseating.StationLogic.save_station_positions(socket.assigns.table) - {:ok, _} = Lanpartyseating.SettingsLogic.save_settings( + :ok = Lanpartyseating.SettingsLogic.save_settings( s.rows, s.columns, s.rowpad,