From 3cbd62e84c30ec87d681d44bebb16622ff759e6e Mon Sep 17 00:00:00 2001 From: shibao Date: Fri, 1 Jul 2022 21:39:08 -0400 Subject: [PATCH] fix shotgroup changesets --- lib/cannery/activity_log.ex | 153 ++++++++---------- lib/cannery/activity_log/shot_group.ex | 63 +++++++- .../components/add_shot_group_component.ex | 26 +-- .../live/range_live/form_component.ex | 8 +- priv/gettext/de/LC_MESSAGES/errors.po | 6 +- priv/gettext/de/LC_MESSAGES/prompts.po | 2 +- priv/gettext/en/LC_MESSAGES/errors.po | 6 +- priv/gettext/en/LC_MESSAGES/prompts.po | 2 +- priv/gettext/errors.pot | 6 +- priv/gettext/es/LC_MESSAGES/errors.po | 6 +- priv/gettext/es/LC_MESSAGES/prompts.po | 2 +- priv/gettext/fr/LC_MESSAGES/errors.po | 6 +- priv/gettext/fr/LC_MESSAGES/prompts.po | 2 +- priv/gettext/prompts.pot | 2 +- test/cannery/activity_log_test.exs | 5 - 15 files changed, 157 insertions(+), 138 deletions(-) diff --git a/lib/cannery/activity_log.ex b/lib/cannery/activity_log.ex index 354872d9..911ee670 100644 --- a/lib/cannery/activity_log.ex +++ b/lib/cannery/activity_log.ex @@ -4,8 +4,7 @@ defmodule Cannery.ActivityLog do """ import Ecto.Query, warn: false - import CanneryWeb.Gettext - alias Cannery.{Accounts.User, ActivityLog.ShotGroup, Ammo, Ammo.AmmoGroup, Repo} + alias Cannery.{Accounts.User, ActivityLog.ShotGroup, Ammo.AmmoGroup, Repo} alias Ecto.{Changeset, Multi} @doc """ @@ -60,32 +59,30 @@ defmodule Cannery.ActivityLog do """ @spec create_shot_group(attrs :: map(), User.t(), AmmoGroup.t()) :: {:ok, ShotGroup.t()} | {:error, Changeset.t(ShotGroup.t()) | nil} - def create_shot_group( - attrs, - %User{id: user_id}, - %AmmoGroup{id: ammo_group_id, count: ammo_group_count, user_id: user_id} = ammo_group - ) do - attrs = attrs |> Map.merge(%{"user_id" => user_id, "ammo_group_id" => ammo_group_id}) - changeset = %ShotGroup{} |> ShotGroup.create_changeset(attrs) - shot_group_count = changeset |> Changeset.get_field(:count) - - if shot_group_count > ammo_group_count do - error = dgettext("errors", "Count must be less than %{count}", count: ammo_group_count) - changeset = changeset |> Changeset.add_error(:count, error) - {:error, changeset} - else - Multi.new() - |> Multi.insert(:create_shot_group, changeset) - |> Multi.update( - :update_ammo_group, - ammo_group |> AmmoGroup.range_changeset(%{"count" => ammo_group_count - shot_group_count}) - ) - |> Repo.transaction() - |> case do - {:ok, %{create_shot_group: shot_group}} -> {:ok, shot_group} - {:error, :create_shot_group, changeset, _changes_so_far} -> {:error, changeset} - {:error, _other_transaction, _value, _changes_so_far} -> {:error, nil} + def create_shot_group(attrs, user, ammo_group) do + Multi.new() + |> Multi.insert( + :create_shot_group, + %ShotGroup{} |> ShotGroup.create_changeset(user, ammo_group, attrs) + ) + |> Multi.run( + :ammo_group, + fn repo, %{create_shot_group: %{ammo_group_id: ammo_group_id, user_id: user_id}} -> + {:ok, + repo.one(from ag in AmmoGroup, where: ag.id == ^ammo_group_id and ag.user_id == ^user_id)} end + ) + |> Multi.update( + :update_ammo_group, + fn %{create_shot_group: %{count: shot_group_count}, ammo_group: %{count: ammo_group_count}} -> + ammo_group |> AmmoGroup.range_changeset(%{"count" => ammo_group_count - shot_group_count}) + end + ) + |> Repo.transaction() + |> case do + {:ok, %{create_shot_group: shot_group}} -> {:ok, shot_group} + {:error, :create_shot_group, changeset, _changes_so_far} -> {:error, changeset} + {:error, _other_transaction, _value, _changes_so_far} -> {:error, nil} end end @@ -104,42 +101,38 @@ defmodule Cannery.ActivityLog do @spec update_shot_group(ShotGroup.t(), attrs :: map(), User.t()) :: {:ok, ShotGroup.t()} | {:error, Changeset.t(ShotGroup.t()) | nil} def update_shot_group( - %ShotGroup{count: count, user_id: user_id, ammo_group_id: ammo_group_id} = shot_group, + %ShotGroup{count: count, user_id: user_id} = shot_group, attrs, %User{id: user_id} = user ) do - %{count: ammo_group_count, user_id: ^user_id} = - ammo_group = ammo_group_id |> Ammo.get_ammo_group!(user) - - changeset = shot_group |> ShotGroup.update_changeset(attrs) - new_shot_group_count = changeset |> Changeset.get_field(:count) - shot_diff_to_add = new_shot_group_count - count - - cond do - shot_diff_to_add > ammo_group_count -> - error = dgettext("errors", "Count must be less than %{count}", count: ammo_group_count) - changeset = changeset |> Changeset.add_error(:count, error) - {:error, changeset} - - new_shot_group_count <= 0 -> - error = dgettext("errors", "Count must be at least 1") - changeset = changeset |> Changeset.add_error(:count, error) - {:error, changeset} - - true -> - Multi.new() - |> Multi.update(:update_shot_group, changeset) - |> Multi.update( - :update_ammo_group, - ammo_group - |> AmmoGroup.range_changeset(%{"count" => ammo_group_count - shot_diff_to_add}) - ) - |> Repo.transaction() - |> case do - {:ok, %{update_shot_group: shot_group}} -> {:ok, shot_group} - {:error, :update_shot_group, changeset, _changes_so_far} -> {:error, changeset} - {:error, _other_transaction, _value, _changes_so_far} -> {:error, nil} - end + Multi.new() + |> Multi.update( + :update_shot_group, + shot_group |> ShotGroup.update_changeset(user, attrs) + ) + |> Multi.run( + :ammo_group, + fn repo, %{update_shot_group: %{ammo_group_id: ammo_group_id, user_id: user_id}} -> + {:ok, + repo.one(from ag in AmmoGroup, where: ag.id == ^ammo_group_id and ag.user_id == ^user_id)} + end + ) + |> Multi.update( + :update_ammo_group, + fn %{ + update_shot_group: %{count: new_count}, + ammo_group: %{count: ammo_group_count} = ammo_group + } -> + shot_diff_to_add = new_count - count + new_ammo_group_count = ammo_group_count - shot_diff_to_add + ammo_group |> AmmoGroup.range_changeset(%{"count" => new_ammo_group_count}) + end + ) + |> Repo.transaction() + |> case do + {:ok, %{update_shot_group: shot_group}} -> {:ok, shot_group} + {:error, :update_shot_group, changeset, _changes_so_far} -> {:error, changeset} + {:error, _other_transaction, _value, _changes_so_far} -> {:error, nil} end end @@ -158,18 +151,27 @@ defmodule Cannery.ActivityLog do @spec delete_shot_group(ShotGroup.t(), User.t()) :: {:ok, ShotGroup.t()} | {:error, Changeset.t(ShotGroup.t())} def delete_shot_group( - %ShotGroup{count: count, user_id: user_id, ammo_group_id: ammo_group_id} = shot_group, - %User{id: user_id} = user + %ShotGroup{user_id: user_id} = shot_group, + %User{id: user_id} ) do - %{count: ammo_group_count, user_id: ^user_id} = - ammo_group = ammo_group_id |> Ammo.get_ammo_group!(user) - Multi.new() |> Multi.delete(:delete_shot_group, shot_group) + |> Multi.run( + :ammo_group, + fn repo, %{delete_shot_group: %{ammo_group_id: ammo_group_id, user_id: user_id}} -> + {:ok, + repo.one(from ag in AmmoGroup, where: ag.id == ^ammo_group_id and ag.user_id == ^user_id)} + end + ) |> Multi.update( :update_ammo_group, - ammo_group - |> AmmoGroup.range_changeset(%{"count" => ammo_group_count + count}) + fn %{ + delete_shot_group: %{count: count}, + ammo_group: %{count: ammo_group_count} = ammo_group + } -> + new_ammo_group_count = ammo_group_count + count + ammo_group |> AmmoGroup.range_changeset(%{"count" => new_ammo_group_count}) + end ) |> Repo.transaction() |> case do @@ -178,21 +180,4 @@ defmodule Cannery.ActivityLog do {:error, _other_transaction, _value, _changes_so_far} -> {:error, nil} end end - - @doc """ - Returns an `%Ecto.Changeset{}` for tracking shot_group changes. - - ## Examples - - iex> change_shot_group(shot_group) - %Ecto.Changeset{data: %ShotGroup{}} - - """ - @spec change_shot_group(ShotGroup.t() | ShotGroup.new_shot_group()) :: - Changeset.t(ShotGroup.t() | ShotGroup.new_shot_group()) - @spec change_shot_group(ShotGroup.t() | ShotGroup.new_shot_group(), attrs :: map()) :: - Changeset.t(ShotGroup.t() | ShotGroup.new_shot_group()) - def change_shot_group(%ShotGroup{} = shot_group, attrs \\ %{}) do - shot_group |> ShotGroup.update_changeset(attrs) - end end diff --git a/lib/cannery/activity_log/shot_group.ex b/lib/cannery/activity_log/shot_group.ex index 7b254339..4355a7e1 100644 --- a/lib/cannery/activity_log/shot_group.ex +++ b/lib/cannery/activity_log/shot_group.ex @@ -4,8 +4,9 @@ defmodule Cannery.ActivityLog.ShotGroup do """ use Ecto.Schema + import CanneryWeb.Gettext import Ecto.Changeset - alias Cannery.{Accounts.User, ActivityLog.ShotGroup, Ammo.AmmoGroup} + alias Cannery.{Accounts.User, ActivityLog.ShotGroup, Ammo.AmmoGroup, Repo} alias Ecto.{Changeset, UUID} @primary_key {:id, :binary_id, autogenerate: true} @@ -37,21 +38,71 @@ defmodule Cannery.ActivityLog.ShotGroup do @type id :: UUID.t() @doc false - @spec create_changeset(new_shot_group(), attrs :: map()) :: Changeset.t(new_shot_group()) - def create_changeset(shot_group, attrs) do + @spec create_changeset(new_shot_group(), User.t(), AmmoGroup.t(), attrs :: map()) :: + Changeset.t(new_shot_group()) + def create_changeset( + shot_group, + %User{id: user_id}, + %AmmoGroup{id: ammo_group_id, user_id: user_id} = ammo_group, + attrs + ) + when not (user_id |> is_nil()) and not (ammo_group_id |> is_nil()) do shot_group - |> cast(attrs, [:count, :notes, :date, :ammo_group_id, :user_id]) + |> change(user_id: user_id) + |> change(ammo_group_id: ammo_group_id) + |> cast(attrs, [:count, :notes, :date]) |> validate_number(:count, greater_than: 0) + |> validate_create_shot_group_count(ammo_group) |> validate_required([:count, :ammo_group_id, :user_id]) end + defp validate_create_shot_group_count(changeset, %AmmoGroup{count: ammo_group_count}) do + if changeset |> Changeset.get_field(:count) > ammo_group_count do + error = dgettext("errors", "Count must be less than %{count}", count: ammo_group_count) + changeset |> Changeset.add_error(:count, error) + else + changeset + end + end + @doc false - @spec update_changeset(t() | new_shot_group(), attrs :: map()) :: + @spec update_changeset(t() | new_shot_group(), User.t(), attrs :: map()) :: Changeset.t(t() | new_shot_group()) - def update_changeset(shot_group, attrs) do + def update_changeset( + %ShotGroup{user_id: user_id} = shot_group, + %User{id: user_id} = user, + attrs + ) + when not (user_id |> is_nil()) do shot_group |> cast(attrs, [:count, :notes, :date]) |> validate_number(:count, greater_than: 0) |> validate_required([:count]) + |> validate_update_shot_group_count(shot_group, user) + end + + defp validate_update_shot_group_count( + changeset, + %ShotGroup{count: count} = shot_group, + %User{id: user_id} + ) + when not (user_id |> is_nil()) do + %{ammo_group: %AmmoGroup{count: ammo_group_count, user_id: ^user_id}} = + shot_group |> Repo.preload(:ammo_group) + + new_shot_group_count = changeset |> Changeset.get_field(:count) + shot_diff_to_add = new_shot_group_count - count + + cond do + shot_diff_to_add > ammo_group_count -> + error = dgettext("errors", "Count must be less than %{count}", count: ammo_group_count) + changeset |> Changeset.add_error(:count, error) + + new_shot_group_count <= 0 -> + changeset |> Changeset.add_error(:count, dgettext("errors", "Count must be at least 1")) + + true -> + changeset + end end end diff --git a/lib/cannery_web/components/add_shot_group_component.ex b/lib/cannery_web/components/add_shot_group_component.ex index 679e5f2e..1500aaf0 100644 --- a/lib/cannery_web/components/add_shot_group_component.ex +++ b/lib/cannery_web/components/add_shot_group_component.ex @@ -16,9 +16,10 @@ defmodule CanneryWeb.Components.AddShotGroupComponent do }, Socket.t() ) :: {:ok, Socket.t()} - def update(%{ammo_group: _ammo_group, current_user: _current_user} = assigns, socket) do + def update(%{ammo_group: ammo_group, current_user: current_user} = assigns, socket) do changeset = - %ShotGroup{date: NaiveDateTime.utc_now(), count: 1} |> ActivityLog.change_shot_group() + %ShotGroup{date: NaiveDateTime.utc_now(), count: 1} + |> ShotGroup.create_changeset(current_user, ammo_group, %{}) {:ok, socket |> assign(assigns) |> assign(:changeset, changeset)} end @@ -27,21 +28,13 @@ defmodule CanneryWeb.Components.AddShotGroupComponent do def handle_event( "validate", %{"shot_group" => shot_group_params}, - %{ - assigns: %{ - ammo_group: %AmmoGroup{id: ammo_group_id} = ammo_group, - current_user: %User{id: user_id} - } - } = socket + %{assigns: %{ammo_group: ammo_group, current_user: current_user}} = socket ) do - shot_group_params = - shot_group_params - |> process_params(ammo_group) - |> Map.merge(%{"ammo_group_id" => ammo_group_id, "user_id" => user_id}) + params = shot_group_params |> process_params(ammo_group) changeset = %ShotGroup{} - |> ActivityLog.change_shot_group(shot_group_params) + |> ShotGroup.create_changeset(current_user, ammo_group, params) |> Map.put(:action, :validate) {:noreply, socket |> assign(:changeset, changeset)} @@ -51,17 +44,12 @@ defmodule CanneryWeb.Components.AddShotGroupComponent do "save", %{"shot_group" => shot_group_params}, %{ - assigns: %{ - ammo_group: %{id: ammo_group_id} = ammo_group, - current_user: %{id: user_id} = current_user, - return_to: return_to - } + assigns: %{ammo_group: ammo_group, current_user: current_user, return_to: return_to} } = socket ) do socket = shot_group_params |> process_params(ammo_group) - |> Map.merge(%{"ammo_group_id" => ammo_group_id, "user_id" => user_id}) |> ActivityLog.create_shot_group(current_user, ammo_group) |> case do {:ok, _shot_group} -> diff --git a/lib/cannery_web/live/range_live/form_component.ex b/lib/cannery_web/live/range_live/form_component.ex index 770fe857..8eb8711c 100644 --- a/lib/cannery_web/live/range_live/form_component.ex +++ b/lib/cannery_web/live/range_live/form_component.ex @@ -1,6 +1,6 @@ defmodule CanneryWeb.RangeLive.FormComponent do @moduledoc """ - Livecomponent that can update or create a ShotGroup + Livecomponent that can update a ShotGroup """ use CanneryWeb, :live_component @@ -24,7 +24,7 @@ defmodule CanneryWeb.RangeLive.FormComponent do } = assigns, socket ) do - changeset = shot_group |> ActivityLog.change_shot_group() + changeset = shot_group |> ShotGroup.update_changeset(current_user, %{}) ammo_group = Ammo.get_ammo_group!(ammo_group_id, current_user) {:ok, socket |> assign(assigns) |> assign(ammo_group: ammo_group, changeset: changeset)} end @@ -33,11 +33,11 @@ defmodule CanneryWeb.RangeLive.FormComponent do def handle_event( "validate", %{"shot_group" => shot_group_params}, - %{assigns: %{shot_group: shot_group}} = socket + %{assigns: %{current_user: current_user, shot_group: shot_group}} = socket ) do changeset = shot_group - |> ActivityLog.change_shot_group(shot_group_params) + |> ShotGroup.update_changeset(current_user, shot_group_params) |> Map.put(:action, :validate) {:noreply, assign(socket, :changeset, changeset)} diff --git a/priv/gettext/de/LC_MESSAGES/errors.po b/priv/gettext/de/LC_MESSAGES/errors.po index b6c601b9..7a3b94db 100644 --- a/priv/gettext/de/LC_MESSAGES/errors.po +++ b/priv/gettext/de/LC_MESSAGES/errors.po @@ -152,13 +152,13 @@ msgid "Tag could not be added" msgstr "Tag konnte nicht hinzugefügt werden" #, elixir-autogen, elixir-format -#: lib/cannery/activity_log.ex:125 +#: lib/cannery/activity_log/shot_group.ex:102 msgid "Count must be at least 1" msgstr "Anzahl muss mindestens 1 sein" #, elixir-autogen, elixir-format -#: lib/cannery/activity_log.ex:73 -#: lib/cannery/activity_log.ex:120 +#: lib/cannery/activity_log/shot_group.ex:61 +#: lib/cannery/activity_log/shot_group.ex:98 msgid "Count must be less than %{count}" msgstr "Anzahl muss weniger als %{count} betragen" diff --git a/priv/gettext/de/LC_MESSAGES/prompts.po b/priv/gettext/de/LC_MESSAGES/prompts.po index 5e633324..e4ca75a1 100644 --- a/priv/gettext/de/LC_MESSAGES/prompts.po +++ b/priv/gettext/de/LC_MESSAGES/prompts.po @@ -205,7 +205,7 @@ msgid "Adding..." msgstr "Füge hinzu..." #, elixir-autogen, elixir-format -#: lib/cannery_web/components/add_shot_group_component.ex:68 +#: lib/cannery_web/components/add_shot_group_component.ex:56 msgid "Shots recorded successfully" msgstr "Schüsse erfolgreich dokumentiert" diff --git a/priv/gettext/en/LC_MESSAGES/errors.po b/priv/gettext/en/LC_MESSAGES/errors.po index fe8d9771..d303a0f8 100644 --- a/priv/gettext/en/LC_MESSAGES/errors.po +++ b/priv/gettext/en/LC_MESSAGES/errors.po @@ -139,13 +139,13 @@ msgid "Tag could not be added" msgstr "" #, elixir-autogen, elixir-format -#: lib/cannery/activity_log.ex:125 +#: lib/cannery/activity_log/shot_group.ex:102 msgid "Count must be at least 1" msgstr "" #, elixir-autogen, elixir-format -#: lib/cannery/activity_log.ex:73 -#: lib/cannery/activity_log.ex:120 +#: lib/cannery/activity_log/shot_group.ex:61 +#: lib/cannery/activity_log/shot_group.ex:98 msgid "Count must be less than %{count}" msgstr "" diff --git a/priv/gettext/en/LC_MESSAGES/prompts.po b/priv/gettext/en/LC_MESSAGES/prompts.po index 0c80fb45..ce081eaf 100644 --- a/priv/gettext/en/LC_MESSAGES/prompts.po +++ b/priv/gettext/en/LC_MESSAGES/prompts.po @@ -185,7 +185,7 @@ msgid "Adding..." msgstr "" #, elixir-autogen, elixir-format -#: lib/cannery_web/components/add_shot_group_component.ex:68 +#: lib/cannery_web/components/add_shot_group_component.ex:56 msgid "Shots recorded successfully" msgstr "" diff --git a/priv/gettext/errors.pot b/priv/gettext/errors.pot index 80bb167d..6b3a9220 100644 --- a/priv/gettext/errors.pot +++ b/priv/gettext/errors.pot @@ -138,13 +138,13 @@ msgid "Tag could not be added" msgstr "" #, elixir-autogen, elixir-format -#: lib/cannery/activity_log.ex:125 +#: lib/cannery/activity_log/shot_group.ex:102 msgid "Count must be at least 1" msgstr "" #, elixir-autogen, elixir-format -#: lib/cannery/activity_log.ex:73 -#: lib/cannery/activity_log.ex:120 +#: lib/cannery/activity_log/shot_group.ex:61 +#: lib/cannery/activity_log/shot_group.ex:98 msgid "Count must be less than %{count}" msgstr "" diff --git a/priv/gettext/es/LC_MESSAGES/errors.po b/priv/gettext/es/LC_MESSAGES/errors.po index b59e6575..aac64614 100644 --- a/priv/gettext/es/LC_MESSAGES/errors.po +++ b/priv/gettext/es/LC_MESSAGES/errors.po @@ -149,13 +149,13 @@ msgid "Tag could not be added" msgstr "" #, elixir-autogen, elixir-format -#: lib/cannery/activity_log.ex:125 +#: lib/cannery/activity_log/shot_group.ex:102 msgid "Count must be at least 1" msgstr "" #, elixir-autogen, elixir-format -#: lib/cannery/activity_log.ex:73 -#: lib/cannery/activity_log.ex:120 +#: lib/cannery/activity_log/shot_group.ex:61 +#: lib/cannery/activity_log/shot_group.ex:98 msgid "Count must be less than %{count}" msgstr "" diff --git a/priv/gettext/es/LC_MESSAGES/prompts.po b/priv/gettext/es/LC_MESSAGES/prompts.po index 3850bfe2..095eda84 100644 --- a/priv/gettext/es/LC_MESSAGES/prompts.po +++ b/priv/gettext/es/LC_MESSAGES/prompts.po @@ -195,7 +195,7 @@ msgid "Adding..." msgstr "" #, elixir-autogen, elixir-format -#: lib/cannery_web/components/add_shot_group_component.ex:68 +#: lib/cannery_web/components/add_shot_group_component.ex:56 msgid "Shots recorded successfully" msgstr "" diff --git a/priv/gettext/fr/LC_MESSAGES/errors.po b/priv/gettext/fr/LC_MESSAGES/errors.po index ef5ae36c..013a47f7 100644 --- a/priv/gettext/fr/LC_MESSAGES/errors.po +++ b/priv/gettext/fr/LC_MESSAGES/errors.po @@ -153,13 +153,13 @@ msgid "Tag could not be added" msgstr "Le tag n’a pas pu être ajouté" #, elixir-autogen, elixir-format -#: lib/cannery/activity_log.ex:125 +#: lib/cannery/activity_log/shot_group.ex:102 msgid "Count must be at least 1" msgstr "Le nombre doit être au moins égal à 1" #, elixir-autogen, elixir-format -#: lib/cannery/activity_log.ex:73 -#: lib/cannery/activity_log.ex:120 +#: lib/cannery/activity_log/shot_group.ex:61 +#: lib/cannery/activity_log/shot_group.ex:98 msgid "Count must be less than %{count}" msgstr "La quantité doit être inférieur à %{count}" diff --git a/priv/gettext/fr/LC_MESSAGES/prompts.po b/priv/gettext/fr/LC_MESSAGES/prompts.po index 6f86ce66..0328cab1 100644 --- a/priv/gettext/fr/LC_MESSAGES/prompts.po +++ b/priv/gettext/fr/LC_MESSAGES/prompts.po @@ -206,7 +206,7 @@ msgid "Adding..." msgstr "Ajout en cours…" #, elixir-autogen, elixir-format -#: lib/cannery_web/components/add_shot_group_component.ex:68 +#: lib/cannery_web/components/add_shot_group_component.ex:56 msgid "Shots recorded successfully" msgstr "Tirs enregistré avec succès" diff --git a/priv/gettext/prompts.pot b/priv/gettext/prompts.pot index 391f35f7..364f8e42 100644 --- a/priv/gettext/prompts.pot +++ b/priv/gettext/prompts.pot @@ -184,7 +184,7 @@ msgid "Adding..." msgstr "" #, elixir-autogen, elixir-format -#: lib/cannery_web/components/add_shot_group_component.ex:68 +#: lib/cannery_web/components/add_shot_group_component.ex:56 msgid "Shots recorded successfully" msgstr "" diff --git a/test/cannery/activity_log_test.exs b/test/cannery/activity_log_test.exs index d96c105b..418c8f59 100644 --- a/test/cannery/activity_log_test.exs +++ b/test/cannery/activity_log_test.exs @@ -178,10 +178,5 @@ defmodule Cannery.ActivityLogTest do ActivityLog.get_shot_group!(shot_group.id, current_user) end end - - test "change_shot_group/1 returns a shot_group changeset", - %{shot_group: shot_group} do - assert %Ecto.Changeset{} = ActivityLog.change_shot_group(shot_group) - end end end