From 947659b207123152692f39c17b2fb7b00ee3c9f2 Mon Sep 17 00:00:00 2001 From: shibao Date: Mon, 4 Jul 2022 20:06:41 -0400 Subject: [PATCH] fix ammo_group changesets --- lib/cannery/ammo.ex | 55 +++++++++++-------- lib/cannery/ammo/ammo_group.ex | 38 +++++++++++-- .../components/move_ammo_group_component.ex | 2 +- .../live/ammo_group_live/form_component.ex | 23 +++++++- priv/gettext/de/LC_MESSAGES/errors.po | 25 +++++++-- priv/gettext/de/LC_MESSAGES/prompts.po | 4 +- priv/gettext/en/LC_MESSAGES/errors.po | 25 +++++++-- priv/gettext/en/LC_MESSAGES/prompts.po | 4 +- priv/gettext/errors.pot | 25 +++++++-- priv/gettext/es/LC_MESSAGES/errors.po | 25 +++++++-- priv/gettext/es/LC_MESSAGES/prompts.po | 4 +- priv/gettext/fr/LC_MESSAGES/errors.po | 25 +++++++-- priv/gettext/fr/LC_MESSAGES/prompts.po | 4 +- priv/gettext/prompts.pot | 4 +- test/cannery/ammo_test.exs | 4 -- 15 files changed, 196 insertions(+), 71 deletions(-) diff --git a/lib/cannery/ammo.ex b/lib/cannery/ammo.ex index ea9c8539..3c62ab68 100644 --- a/lib/cannery/ammo.ex +++ b/lib/cannery/ammo.ex @@ -3,6 +3,7 @@ defmodule Cannery.Ammo do The Ammo context. """ + import CanneryWeb.Gettext import Ecto.Query, warn: false alias Cannery.{Accounts.User, Containers, Repo} alias Cannery.ActivityLog.ShotGroup @@ -350,18 +351,21 @@ defmodule Cannery.Ammo do def create_ammo_groups( %{"ammo_type_id" => ammo_type_id, "container_id" => container_id} = attrs, multiplier, - %User{id: user_id} = user + %User{} = user ) - when multiplier >= 1 and multiplier <= @ammo_group_create_limit do - # validate ammo type and container ids belong to user - _valid_ammo_type = get_ammo_type!(ammo_type_id, user) - _valid_container = Containers.get_container!(container_id, user) - + when multiplier >= 1 and multiplier <= @ammo_group_create_limit and + not (ammo_type_id |> is_nil()) and not (container_id |> is_nil()) do now = NaiveDateTime.utc_now() |> NaiveDateTime.truncate(:second) changesets = Enum.map(1..multiplier, fn _count -> - %AmmoGroup{} |> AmmoGroup.create_changeset(attrs |> Map.put("user_id", user_id)) + %AmmoGroup{} + |> AmmoGroup.create_changeset( + get_ammo_type!(ammo_type_id, user), + Containers.get_container!(container_id, user), + user, + attrs + ) end) if changesets |> Enum.all?(fn %{valid?: valid} -> valid end) do @@ -386,8 +390,27 @@ defmodule Cannery.Ammo do end end - def create_ammo_groups(invalid_attrs, _multiplier, _user) do - {:error, %AmmoGroup{} |> AmmoGroup.create_changeset(invalid_attrs)} + def create_ammo_groups( + %{"ammo_type_id" => ammo_type_id, "container_id" => container_id} = attrs, + _multiplier, + user + ) + when not (ammo_type_id |> is_nil()) and not (container_id |> is_nil()) do + changeset = + %AmmoGroup{} + |> AmmoGroup.create_changeset( + get_ammo_type!(ammo_type_id, user), + Containers.get_container!(container_id, user), + user, + attrs + ) + |> Changeset.add_error(:multiplier, dgettext("errors", "Invalid multiplier")) + + {:error, changeset} + end + + def create_ammo_groups(invalid_attrs, _multiplier, user) do + {:error, %AmmoGroup{} |> AmmoGroup.create_changeset(nil, nil, user, invalid_attrs)} end @doc """ @@ -436,18 +459,4 @@ defmodule Cannery.Ammo do @spec delete_ammo_group!(AmmoGroup.t(), User.t()) :: AmmoGroup.t() def delete_ammo_group!(%AmmoGroup{user_id: user_id} = ammo_group, %User{id: user_id}), do: ammo_group |> Repo.delete!() - - @doc """ - Returns an `%Changeset{}` for tracking ammo_group changes. - - ## Examples - - iex> change_ammo_group(ammo_group) - %Changeset{data: %AmmoGroup{}} - - """ - @spec change_ammo_group(AmmoGroup.t()) :: Changeset.t(AmmoGroup.t()) - @spec change_ammo_group(AmmoGroup.t(), attrs :: map()) :: Changeset.t(AmmoGroup.t()) - def change_ammo_group(%AmmoGroup{} = ammo_group, attrs \\ %{}), - do: AmmoGroup.update_changeset(ammo_group, attrs) end diff --git a/lib/cannery/ammo/ammo_group.ex b/lib/cannery/ammo/ammo_group.ex index 1dfe6182..09426f0b 100644 --- a/lib/cannery/ammo/ammo_group.ex +++ b/lib/cannery/ammo/ammo_group.ex @@ -7,6 +7,7 @@ defmodule Cannery.Ammo.AmmoGroup do """ use Ecto.Schema + import CanneryWeb.Gettext import Ecto.Changeset alias Cannery.Ammo.{AmmoGroup, AmmoType} alias Cannery.{Accounts.User, ActivityLog.ShotGroup, Containers.Container} @@ -48,22 +49,49 @@ defmodule Cannery.Ammo.AmmoGroup do @type id :: UUID.t() @doc false - @spec create_changeset(new_ammo_group(), attrs :: map()) :: Changeset.t(new_ammo_group()) - def create_changeset(ammo_group, attrs) do + @spec create_changeset( + new_ammo_group(), + AmmoType.t() | nil, + Container.t() | nil, + User.t(), + attrs :: map() + ) :: Changeset.t(new_ammo_group()) + def create_changeset( + ammo_group, + %AmmoType{id: ammo_type_id}, + %Container{id: container_id, user_id: user_id}, + %User{id: user_id}, + attrs + ) + when not (ammo_type_id |> is_nil()) and not (container_id |> is_nil()) and + not (user_id |> is_nil()) do ammo_group - |> cast(attrs, [:count, :price_paid, :notes, :staged, :ammo_type_id, :container_id, :user_id]) + |> change(ammo_type_id: ammo_type_id) + |> change(user_id: user_id) + |> change(container_id: container_id) + |> cast(attrs, [:count, :price_paid, :notes, :staged]) |> validate_number(:count, greater_than: 0) |> validate_required([:count, :staged, :ammo_type_id, :container_id, :user_id]) end + @doc """ + Invalid changeset, used to prompt user to select ammo type and container + """ + def create_changeset(ammo_group, _invalid_ammo_type, _invalid_container, _invalid_user, attrs) do + ammo_group + |> cast(attrs, [:ammo_type_id, :container_id]) + |> validate_required([:ammo_type_id, :container_id]) + |> add_error(:invalid, dgettext("errors", "Please select an ammo type and container")) + end + @doc false @spec update_changeset(t() | new_ammo_group(), attrs :: map()) :: Changeset.t(t() | new_ammo_group()) def update_changeset(ammo_group, attrs) do ammo_group - |> cast(attrs, [:count, :price_paid, :notes, :staged, :ammo_type_id, :container_id]) + |> cast(attrs, [:count, :price_paid, :notes, :staged]) |> validate_number(:count, greater_than_or_equal_to: 0) - |> validate_required([:count, :staged, :ammo_type_id, :container_id]) + |> validate_required([:count, :staged]) end @doc """ diff --git a/lib/cannery_web/components/move_ammo_group_component.ex b/lib/cannery_web/components/move_ammo_group_component.ex index 8a8c3de6..06f6b036 100644 --- a/lib/cannery_web/components/move_ammo_group_component.ex +++ b/lib/cannery_web/components/move_ammo_group_component.ex @@ -22,7 +22,7 @@ defmodule CanneryWeb.Components.MoveAmmoGroupComponent do assigns, socket ) do - changeset = Ammo.change_ammo_group(ammo_group) + changeset = ammo_group |> AmmoGroup.update_changeset(%{}) containers = Containers.list_containers(current_user) diff --git a/lib/cannery_web/live/ammo_group_live/form_component.ex b/lib/cannery_web/live/ammo_group_live/form_component.ex index 2e79341f..b17a1dbd 100644 --- a/lib/cannery_web/live/ammo_group_live/form_component.ex +++ b/lib/cannery_web/live/ammo_group_live/form_component.ex @@ -25,7 +25,7 @@ defmodule CanneryWeb.AmmoGroupLive.FormComponent do socket = socket |> assign(:ammo_group_create_limit, @ammo_group_create_limit) - |> assign(:changeset, Ammo.change_ammo_group(ammo_group)) + |> assign(:changeset, ammo_group |> AmmoGroup.update_changeset(%{})) |> assign(:ammo_types, Ammo.list_ammo_types(current_user)) |> assign_new(:containers, fn -> Containers.list_containers(current_user) end) @@ -36,7 +36,7 @@ defmodule CanneryWeb.AmmoGroupLive.FormComponent do def handle_event( "validate", %{"ammo_group" => ammo_group_params}, - %{assigns: %{action: action, ammo_group: ammo_group}} = socket + %{assigns: %{action: action, ammo_group: ammo_group, current_user: user}} = socket ) do changeset_action = case action do @@ -44,7 +44,24 @@ defmodule CanneryWeb.AmmoGroupLive.FormComponent do :edit -> :update end - changeset = ammo_group |> Ammo.change_ammo_group(ammo_group_params) + changeset = + case action do + :new -> + ammo_type = + if ammo_group_params |> Map.has_key?("ammo_type_id"), + do: ammo_group_params |> Map.get("ammo_type_id") |> Ammo.get_ammo_type!(user), + else: nil + + container = + if ammo_group_params |> Map.has_key?("container_id"), + do: ammo_group_params |> Map.get("container_id") |> Containers.get_container!(user), + else: nil + + ammo_group |> AmmoGroup.create_changeset(ammo_type, container, user, ammo_group_params) + + :edit -> + ammo_group |> AmmoGroup.update_changeset(ammo_group_params) + end changeset = case changeset |> Changeset.apply_action(changeset_action) do diff --git a/priv/gettext/de/LC_MESSAGES/errors.po b/priv/gettext/de/LC_MESSAGES/errors.po index 7a3b94db..0289b9b1 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/shot_group.ex:102 +#: lib/cannery/activity_log/shot_group.ex:115 msgid "Count must be at least 1" msgstr "Anzahl muss mindestens 1 sein" #, elixir-autogen, elixir-format -#: lib/cannery/activity_log/shot_group.ex:61 -#: lib/cannery/activity_log/shot_group.ex:98 +#: lib/cannery/activity_log/shot_group.ex:74 +#: lib/cannery/activity_log/shot_group.ex:111 msgid "Count must be less than %{count}" msgstr "Anzahl muss weniger als %{count} betragen" @@ -176,13 +176,28 @@ msgid "Tag could not be removed" msgstr "Tag konnte nicht gelöscht werden" #, elixir-autogen, elixir-format -#: lib/cannery_web/live/ammo_group_live/form_component.ex:126 +#: lib/cannery_web/live/ammo_group_live/form_component.ex:143 msgid "Could not parse number of copies" msgstr "Konnte die Anzahl der Kopien nicht verstehen" #, elixir-autogen, elixir-format -#: lib/cannery_web/live/ammo_group_live/form_component.ex:111 +#: lib/cannery_web/live/ammo_group_live/form_component.ex:128 msgid "Invalid number of copies, must be between 1 and %{max}. Was %{multiplier}" msgstr "" "Ungültige Nummer an Kopien. Muss zwischen 1 and %{max} liegen. War " "%{multiplier}" + +#, elixir-autogen, elixir-format +#: lib/cannery/ammo.ex:407 +msgid "Invalid multiplier" +msgstr "" + +#, elixir-autogen, elixir-format +#: lib/cannery/ammo/ammo_group.ex:84 +msgid "Please select an ammo type and container" +msgstr "" + +#, elixir-autogen, elixir-format +#: lib/cannery/activity_log/shot_group.ex:69 +msgid "Please select a valid user and ammo group" +msgstr "" diff --git a/priv/gettext/de/LC_MESSAGES/prompts.po b/priv/gettext/de/LC_MESSAGES/prompts.po index e4ca75a1..82cf45ff 100644 --- a/priv/gettext/de/LC_MESSAGES/prompts.po +++ b/priv/gettext/de/LC_MESSAGES/prompts.po @@ -283,12 +283,12 @@ msgid "Ammo unstaged succesfully" msgstr "Munition erfolgreich demarkiert" #, elixir-autogen, elixir-format, fuzzy -#: lib/cannery_web/live/ammo_group_live/form_component.ex:88 +#: lib/cannery_web/live/ammo_group_live/form_component.ex:105 msgid "Ammo updated successfully" msgstr "Munitionsgruppe erfolgreich aktualisiert" #, elixir-autogen, elixir-format, fuzzy -#: lib/cannery_web/live/ammo_group_live/form_component.ex:147 +#: lib/cannery_web/live/ammo_group_live/form_component.ex:164 msgid "Ammo added successfully" msgid_plural "Ammo added successfully" msgstr[0] "Munitionsgruppe erfolgreich aktualisiert" diff --git a/priv/gettext/en/LC_MESSAGES/errors.po b/priv/gettext/en/LC_MESSAGES/errors.po index d303a0f8..dfb3bf98 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/shot_group.ex:102 +#: lib/cannery/activity_log/shot_group.ex:115 msgid "Count must be at least 1" msgstr "" #, elixir-autogen, elixir-format -#: lib/cannery/activity_log/shot_group.ex:61 -#: lib/cannery/activity_log/shot_group.ex:98 +#: lib/cannery/activity_log/shot_group.ex:74 +#: lib/cannery/activity_log/shot_group.ex:111 msgid "Count must be less than %{count}" msgstr "" @@ -161,11 +161,26 @@ msgid "Tag could not be removed" msgstr "" #, elixir-autogen, elixir-format -#: lib/cannery_web/live/ammo_group_live/form_component.ex:126 +#: lib/cannery_web/live/ammo_group_live/form_component.ex:143 msgid "Could not parse number of copies" msgstr "" #, elixir-autogen, elixir-format -#: lib/cannery_web/live/ammo_group_live/form_component.ex:111 +#: lib/cannery_web/live/ammo_group_live/form_component.ex:128 msgid "Invalid number of copies, must be between 1 and %{max}. Was %{multiplier}" msgstr "" + +#, elixir-autogen, elixir-format +#: lib/cannery/ammo.ex:407 +msgid "Invalid multiplier" +msgstr "" + +#, elixir-autogen, elixir-format +#: lib/cannery/ammo/ammo_group.ex:84 +msgid "Please select an ammo type and container" +msgstr "" + +#, elixir-autogen, elixir-format +#: lib/cannery/activity_log/shot_group.ex:69 +msgid "Please select a valid user and ammo group" +msgstr "" diff --git a/priv/gettext/en/LC_MESSAGES/prompts.po b/priv/gettext/en/LC_MESSAGES/prompts.po index ce081eaf..19aac89f 100644 --- a/priv/gettext/en/LC_MESSAGES/prompts.po +++ b/priv/gettext/en/LC_MESSAGES/prompts.po @@ -263,12 +263,12 @@ msgid "Ammo unstaged succesfully" msgstr "" #, elixir-autogen, elixir-format, fuzzy -#: lib/cannery_web/live/ammo_group_live/form_component.ex:88 +#: lib/cannery_web/live/ammo_group_live/form_component.ex:105 msgid "Ammo updated successfully" msgstr "" #, elixir-autogen, elixir-format, fuzzy -#: lib/cannery_web/live/ammo_group_live/form_component.ex:147 +#: lib/cannery_web/live/ammo_group_live/form_component.ex:164 msgid "Ammo added successfully" msgid_plural "Ammo added successfully" msgstr[0] "" diff --git a/priv/gettext/errors.pot b/priv/gettext/errors.pot index 6b3a9220..e2d2ce8c 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/shot_group.ex:102 +#: lib/cannery/activity_log/shot_group.ex:115 msgid "Count must be at least 1" msgstr "" #, elixir-autogen, elixir-format -#: lib/cannery/activity_log/shot_group.ex:61 -#: lib/cannery/activity_log/shot_group.ex:98 +#: lib/cannery/activity_log/shot_group.ex:74 +#: lib/cannery/activity_log/shot_group.ex:111 msgid "Count must be less than %{count}" msgstr "" @@ -160,11 +160,26 @@ msgid "Tag could not be removed" msgstr "" #, elixir-autogen, elixir-format -#: lib/cannery_web/live/ammo_group_live/form_component.ex:126 +#: lib/cannery_web/live/ammo_group_live/form_component.ex:143 msgid "Could not parse number of copies" msgstr "" #, elixir-autogen, elixir-format -#: lib/cannery_web/live/ammo_group_live/form_component.ex:111 +#: lib/cannery_web/live/ammo_group_live/form_component.ex:128 msgid "Invalid number of copies, must be between 1 and %{max}. Was %{multiplier}" msgstr "" + +#, elixir-autogen, elixir-format +#: lib/cannery/ammo.ex:407 +msgid "Invalid multiplier" +msgstr "" + +#, elixir-autogen, elixir-format +#: lib/cannery/ammo/ammo_group.ex:84 +msgid "Please select an ammo type and container" +msgstr "" + +#, elixir-autogen, elixir-format +#: lib/cannery/activity_log/shot_group.ex:69 +msgid "Please select a valid user and ammo group" +msgstr "" diff --git a/priv/gettext/es/LC_MESSAGES/errors.po b/priv/gettext/es/LC_MESSAGES/errors.po index aac64614..d1a1f113 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/shot_group.ex:102 +#: lib/cannery/activity_log/shot_group.ex:115 msgid "Count must be at least 1" msgstr "" #, elixir-autogen, elixir-format -#: lib/cannery/activity_log/shot_group.ex:61 -#: lib/cannery/activity_log/shot_group.ex:98 +#: lib/cannery/activity_log/shot_group.ex:74 +#: lib/cannery/activity_log/shot_group.ex:111 msgid "Count must be less than %{count}" msgstr "" @@ -171,11 +171,26 @@ msgid "Tag could not be removed" msgstr "" #, elixir-autogen, elixir-format -#: lib/cannery_web/live/ammo_group_live/form_component.ex:126 +#: lib/cannery_web/live/ammo_group_live/form_component.ex:143 msgid "Could not parse number of copies" msgstr "" #, elixir-autogen, elixir-format -#: lib/cannery_web/live/ammo_group_live/form_component.ex:111 +#: lib/cannery_web/live/ammo_group_live/form_component.ex:128 msgid "Invalid number of copies, must be between 1 and %{max}. Was %{multiplier}" msgstr "" + +#, elixir-autogen, elixir-format +#: lib/cannery/ammo.ex:407 +msgid "Invalid multiplier" +msgstr "" + +#, elixir-autogen, elixir-format +#: lib/cannery/ammo/ammo_group.ex:84 +msgid "Please select an ammo type and container" +msgstr "" + +#, elixir-autogen, elixir-format +#: lib/cannery/activity_log/shot_group.ex:69 +msgid "Please select a valid user and ammo group" +msgstr "" diff --git a/priv/gettext/es/LC_MESSAGES/prompts.po b/priv/gettext/es/LC_MESSAGES/prompts.po index 095eda84..1504ad36 100644 --- a/priv/gettext/es/LC_MESSAGES/prompts.po +++ b/priv/gettext/es/LC_MESSAGES/prompts.po @@ -273,12 +273,12 @@ msgid "Ammo unstaged succesfully" msgstr "" #, elixir-autogen, elixir-format, fuzzy -#: lib/cannery_web/live/ammo_group_live/form_component.ex:88 +#: lib/cannery_web/live/ammo_group_live/form_component.ex:105 msgid "Ammo updated successfully" msgstr "" #, elixir-autogen, elixir-format, fuzzy -#: lib/cannery_web/live/ammo_group_live/form_component.ex:147 +#: lib/cannery_web/live/ammo_group_live/form_component.ex:164 msgid "Ammo added successfully" msgid_plural "Ammo added successfully" msgstr[0] "" diff --git a/priv/gettext/fr/LC_MESSAGES/errors.po b/priv/gettext/fr/LC_MESSAGES/errors.po index 013a47f7..d391effe 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/shot_group.ex:102 +#: lib/cannery/activity_log/shot_group.ex:115 msgid "Count must be at least 1" msgstr "Le nombre doit être au moins égal à 1" #, elixir-autogen, elixir-format -#: lib/cannery/activity_log/shot_group.ex:61 -#: lib/cannery/activity_log/shot_group.ex:98 +#: lib/cannery/activity_log/shot_group.ex:74 +#: lib/cannery/activity_log/shot_group.ex:111 msgid "Count must be less than %{count}" msgstr "La quantité doit être inférieur à %{count}" @@ -177,11 +177,26 @@ msgid "Tag could not be removed" msgstr "Le tag n’a pas pu être retiré" #, elixir-autogen, elixir-format -#: lib/cannery_web/live/ammo_group_live/form_component.ex:126 +#: lib/cannery_web/live/ammo_group_live/form_component.ex:143 msgid "Could not parse number of copies" msgstr "Impossible d'analyser le nombre de copies" #, elixir-autogen, elixir-format -#: lib/cannery_web/live/ammo_group_live/form_component.ex:111 +#: lib/cannery_web/live/ammo_group_live/form_component.ex:128 msgid "Invalid number of copies, must be between 1 and %{max}. Was %{multiplier}" msgstr "Nombre de copies invalide, doit être 1 et %{max}. Été %{multiplier}" + +#, elixir-autogen, elixir-format +#: lib/cannery/ammo.ex:407 +msgid "Invalid multiplier" +msgstr "" + +#, elixir-autogen, elixir-format +#: lib/cannery/ammo/ammo_group.ex:84 +msgid "Please select an ammo type and container" +msgstr "" + +#, elixir-autogen, elixir-format +#: lib/cannery/activity_log/shot_group.ex:69 +msgid "Please select a valid user and ammo group" +msgstr "" diff --git a/priv/gettext/fr/LC_MESSAGES/prompts.po b/priv/gettext/fr/LC_MESSAGES/prompts.po index 0328cab1..3f5aae11 100644 --- a/priv/gettext/fr/LC_MESSAGES/prompts.po +++ b/priv/gettext/fr/LC_MESSAGES/prompts.po @@ -284,12 +284,12 @@ msgid "Ammo unstaged succesfully" msgstr "Groupe de munition désélectionner avec succès" #, elixir-autogen, elixir-format, fuzzy -#: lib/cannery_web/live/ammo_group_live/form_component.ex:88 +#: lib/cannery_web/live/ammo_group_live/form_component.ex:105 msgid "Ammo updated successfully" msgstr "Groupe de munition mis à jour avec succès" #, elixir-autogen, elixir-format, fuzzy -#: lib/cannery_web/live/ammo_group_live/form_component.ex:147 +#: lib/cannery_web/live/ammo_group_live/form_component.ex:164 msgid "Ammo added successfully" msgid_plural "Ammo added successfully" msgstr[0] "Groupe de munition mis à jour avec succès" diff --git a/priv/gettext/prompts.pot b/priv/gettext/prompts.pot index 364f8e42..7981b0a9 100644 --- a/priv/gettext/prompts.pot +++ b/priv/gettext/prompts.pot @@ -262,12 +262,12 @@ msgid "Ammo unstaged succesfully" msgstr "" #, elixir-autogen, elixir-format -#: lib/cannery_web/live/ammo_group_live/form_component.ex:88 +#: lib/cannery_web/live/ammo_group_live/form_component.ex:105 msgid "Ammo updated successfully" msgstr "" #, elixir-autogen, elixir-format -#: lib/cannery_web/live/ammo_group_live/form_component.ex:147 +#: lib/cannery_web/live/ammo_group_live/form_component.ex:164 msgid "Ammo added successfully" msgid_plural "Ammo added successfully" msgstr[0] "" diff --git a/test/cannery/ammo_test.exs b/test/cannery/ammo_test.exs index 2ae4e6ec..317c5a57 100644 --- a/test/cannery/ammo_test.exs +++ b/test/cannery/ammo_test.exs @@ -180,9 +180,5 @@ defmodule Cannery.AmmoTest do Ammo.get_ammo_group!(ammo_group.id, current_user) end end - - test "change_ammo_group/1 returns a ammo_group changeset", %{ammo_group: ammo_group} do - assert %Changeset{} = Ammo.change_ammo_group(ammo_group) - end end end