Compare commits
	
		
			3 Commits
		
	
	
		
			0.9.0
			...
			0cae7c2940
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 0cae7c2940 | |||
| 1e645b5bb8 | |||
| bab2b26c13 | 
| @@ -1,3 +1,7 @@ | |||||||
|  | # v0.9.1 | ||||||
|  | - Rename ammo_type's type to class to avoid confusion | ||||||
|  | - Code quality improvements | ||||||
|  |  | ||||||
| # v0.9.0 | # v0.9.0 | ||||||
| - Add length limits to all string fields | - Add length limits to all string fields | ||||||
| - Add selectable ammo types | - Add selectable ammo types | ||||||
|   | |||||||
| @@ -45,7 +45,7 @@ module.exports = (env, options) => { | |||||||
|         { |         { | ||||||
|           test: /\.(woff(2)?|ttf|eot|svg|otf)(\?v=[0-9]\.[0-9]\.[0-9])?$/, |           test: /\.(woff(2)?|ttf|eot|svg|otf)(\?v=[0-9]\.[0-9]\.[0-9])?$/, | ||||||
|           type: 'asset/resource', |           type: 'asset/resource', | ||||||
|           generator: { filename: 'fonts/[name][ext]' } |           generator: { filename: 'fonts/[name].[ext]' } | ||||||
|         } |         } | ||||||
|       ] |       ] | ||||||
|     }, |     }, | ||||||
|   | |||||||
| @@ -23,8 +23,8 @@ defmodule Cannery.ActivityLog do | |||||||
|       [%ShotGroup{notes: "Shot some rifle rounds"}, ...] |       [%ShotGroup{notes: "Shot some rifle rounds"}, ...] | ||||||
|  |  | ||||||
|   """ |   """ | ||||||
|   @spec list_shot_groups(AmmoType.type() | :all, User.t()) :: [ShotGroup.t()] |   @spec list_shot_groups(AmmoType.class() | :all, User.t()) :: [ShotGroup.t()] | ||||||
|   @spec list_shot_groups(search :: nil | String.t(), AmmoType.type() | :all, User.t()) :: |   @spec list_shot_groups(search :: nil | String.t(), AmmoType.class() | :all, User.t()) :: | ||||||
|           [ShotGroup.t()] |           [ShotGroup.t()] | ||||||
|   def list_shot_groups(search \\ nil, type, %{id: user_id}) do |   def list_shot_groups(search \\ nil, type, %{id: user_id}) do | ||||||
|     from(sg in ShotGroup, |     from(sg in ShotGroup, | ||||||
| @@ -79,16 +79,16 @@ defmodule Cannery.ActivityLog do | |||||||
|     }) |     }) | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   @spec list_shot_groups_filter_type(Queryable.t(), AmmoType.type() | :all) :: |   @spec list_shot_groups_filter_type(Queryable.t(), AmmoType.class() | :all) :: | ||||||
|           Queryable.t() |           Queryable.t() | ||||||
|   defp list_shot_groups_filter_type(query, :rifle), |   defp list_shot_groups_filter_type(query, :rifle), | ||||||
|     do: query |> where([at: at], at.type == :rifle) |     do: query |> where([at: at], at.class == :rifle) | ||||||
|  |  | ||||||
|   defp list_shot_groups_filter_type(query, :pistol), |   defp list_shot_groups_filter_type(query, :pistol), | ||||||
|     do: query |> where([at: at], at.type == :pistol) |     do: query |> where([at: at], at.class == :pistol) | ||||||
|  |  | ||||||
|   defp list_shot_groups_filter_type(query, :shotgun), |   defp list_shot_groups_filter_type(query, :shotgun), | ||||||
|     do: query |> where([at: at], at.type == :shotgun) |     do: query |> where([at: at], at.class == :shotgun) | ||||||
|  |  | ||||||
|   defp list_shot_groups_filter_type(query, _all), do: query |   defp list_shot_groups_filter_type(query, _all), do: query | ||||||
|  |  | ||||||
|   | |||||||
| @@ -24,11 +24,11 @@ defmodule Cannery.Ammo do | |||||||
|       [%AmmoType{}, ...] |       [%AmmoType{}, ...] | ||||||
|  |  | ||||||
|       iex> list_ammo_types("cool", %User{id: 123}, :shotgun) |       iex> list_ammo_types("cool", %User{id: 123}, :shotgun) | ||||||
|       [%AmmoType{name: "My cool ammo type", type: :shotgun}, ...] |       [%AmmoType{name: "My cool ammo type", class: :shotgun}, ...] | ||||||
|  |  | ||||||
|   """ |   """ | ||||||
|   @spec list_ammo_types(User.t(), AmmoType.type() | :all) :: [AmmoType.t()] |   @spec list_ammo_types(User.t(), AmmoType.class() | :all) :: [AmmoType.t()] | ||||||
|   @spec list_ammo_types(search :: nil | String.t(), User.t(), AmmoType.type() | :all) :: |   @spec list_ammo_types(search :: nil | String.t(), User.t(), AmmoType.class() | :all) :: | ||||||
|           [AmmoType.t()] |           [AmmoType.t()] | ||||||
|   def list_ammo_types(search \\ nil, user, type) |   def list_ammo_types(search \\ nil, user, type) | ||||||
|  |  | ||||||
| @@ -72,14 +72,15 @@ defmodule Cannery.Ammo do | |||||||
|     ) |     ) | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   @spec list_ammo_types_filter_type(Queryable.t(), AmmoType.type() | :all) :: Queryable.t() |   @spec list_ammo_types_filter_type(Queryable.t(), AmmoType.class() | :all) :: Queryable.t() | ||||||
|   defp list_ammo_types_filter_type(query, :rifle), do: query |> where([at: at], at.type == :rifle) |   defp list_ammo_types_filter_type(query, :rifle), | ||||||
|  |     do: query |> where([at: at], at.class == :rifle) | ||||||
|  |  | ||||||
|   defp list_ammo_types_filter_type(query, :pistol), |   defp list_ammo_types_filter_type(query, :pistol), | ||||||
|     do: query |> where([at: at], at.type == :pistol) |     do: query |> where([at: at], at.class == :pistol) | ||||||
|  |  | ||||||
|   defp list_ammo_types_filter_type(query, :shotgun), |   defp list_ammo_types_filter_type(query, :shotgun), | ||||||
|     do: query |> where([at: at], at.type == :shotgun) |     do: query |> where([at: at], at.class == :shotgun) | ||||||
|  |  | ||||||
|   defp list_ammo_types_filter_type(query, _all), do: query |   defp list_ammo_types_filter_type(query, _all), do: query | ||||||
|  |  | ||||||
| @@ -463,16 +464,16 @@ defmodule Cannery.Ammo do | |||||||
|     |> Repo.all() |     |> Repo.all() | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   @spec list_ammo_groups_for_container_filter_type(Queryable.t(), AmmoType.type() | :all) :: |   @spec list_ammo_groups_for_container_filter_type(Queryable.t(), AmmoType.class() | :all) :: | ||||||
|           Queryable.t() |           Queryable.t() | ||||||
|   defp list_ammo_groups_for_container_filter_type(query, :rifle), |   defp list_ammo_groups_for_container_filter_type(query, :rifle), | ||||||
|     do: query |> where([at: at], at.type == :rifle) |     do: query |> where([at: at], at.class == :rifle) | ||||||
|  |  | ||||||
|   defp list_ammo_groups_for_container_filter_type(query, :pistol), |   defp list_ammo_groups_for_container_filter_type(query, :pistol), | ||||||
|     do: query |> where([at: at], at.type == :pistol) |     do: query |> where([at: at], at.class == :pistol) | ||||||
|  |  | ||||||
|   defp list_ammo_groups_for_container_filter_type(query, :shotgun), |   defp list_ammo_groups_for_container_filter_type(query, :shotgun), | ||||||
|     do: query |> where([at: at], at.type == :shotgun) |     do: query |> where([at: at], at.class == :shotgun) | ||||||
|  |  | ||||||
|   defp list_ammo_groups_for_container_filter_type(query, _all), do: query |   defp list_ammo_groups_for_container_filter_type(query, _all), do: query | ||||||
|  |  | ||||||
| @@ -747,11 +748,11 @@ defmodule Cannery.Ammo do | |||||||
|       [%AmmoGroup{notes: "My cool ammo group"}, ...] |       [%AmmoGroup{notes: "My cool ammo group"}, ...] | ||||||
|  |  | ||||||
|   """ |   """ | ||||||
|   @spec list_ammo_groups(search :: String.t() | nil, AmmoType.type() | :all, User.t()) :: |   @spec list_ammo_groups(search :: String.t() | nil, AmmoType.class() | :all, User.t()) :: | ||||||
|           [AmmoGroup.t()] |           [AmmoGroup.t()] | ||||||
|   @spec list_ammo_groups( |   @spec list_ammo_groups( | ||||||
|           search :: nil | String.t(), |           search :: nil | String.t(), | ||||||
|           AmmoType.type() | :all, |           AmmoType.class() | :all, | ||||||
|           User.t(), |           User.t(), | ||||||
|           show_used :: boolean() |           show_used :: boolean() | ||||||
|         ) :: [AmmoGroup.t()] |         ) :: [AmmoGroup.t()] | ||||||
| @@ -780,15 +781,15 @@ defmodule Cannery.Ammo do | |||||||
|     |> Repo.all() |     |> Repo.all() | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   @spec list_ammo_groups_filter_on_type(Queryable.t(), AmmoType.type() | :all) :: Queryable.t() |   @spec list_ammo_groups_filter_on_type(Queryable.t(), AmmoType.class() | :all) :: Queryable.t() | ||||||
|   defp list_ammo_groups_filter_on_type(query, :rifle), |   defp list_ammo_groups_filter_on_type(query, :rifle), | ||||||
|     do: query |> where([at: at], at.type == :rifle) |     do: query |> where([at: at], at.class == :rifle) | ||||||
|  |  | ||||||
|   defp list_ammo_groups_filter_on_type(query, :pistol), |   defp list_ammo_groups_filter_on_type(query, :pistol), | ||||||
|     do: query |> where([at: at], at.type == :pistol) |     do: query |> where([at: at], at.class == :pistol) | ||||||
|  |  | ||||||
|   defp list_ammo_groups_filter_on_type(query, :shotgun), |   defp list_ammo_groups_filter_on_type(query, :shotgun), | ||||||
|     do: query |> where([at: at], at.type == :shotgun) |     do: query |> where([at: at], at.class == :shotgun) | ||||||
|  |  | ||||||
|   defp list_ammo_groups_filter_on_type(query, _all), do: query |   defp list_ammo_groups_filter_on_type(query, _all), do: query | ||||||
|  |  | ||||||
| @@ -1055,13 +1056,21 @@ defmodule Cannery.Ammo do | |||||||
|   @spec create_ammo_groups(attrs :: map(), multiplier :: non_neg_integer(), User.t()) :: |   @spec create_ammo_groups(attrs :: map(), multiplier :: non_neg_integer(), User.t()) :: | ||||||
|           {:ok, {count :: non_neg_integer(), [AmmoGroup.t()] | nil}} |           {:ok, {count :: non_neg_integer(), [AmmoGroup.t()] | nil}} | ||||||
|           | {:error, AmmoGroup.changeset()} |           | {:error, AmmoGroup.changeset()} | ||||||
|   def create_ammo_groups( |   def create_ammo_groups(attrs, multiplier, %User{} = user) do | ||||||
|  |     attrs | ||||||
|  |     |> Map.new(fn {k, v} -> {to_string(k), v} end) | ||||||
|  |     |> do_create_ammo_groups(multiplier, user) | ||||||
|  |   end | ||||||
|  |  | ||||||
|  |   defp do_create_ammo_groups( | ||||||
|          %{"ammo_type_id" => ammo_type_id, "container_id" => container_id} = attrs, |          %{"ammo_type_id" => ammo_type_id, "container_id" => container_id} = attrs, | ||||||
|          multiplier, |          multiplier, | ||||||
|         %User{} = user |          user | ||||||
|        ) |        ) | ||||||
|       when multiplier >= 1 and multiplier <= @ammo_group_create_limit and |        when multiplier >= 1 and | ||||||
|              not (ammo_type_id |> is_nil()) and not (container_id |> is_nil()) do |               multiplier <= @ammo_group_create_limit and | ||||||
|  |               ammo_type_id |> is_binary() and | ||||||
|  |               container_id |> is_binary() do | ||||||
|     now = NaiveDateTime.utc_now() |> NaiveDateTime.truncate(:second) |     now = NaiveDateTime.utc_now() |> NaiveDateTime.truncate(:second) | ||||||
|  |  | ||||||
|     changesets = |     changesets = | ||||||
| @@ -1097,7 +1106,7 @@ defmodule Cannery.Ammo do | |||||||
|     end |     end | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   def create_ammo_groups( |   defp do_create_ammo_groups( | ||||||
|          %{"ammo_type_id" => ammo_type_id, "container_id" => container_id} = attrs, |          %{"ammo_type_id" => ammo_type_id, "container_id" => container_id} = attrs, | ||||||
|          _multiplier, |          _multiplier, | ||||||
|          user |          user | ||||||
| @@ -1116,7 +1125,7 @@ defmodule Cannery.Ammo do | |||||||
|     {:error, changeset} |     {:error, changeset} | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   def create_ammo_groups(invalid_attrs, _multiplier, user) do |   defp do_create_ammo_groups(invalid_attrs, _multiplier, user) do | ||||||
|     {:error, %AmmoGroup{} |> AmmoGroup.create_changeset(nil, nil, user, invalid_attrs)} |     {:error, %AmmoGroup{} |> AmmoGroup.create_changeset(nil, nil, user, invalid_attrs)} | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   | |||||||
| @@ -42,7 +42,7 @@ defmodule Cannery.Ammo.AmmoType do | |||||||
|     field :name, :string |     field :name, :string | ||||||
|     field :desc, :string |     field :desc, :string | ||||||
|  |  | ||||||
|     field :type, Ecto.Enum, values: [:rifle, :shotgun, :pistol] |     field :class, Ecto.Enum, values: [:rifle, :shotgun, :pistol] | ||||||
|  |  | ||||||
|     # common fields |     # common fields | ||||||
|     # https://shootersreference.com/reloadingdata/bullet_abbreviations/ |     # https://shootersreference.com/reloadingdata/bullet_abbreviations/ | ||||||
| @@ -92,7 +92,7 @@ defmodule Cannery.Ammo.AmmoType do | |||||||
|           id: id(), |           id: id(), | ||||||
|           name: String.t(), |           name: String.t(), | ||||||
|           desc: String.t() | nil, |           desc: String.t() | nil, | ||||||
|           type: type(), |           class: class(), | ||||||
|           bullet_type: String.t() | nil, |           bullet_type: String.t() | nil, | ||||||
|           bullet_core: String.t() | nil, |           bullet_core: String.t() | nil, | ||||||
|           cartridge: String.t() | nil, |           cartridge: String.t() | nil, | ||||||
| @@ -130,14 +130,14 @@ defmodule Cannery.Ammo.AmmoType do | |||||||
|   @type new_ammo_type :: %__MODULE__{} |   @type new_ammo_type :: %__MODULE__{} | ||||||
|   @type id :: UUID.t() |   @type id :: UUID.t() | ||||||
|   @type changeset :: Changeset.t(t() | new_ammo_type()) |   @type changeset :: Changeset.t(t() | new_ammo_type()) | ||||||
|   @type type :: :rifle | :shotgun | :pistol | nil |   @type class :: :rifle | :shotgun | :pistol | nil | ||||||
|  |  | ||||||
|   @spec changeset_fields() :: [atom()] |   @spec changeset_fields() :: [atom()] | ||||||
|   defp changeset_fields, |   defp changeset_fields, | ||||||
|     do: [ |     do: [ | ||||||
|       :name, |       :name, | ||||||
|       :desc, |       :desc, | ||||||
|       :type, |       :class, | ||||||
|       :bullet_type, |       :bullet_type, | ||||||
|       :bullet_core, |       :bullet_core, | ||||||
|       :cartridge, |       :cartridge, | ||||||
|   | |||||||
| @@ -13,7 +13,7 @@ defmodule CanneryWeb.Components.AmmoTypeTableComponent do | |||||||
|           %{ |           %{ | ||||||
|             required(:id) => UUID.t(), |             required(:id) => UUID.t(), | ||||||
|             required(:current_user) => User.t(), |             required(:current_user) => User.t(), | ||||||
|             optional(:type) => AmmoType.type() | nil, |             optional(:class) => AmmoType.class() | nil, | ||||||
|             optional(:show_used) => boolean(), |             optional(:show_used) => boolean(), | ||||||
|             optional(:ammo_types) => [AmmoType.t()], |             optional(:ammo_types) => [AmmoType.t()], | ||||||
|             optional(:actions) => Rendered.t(), |             optional(:actions) => Rendered.t(), | ||||||
| @@ -26,7 +26,7 @@ defmodule CanneryWeb.Components.AmmoTypeTableComponent do | |||||||
|       socket |       socket | ||||||
|       |> assign(assigns) |       |> assign(assigns) | ||||||
|       |> assign_new(:show_used, fn -> false end) |       |> assign_new(:show_used, fn -> false end) | ||||||
|       |> assign_new(:type, fn -> :all end) |       |> assign_new(:class, fn -> :all end) | ||||||
|       |> assign_new(:actions, fn -> [] end) |       |> assign_new(:actions, fn -> [] end) | ||||||
|       |> display_ammo_types() |       |> display_ammo_types() | ||||||
|  |  | ||||||
| @@ -39,7 +39,7 @@ defmodule CanneryWeb.Components.AmmoTypeTableComponent do | |||||||
|              ammo_types: ammo_types, |              ammo_types: ammo_types, | ||||||
|              current_user: current_user, |              current_user: current_user, | ||||||
|              show_used: show_used, |              show_used: show_used, | ||||||
|              type: type, |              class: class, | ||||||
|              actions: actions |              actions: actions | ||||||
|            } |            } | ||||||
|          } = socket |          } = socket | ||||||
| @@ -48,7 +48,7 @@ defmodule CanneryWeb.Components.AmmoTypeTableComponent do | |||||||
|       [ |       [ | ||||||
|         %{label: gettext("Cartridge"), key: :cartridge, type: :string}, |         %{label: gettext("Cartridge"), key: :cartridge, type: :string}, | ||||||
|         %{ |         %{ | ||||||
|           label: if(type == :shotgun, do: gettext("Gauge"), else: gettext("Caliber")), |           label: if(class == :shotgun, do: gettext("Gauge"), else: gettext("Caliber")), | ||||||
|           key: :caliber, |           key: :caliber, | ||||||
|           type: :string |           type: :string | ||||||
|         }, |         }, | ||||||
| @@ -59,7 +59,7 @@ defmodule CanneryWeb.Components.AmmoTypeTableComponent do | |||||||
|         %{label: gettext("Grains"), key: :grains, type: :string}, |         %{label: gettext("Grains"), key: :grains, type: :string}, | ||||||
|         %{label: gettext("Bullet type"), key: :bullet_type, type: :string}, |         %{label: gettext("Bullet type"), key: :bullet_type, type: :string}, | ||||||
|         %{ |         %{ | ||||||
|           label: if(type == :shotgun, do: gettext("Slug core"), else: gettext("Bullet core")), |           label: if(class == :shotgun, do: gettext("Slug core"), else: gettext("Bullet core")), | ||||||
|           key: :bullet_core, |           key: :bullet_core, | ||||||
|           type: :string |           type: :string | ||||||
|         }, |         }, | ||||||
| @@ -147,8 +147,8 @@ defmodule CanneryWeb.Components.AmmoTypeTableComponent do | |||||||
|       }) |       }) | ||||||
|       |> TableComponent.maybe_compose_columns(filtered_columns) |       |> TableComponent.maybe_compose_columns(filtered_columns) | ||||||
|       |> TableComponent.maybe_compose_columns( |       |> TableComponent.maybe_compose_columns( | ||||||
|         %{label: gettext("Type"), key: :type, type: :atom}, |         %{label: gettext("Class"), key: :type, type: :atom}, | ||||||
|         type in [:all, nil] |         class in [:all, nil] | ||||||
|       ) |       ) | ||||||
|       |> TableComponent.maybe_compose_columns(%{label: gettext("Name"), key: :name, type: :name}) |       |> TableComponent.maybe_compose_columns(%{label: gettext("Name"), key: :name, type: :name}) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -8,11 +8,16 @@ defmodule CanneryWeb.AmmoGroupLive.Index do | |||||||
|  |  | ||||||
|   @impl true |   @impl true | ||||||
|   def mount(%{"search" => search}, _session, socket) do |   def mount(%{"search" => search}, _session, socket) do | ||||||
|     {:ok, socket |> assign(type: :all, show_used: false, search: search) |> display_ammo_groups()} |     socket = | ||||||
|  |       socket | ||||||
|  |       |> assign(class: :all, show_used: false, search: search) | ||||||
|  |       |> display_ammo_groups() | ||||||
|  |  | ||||||
|  |     {:ok, socket} | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   def mount(_params, _session, socket) do |   def mount(_params, _session, socket) do | ||||||
|     {:ok, socket |> assign(type: :all, show_used: false, search: nil) |> display_ammo_groups()} |     {:ok, socket |> assign(class: :all, show_used: false, search: nil) |> display_ammo_groups()} | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   @impl true |   @impl true | ||||||
| @@ -119,26 +124,26 @@ defmodule CanneryWeb.AmmoGroupLive.Index do | |||||||
|     {:noreply, socket} |     {:noreply, socket} | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   def handle_event("change_type", %{"ammo_type" => %{"type" => "rifle"}}, socket) do |   def handle_event("change_class", %{"ammo_type" => %{"class" => "rifle"}}, socket) do | ||||||
|     {:noreply, socket |> assign(:type, :rifle) |> display_ammo_groups()} |     {:noreply, socket |> assign(:class, :rifle) |> display_ammo_groups()} | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   def handle_event("change_type", %{"ammo_type" => %{"type" => "shotgun"}}, socket) do |   def handle_event("change_class", %{"ammo_type" => %{"class" => "shotgun"}}, socket) do | ||||||
|     {:noreply, socket |> assign(:type, :shotgun) |> display_ammo_groups()} |     {:noreply, socket |> assign(:class, :shotgun) |> display_ammo_groups()} | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   def handle_event("change_type", %{"ammo_type" => %{"type" => "pistol"}}, socket) do |   def handle_event("change_class", %{"ammo_type" => %{"class" => "pistol"}}, socket) do | ||||||
|     {:noreply, socket |> assign(:type, :pistol) |> display_ammo_groups()} |     {:noreply, socket |> assign(:class, :pistol) |> display_ammo_groups()} | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   def handle_event("change_type", %{"ammo_type" => %{"type" => _all}}, socket) do |   def handle_event("change_class", %{"ammo_type" => %{"class" => _all}}, socket) do | ||||||
|     {:noreply, socket |> assign(:type, :all) |> display_ammo_groups()} |     {:noreply, socket |> assign(:class, :all) |> display_ammo_groups()} | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   defp display_ammo_groups( |   defp display_ammo_groups( | ||||||
|          %{ |          %{ | ||||||
|            assigns: %{ |            assigns: %{ | ||||||
|              type: type, |              class: class, | ||||||
|              search: search, |              search: search, | ||||||
|              current_user: current_user, |              current_user: current_user, | ||||||
|              show_used: show_used |              show_used: show_used | ||||||
| @@ -148,7 +153,7 @@ defmodule CanneryWeb.AmmoGroupLive.Index do | |||||||
|     # get total number of ammo groups to determine whether to display onboarding |     # get total number of ammo groups to determine whether to display onboarding | ||||||
|     # prompts |     # prompts | ||||||
|     ammo_groups_count = Ammo.get_ammo_groups_count!(current_user, true) |     ammo_groups_count = Ammo.get_ammo_groups_count!(current_user, true) | ||||||
|     ammo_groups = Ammo.list_ammo_groups(search, type, current_user, show_used) |     ammo_groups = Ammo.list_ammo_groups(search, class, current_user, show_used) | ||||||
|     ammo_types_count = Ammo.get_ammo_types_count!(current_user) |     ammo_types_count = Ammo.get_ammo_types_count!(current_user) | ||||||
|     containers_count = Containers.get_containers_count!(current_user) |     containers_count = Containers.get_containers_count!(current_user) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -43,15 +43,17 @@ | |||||||
|           :let={f} |           :let={f} | ||||||
|           for={%{}} |           for={%{}} | ||||||
|           as={:ammo_type} |           as={:ammo_type} | ||||||
|           phx-change="change_type" |           phx-change="change_class" | ||||||
|           phx-submit="change_type" |           phx-submit="change_class" | ||||||
|           class="flex items-center" |           class="flex items-center" | ||||||
|         > |         > | ||||||
|           <%= label(f, :type, gettext("Type"), class: "title text-primary-600 text-lg text-center") %> |           <%= label(f, :class, gettext("Class"), | ||||||
|  |             class: "title text-primary-600 text-lg text-center" | ||||||
|  |           ) %> | ||||||
|  |  | ||||||
|           <%= select( |           <%= select( | ||||||
|             f, |             f, | ||||||
|             :type, |             :class, | ||||||
|             [ |             [ | ||||||
|               {gettext("All"), :all}, |               {gettext("All"), :all}, | ||||||
|               {gettext("Rifle"), :rifle}, |               {gettext("Rifle"), :rifle}, | ||||||
| @@ -59,7 +61,7 @@ | |||||||
|               {gettext("Pistol"), :pistol} |               {gettext("Pistol"), :pistol} | ||||||
|             ], |             ], | ||||||
|             class: "mx-2 my-1 min-w-md input input-primary", |             class: "mx-2 my-1 min-w-md input input-primary", | ||||||
|             value: @type |             value: @class | ||||||
|           ) %> |           ) %> | ||||||
|         </.form> |         </.form> | ||||||
|  |  | ||||||
|   | |||||||
| @@ -18,15 +18,15 @@ | |||||||
|       <%= dgettext("errors", "Oops, something went wrong! Please check the errors below.") %> |       <%= dgettext("errors", "Oops, something went wrong! Please check the errors below.") %> | ||||||
|     </div> |     </div> | ||||||
|  |  | ||||||
|     <%= label(f, :type, gettext("Type"), class: "title text-lg text-primary-600") %> |     <%= label(f, :class, gettext("Class"), class: "title text-lg text-primary-600") %> | ||||||
|     <%= select( |     <%= select( | ||||||
|       f, |       f, | ||||||
|       :type, |       :class, | ||||||
|       [{gettext("Rifle"), :rifle}, {gettext("Shotgun"), :shotgun}, {gettext("Pistol"), :pistol}], |       [{gettext("Rifle"), :rifle}, {gettext("Shotgun"), :shotgun}, {gettext("Pistol"), :pistol}], | ||||||
|       class: "text-center col-span-2 input input-primary", |       class: "text-center col-span-2 input input-primary", | ||||||
|       maxlength: 255 |       maxlength: 255 | ||||||
|     ) %> |     ) %> | ||||||
|     <%= error_tag(f, :type, "col-span-3 text-center") %> |     <%= error_tag(f, :class, "col-span-3 text-center") %> | ||||||
|  |  | ||||||
|     <%= label(f, :name, gettext("Name"), class: "title text-lg text-primary-600") %> |     <%= label(f, :name, gettext("Name"), class: "title text-lg text-primary-600") %> | ||||||
|     <%= text_input(f, :name, |     <%= text_input(f, :name, | ||||||
| @@ -48,7 +48,7 @@ | |||||||
|       <%= gettext("Dimensions") %> |       <%= gettext("Dimensions") %> | ||||||
|     </h2> |     </h2> | ||||||
|  |  | ||||||
|     <%= if Changeset.get_field(@changeset, :type) in [:rifle, :pistol] do %> |     <%= if Changeset.get_field(@changeset, :class) in [:rifle, :pistol] do %> | ||||||
|       <%= label(f, :cartridge, gettext("Cartridge"), class: "title text-lg text-primary-600") %> |       <%= label(f, :cartridge, gettext("Cartridge"), class: "title text-lg text-primary-600") %> | ||||||
|       <%= text_input(f, :cartridge, |       <%= text_input(f, :cartridge, | ||||||
|         class: "text-center col-span-2 input input-primary", |         class: "text-center col-span-2 input input-primary", | ||||||
| @@ -63,7 +63,7 @@ | |||||||
|     <%= label( |     <%= label( | ||||||
|       f, |       f, | ||||||
|       :caliber, |       :caliber, | ||||||
|       if(Changeset.get_field(@changeset, :type) == :shotgun, |       if(Changeset.get_field(@changeset, :class) == :shotgun, | ||||||
|         do: gettext("Gauge"), |         do: gettext("Gauge"), | ||||||
|         else: gettext("Caliber") |         else: gettext("Caliber") | ||||||
|       ), |       ), | ||||||
| @@ -76,7 +76,7 @@ | |||||||
|     ) %> |     ) %> | ||||||
|     <%= error_tag(f, :caliber, "col-span-3 text-center") %> |     <%= error_tag(f, :caliber, "col-span-3 text-center") %> | ||||||
|  |  | ||||||
|     <%= if Changeset.get_field(@changeset, :type) == :shotgun do %> |     <%= if Changeset.get_field(@changeset, :class) == :shotgun do %> | ||||||
|       <%= label(f, :unfired_length, gettext("Unfired shell length"), |       <%= label(f, :unfired_length, gettext("Unfired shell length"), | ||||||
|         class: "title text-lg text-primary-600" |         class: "title text-lg text-primary-600" | ||||||
|       ) %> |       ) %> | ||||||
| @@ -139,7 +139,7 @@ | |||||||
|     <%= label( |     <%= label( | ||||||
|       f, |       f, | ||||||
|       :bullet_core, |       :bullet_core, | ||||||
|       if(Changeset.get_field(@changeset, :type) == :shotgun, |       if(Changeset.get_field(@changeset, :class) == :shotgun, | ||||||
|         do: gettext("Slug core"), |         do: gettext("Slug core"), | ||||||
|         else: gettext("Bullet core") |         else: gettext("Bullet core") | ||||||
|       ), |       ), | ||||||
| @@ -152,7 +152,7 @@ | |||||||
|     ) %> |     ) %> | ||||||
|     <%= error_tag(f, :bullet_core, "col-span-3 text-center") %> |     <%= error_tag(f, :bullet_core, "col-span-3 text-center") %> | ||||||
|  |  | ||||||
|     <%= if Changeset.get_field(@changeset, :type) in [:rifle, :pistol] do %> |     <%= if Changeset.get_field(@changeset, :class) in [:rifle, :pistol] do %> | ||||||
|       <%= label(f, :jacket_type, gettext("Jacket type"), class: "title text-lg text-primary-600") %> |       <%= label(f, :jacket_type, gettext("Jacket type"), class: "title text-lg text-primary-600") %> | ||||||
|       <%= text_input(f, :jacket_type, |       <%= text_input(f, :jacket_type, | ||||||
|         class: "text-center col-span-2 input input-primary", |         class: "text-center col-span-2 input input-primary", | ||||||
| @@ -172,7 +172,7 @@ | |||||||
|     ) %> |     ) %> | ||||||
|     <%= error_tag(f, :case_material, "col-span-3 text-center") %> |     <%= error_tag(f, :case_material, "col-span-3 text-center") %> | ||||||
|  |  | ||||||
|     <%= if Changeset.get_field(@changeset, :type) == :shotgun do %> |     <%= if Changeset.get_field(@changeset, :class) == :shotgun do %> | ||||||
|       <%= label(f, :wadding, gettext("Wadding"), class: "title text-lg text-primary-600") %> |       <%= label(f, :wadding, gettext("Wadding"), class: "title text-lg text-primary-600") %> | ||||||
|       <%= text_input(f, :wadding, |       <%= text_input(f, :wadding, | ||||||
|         class: "text-center col-span-2 input input-primary", |         class: "text-center col-span-2 input input-primary", | ||||||
| @@ -240,7 +240,7 @@ | |||||||
|     ) %> |     ) %> | ||||||
|     <%= error_tag(f, :powder_type, "col-span-3 text-center") %> |     <%= error_tag(f, :powder_type, "col-span-3 text-center") %> | ||||||
|  |  | ||||||
|     <%= if Changeset.get_field(@changeset, :type) in [:rifle, :pistol] do %> |     <%= if Changeset.get_field(@changeset, :class) in [:rifle, :pistol] do %> | ||||||
|       <%= label(f, :powder_grains_per_charge, gettext("Powder grains per charge"), |       <%= label(f, :powder_grains_per_charge, gettext("Powder grains per charge"), | ||||||
|         class: "title text-lg text-primary-600" |         class: "title text-lg text-primary-600" | ||||||
|       ) %> |       ) %> | ||||||
| @@ -262,7 +262,7 @@ | |||||||
|     ) %> |     ) %> | ||||||
|     <%= error_tag(f, :pressure, "col-span-3 text-center") %> |     <%= error_tag(f, :pressure, "col-span-3 text-center") %> | ||||||
|  |  | ||||||
|     <%= if Changeset.get_field(@changeset, :type) == :shotgun do %> |     <%= if Changeset.get_field(@changeset, :class) == :shotgun do %> | ||||||
|       <%= label(f, :dram_equivalent, gettext("Dram equivalent"), |       <%= label(f, :dram_equivalent, gettext("Dram equivalent"), | ||||||
|         class: "title text-lg text-primary-600" |         class: "title text-lg text-primary-600" | ||||||
|       ) %> |       ) %> | ||||||
| @@ -275,7 +275,7 @@ | |||||||
|       <%= hidden_input(f, :dram_equivalent, value: nil) %> |       <%= hidden_input(f, :dram_equivalent, value: nil) %> | ||||||
|     <% end %> |     <% end %> | ||||||
|  |  | ||||||
|     <%= if Changeset.get_field(@changeset, :type) in [:rifle, :pistol] do %> |     <%= if Changeset.get_field(@changeset, :class) in [:rifle, :pistol] do %> | ||||||
|       <%= label(f, :muzzle_velocity, gettext("Muzzle velocity"), |       <%= label(f, :muzzle_velocity, gettext("Muzzle velocity"), | ||||||
|         class: "title text-lg text-primary-600" |         class: "title text-lg text-primary-600" | ||||||
|       ) %> |       ) %> | ||||||
|   | |||||||
| @@ -8,11 +8,11 @@ defmodule CanneryWeb.AmmoTypeLive.Index do | |||||||
|  |  | ||||||
|   @impl true |   @impl true | ||||||
|   def mount(%{"search" => search}, _session, socket) do |   def mount(%{"search" => search}, _session, socket) do | ||||||
|     {:ok, socket |> assign(type: :all, show_used: false, search: search) |> list_ammo_types()} |     {:ok, socket |> assign(class: :all, show_used: false, search: search) |> list_ammo_types()} | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   def mount(_params, _session, socket) do |   def mount(_params, _session, socket) do | ||||||
|     {:ok, socket |> assign(type: :all, show_used: false, search: nil) |> list_ammo_types()} |     {:ok, socket |> assign(class: :all, show_used: false, search: nil) |> list_ammo_types()} | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   @impl true |   @impl true | ||||||
| @@ -86,28 +86,28 @@ defmodule CanneryWeb.AmmoTypeLive.Index do | |||||||
|     {:noreply, socket |> push_patch(to: search_path)} |     {:noreply, socket |> push_patch(to: search_path)} | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   def handle_event("change_type", %{"ammo_type" => %{"type" => "rifle"}}, socket) do |   def handle_event("change_class", %{"ammo_type" => %{"class" => "rifle"}}, socket) do | ||||||
|     {:noreply, socket |> assign(:type, :rifle) |> list_ammo_types()} |     {:noreply, socket |> assign(:class, :rifle) |> list_ammo_types()} | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   def handle_event("change_type", %{"ammo_type" => %{"type" => "shotgun"}}, socket) do |   def handle_event("change_class", %{"ammo_type" => %{"class" => "shotgun"}}, socket) do | ||||||
|     {:noreply, socket |> assign(:type, :shotgun) |> list_ammo_types()} |     {:noreply, socket |> assign(:class, :shotgun) |> list_ammo_types()} | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   def handle_event("change_type", %{"ammo_type" => %{"type" => "pistol"}}, socket) do |   def handle_event("change_class", %{"ammo_type" => %{"class" => "pistol"}}, socket) do | ||||||
|     {:noreply, socket |> assign(:type, :pistol) |> list_ammo_types()} |     {:noreply, socket |> assign(:class, :pistol) |> list_ammo_types()} | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   def handle_event("change_type", %{"ammo_type" => %{"type" => _all}}, socket) do |   def handle_event("change_class", %{"ammo_type" => %{"class" => _all}}, socket) do | ||||||
|     {:noreply, socket |> assign(:type, :all) |> list_ammo_types()} |     {:noreply, socket |> assign(:class, :all) |> list_ammo_types()} | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   defp list_ammo_types( |   defp list_ammo_types( | ||||||
|          %{assigns: %{type: type, search: search, current_user: current_user}} = socket |          %{assigns: %{class: class, search: search, current_user: current_user}} = socket | ||||||
|        ) do |        ) do | ||||||
|     socket |     socket | ||||||
|     |> assign( |     |> assign( | ||||||
|       ammo_types: Ammo.list_ammo_types(search, current_user, type), |       ammo_types: Ammo.list_ammo_types(search, current_user, class), | ||||||
|       ammo_types_count: Ammo.get_ammo_types_count!(current_user) |       ammo_types_count: Ammo.get_ammo_types_count!(current_user) | ||||||
|     ) |     ) | ||||||
|   end |   end | ||||||
|   | |||||||
| @@ -22,15 +22,15 @@ | |||||||
|         :let={f} |         :let={f} | ||||||
|         for={%{}} |         for={%{}} | ||||||
|         as={:ammo_type} |         as={:ammo_type} | ||||||
|         phx-change="change_type" |         phx-change="change_class" | ||||||
|         phx-submit="change_type" |         phx-submit="change_class" | ||||||
|         class="flex items-center" |         class="flex items-center" | ||||||
|       > |       > | ||||||
|         <%= label(f, :type, gettext("Type"), class: "title text-primary-600 text-lg text-center") %> |         <%= label(f, :class, gettext("Class"), class: "title text-primary-600 text-lg text-center") %> | ||||||
|  |  | ||||||
|         <%= select( |         <%= select( | ||||||
|           f, |           f, | ||||||
|           :type, |           :class, | ||||||
|           [ |           [ | ||||||
|             {gettext("All"), :all}, |             {gettext("All"), :all}, | ||||||
|             {gettext("Rifle"), :rifle}, |             {gettext("Rifle"), :rifle}, | ||||||
| @@ -38,7 +38,7 @@ | |||||||
|             {gettext("Pistol"), :pistol} |             {gettext("Pistol"), :pistol} | ||||||
|           ], |           ], | ||||||
|           class: "mx-2 my-1 min-w-md input input-primary", |           class: "mx-2 my-1 min-w-md input input-primary", | ||||||
|           value: @type |           value: @class | ||||||
|         ) %> |         ) %> | ||||||
|       </.form> |       </.form> | ||||||
|  |  | ||||||
| @@ -79,7 +79,7 @@ | |||||||
|         ammo_types={@ammo_types} |         ammo_types={@ammo_types} | ||||||
|         current_user={@current_user} |         current_user={@current_user} | ||||||
|         show_used={@show_used} |         show_used={@show_used} | ||||||
|         type={@type} |         class={@class} | ||||||
|       > |       > | ||||||
|         <:actions :let={ammo_type}> |         <:actions :let={ammo_type}> | ||||||
|           <div class="px-4 py-2 space-x-4 flex justify-center items-center"> |           <div class="px-4 py-2 space-x-4 flex justify-center items-center"> | ||||||
|   | |||||||
| @@ -116,11 +116,11 @@ defmodule CanneryWeb.AmmoTypeLive.Show do | |||||||
|     socket |> display_ammo_type(ammo_type) |     socket |> display_ammo_type(ammo_type) | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   defp fields_to_display(%AmmoType{type: type}) do |   defp fields_to_display(%AmmoType{class: class}) do | ||||||
|     [ |     [ | ||||||
|       %{label: gettext("Cartridge:"), key: :cartridge, type: :string}, |       %{label: gettext("Cartridge:"), key: :cartridge, type: :string}, | ||||||
|       %{ |       %{ | ||||||
|         label: if(type == :shotgun, do: gettext("Gauge:"), else: gettext("Caliber:")), |         label: if(class == :shotgun, do: gettext("Gauge:"), else: gettext("Caliber:")), | ||||||
|         key: :caliber, |         key: :caliber, | ||||||
|         type: :string |         type: :string | ||||||
|       }, |       }, | ||||||
|   | |||||||
| @@ -42,14 +42,14 @@ | |||||||
|  |  | ||||||
|   <hr class="hr" /> |   <hr class="hr" /> | ||||||
|  |  | ||||||
|   <%= if @ammo_type.type || @custom_fields? do %> |   <%= if @ammo_type.class || @custom_fields? do %> | ||||||
|     <div class="grid sm:grid-cols-2 gap-4 text-center justify-center items-center"> |     <div class="grid sm:grid-cols-2 gap-4 text-center justify-center items-center"> | ||||||
|       <h3 class="title text-lg"> |       <h3 class="title text-lg"> | ||||||
|         <%= gettext("Type") %> |         <%= gettext("Class") %> | ||||||
|       </h3> |       </h3> | ||||||
|  |  | ||||||
|       <span class="text-primary-600"> |       <span class="text-primary-600"> | ||||||
|         <%= case @ammo_type.type do %> |         <%= case @ammo_type.class do %> | ||||||
|           <% :shotgun -> %> |           <% :shotgun -> %> | ||||||
|             <%= gettext("Shotgun") %> |             <%= gettext("Shotgun") %> | ||||||
|           <% :rifle -> %> |           <% :rifle -> %> | ||||||
|   | |||||||
| @@ -11,13 +11,13 @@ defmodule CanneryWeb.ContainerLive.Show do | |||||||
|  |  | ||||||
|   @impl true |   @impl true | ||||||
|   def mount(_params, _session, socket), |   def mount(_params, _session, socket), | ||||||
|     do: {:ok, socket |> assign(type: :all, view_table: true)} |     do: {:ok, socket |> assign(class: :all, view_table: true)} | ||||||
|  |  | ||||||
|   @impl true |   @impl true | ||||||
|   def handle_params(%{"id" => id}, _session, %{assigns: %{current_user: current_user}} = socket) do |   def handle_params(%{"id" => id}, _session, %{assigns: %{current_user: current_user}} = socket) do | ||||||
|     socket = |     socket = | ||||||
|       socket |       socket | ||||||
|       |> assign(view_table: true) |       |> assign(:view_table, true) | ||||||
|       |> render_container(id, current_user) |       |> render_container(id, current_user) | ||||||
|  |  | ||||||
|     {:noreply, socket} |     {:noreply, socket} | ||||||
| @@ -86,30 +86,30 @@ defmodule CanneryWeb.ContainerLive.Show do | |||||||
|     {:noreply, socket |> assign(:view_table, !view_table) |> render_container()} |     {:noreply, socket |> assign(:view_table, !view_table) |> render_container()} | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   def handle_event("change_type", %{"ammo_type" => %{"type" => "rifle"}}, socket) do |   def handle_event("change_class", %{"ammo_type" => %{"class" => "rifle"}}, socket) do | ||||||
|     {:noreply, socket |> assign(:type, :rifle) |> render_container()} |     {:noreply, socket |> assign(:class, :rifle) |> render_container()} | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   def handle_event("change_type", %{"ammo_type" => %{"type" => "shotgun"}}, socket) do |   def handle_event("change_class", %{"ammo_type" => %{"class" => "shotgun"}}, socket) do | ||||||
|     {:noreply, socket |> assign(:type, :shotgun) |> render_container()} |     {:noreply, socket |> assign(:class, :shotgun) |> render_container()} | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   def handle_event("change_type", %{"ammo_type" => %{"type" => "pistol"}}, socket) do |   def handle_event("change_class", %{"ammo_type" => %{"class" => "pistol"}}, socket) do | ||||||
|     {:noreply, socket |> assign(:type, :pistol) |> render_container()} |     {:noreply, socket |> assign(:class, :pistol) |> render_container()} | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   def handle_event("change_type", %{"ammo_type" => %{"type" => _all}}, socket) do |   def handle_event("change_class", %{"ammo_type" => %{"class" => _all}}, socket) do | ||||||
|     {:noreply, socket |> assign(:type, :all) |> render_container()} |     {:noreply, socket |> assign(:class, :all) |> render_container()} | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   @spec render_container(Socket.t(), Container.id(), User.t()) :: Socket.t() |   @spec render_container(Socket.t(), Container.id(), User.t()) :: Socket.t() | ||||||
|   defp render_container( |   defp render_container( | ||||||
|          %{assigns: %{type: type, live_action: live_action}} = socket, |          %{assigns: %{class: class, live_action: live_action}} = socket, | ||||||
|          id, |          id, | ||||||
|          current_user |          current_user | ||||||
|        ) do |        ) do | ||||||
|     %{name: container_name} = container = Containers.get_container!(id, current_user) |     %{name: container_name} = container = Containers.get_container!(id, current_user) | ||||||
|     ammo_groups = Ammo.list_ammo_groups_for_container(container, type, current_user) |     ammo_groups = Ammo.list_ammo_groups_for_container(container, class, current_user) | ||||||
|     original_counts = ammo_groups |> Ammo.get_original_counts(current_user) |     original_counts = ammo_groups |> Ammo.get_original_counts(current_user) | ||||||
|     cprs = ammo_groups |> Ammo.get_cprs(current_user) |     cprs = ammo_groups |> Ammo.get_cprs(current_user) | ||||||
|     last_used_dates = ammo_groups |> ActivityLog.get_last_used_dates(current_user) |     last_used_dates = ammo_groups |> ActivityLog.get_last_used_dates(current_user) | ||||||
|   | |||||||
| @@ -90,15 +90,15 @@ | |||||||
|       :let={f} |       :let={f} | ||||||
|       for={%{}} |       for={%{}} | ||||||
|       as={:ammo_type} |       as={:ammo_type} | ||||||
|       phx-change="change_type" |       phx-change="change_class" | ||||||
|       phx-submit="change_type" |       phx-submit="change_class" | ||||||
|       class="flex items-center" |       class="flex items-center" | ||||||
|     > |     > | ||||||
|       <%= label(f, :type, gettext("Type"), class: "title text-primary-600 text-lg text-center") %> |       <%= label(f, :class, gettext("Class"), class: "title text-primary-600 text-lg text-center") %> | ||||||
|  |  | ||||||
|       <%= select( |       <%= select( | ||||||
|         f, |         f, | ||||||
|         :type, |         :class, | ||||||
|         [ |         [ | ||||||
|           {gettext("All"), :all}, |           {gettext("All"), :all}, | ||||||
|           {gettext("Rifle"), :rifle}, |           {gettext("Rifle"), :rifle}, | ||||||
| @@ -106,7 +106,7 @@ | |||||||
|           {gettext("Pistol"), :pistol} |           {gettext("Pistol"), :pistol} | ||||||
|         ], |         ], | ||||||
|         class: "mx-2 my-1 min-w-md input input-primary", |         class: "mx-2 my-1 min-w-md input input-primary", | ||||||
|         value: @type |         value: @class | ||||||
|       ) %> |       ) %> | ||||||
|     </.form> |     </.form> | ||||||
|  |  | ||||||
|   | |||||||
| @@ -10,11 +10,11 @@ defmodule CanneryWeb.RangeLive.Index do | |||||||
|  |  | ||||||
|   @impl true |   @impl true | ||||||
|   def mount(%{"search" => search}, _session, socket) do |   def mount(%{"search" => search}, _session, socket) do | ||||||
|     {:ok, socket |> assign(type: :all, search: search) |> display_shot_groups()} |     {:ok, socket |> assign(class: :all, search: search) |> display_shot_groups()} | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   def mount(_params, _session, socket) do |   def mount(_params, _session, socket) do | ||||||
|     {:ok, socket |> assign(type: :all, search: nil) |> display_shot_groups()} |     {:ok, socket |> assign(class: :all, search: nil) |> display_shot_groups()} | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   @impl true |   @impl true | ||||||
| @@ -102,27 +102,27 @@ defmodule CanneryWeb.RangeLive.Index do | |||||||
|     {:noreply, socket |> push_patch(to: Routes.range_index_path(Endpoint, :search, search_term))} |     {:noreply, socket |> push_patch(to: Routes.range_index_path(Endpoint, :search, search_term))} | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   def handle_event("change_type", %{"ammo_type" => %{"type" => "rifle"}}, socket) do |   def handle_event("change_class", %{"ammo_type" => %{"class" => "rifle"}}, socket) do | ||||||
|     {:noreply, socket |> assign(:type, :rifle) |> display_shot_groups()} |     {:noreply, socket |> assign(:class, :rifle) |> display_shot_groups()} | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   def handle_event("change_type", %{"ammo_type" => %{"type" => "shotgun"}}, socket) do |   def handle_event("change_class", %{"ammo_type" => %{"class" => "shotgun"}}, socket) do | ||||||
|     {:noreply, socket |> assign(:type, :shotgun) |> display_shot_groups()} |     {:noreply, socket |> assign(:class, :shotgun) |> display_shot_groups()} | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   def handle_event("change_type", %{"ammo_type" => %{"type" => "pistol"}}, socket) do |   def handle_event("change_class", %{"ammo_type" => %{"class" => "pistol"}}, socket) do | ||||||
|     {:noreply, socket |> assign(:type, :pistol) |> display_shot_groups()} |     {:noreply, socket |> assign(:class, :pistol) |> display_shot_groups()} | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   def handle_event("change_type", %{"ammo_type" => %{"type" => _all}}, socket) do |   def handle_event("change_class", %{"ammo_type" => %{"class" => _all}}, socket) do | ||||||
|     {:noreply, socket |> assign(:type, :all) |> display_shot_groups()} |     {:noreply, socket |> assign(:class, :all) |> display_shot_groups()} | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   @spec display_shot_groups(Socket.t()) :: Socket.t() |   @spec display_shot_groups(Socket.t()) :: Socket.t() | ||||||
|   defp display_shot_groups( |   defp display_shot_groups( | ||||||
|          %{assigns: %{type: type, search: search, current_user: current_user}} = socket |          %{assigns: %{class: class, search: search, current_user: current_user}} = socket | ||||||
|        ) do |        ) do | ||||||
|     shot_groups = ActivityLog.list_shot_groups(search, type, current_user) |     shot_groups = ActivityLog.list_shot_groups(search, class, current_user) | ||||||
|     ammo_groups = Ammo.list_staged_ammo_groups(current_user) |     ammo_groups = Ammo.list_staged_ammo_groups(current_user) | ||||||
|     chart_data = shot_groups |> get_chart_data_for_shot_group() |     chart_data = shot_groups |> get_chart_data_for_shot_group() | ||||||
|     original_counts = ammo_groups |> Ammo.get_original_counts(current_user) |     original_counts = ammo_groups |> Ammo.get_original_counts(current_user) | ||||||
|   | |||||||
| @@ -79,15 +79,15 @@ | |||||||
|         :let={f} |         :let={f} | ||||||
|         for={%{}} |         for={%{}} | ||||||
|         as={:ammo_type} |         as={:ammo_type} | ||||||
|         phx-change="change_type" |         phx-change="change_class" | ||||||
|         phx-submit="change_type" |         phx-submit="change_class" | ||||||
|         class="flex items-center" |         class="flex items-center" | ||||||
|       > |       > | ||||||
|         <%= label(f, :type, gettext("Type"), class: "title text-primary-600 text-lg text-center") %> |         <%= label(f, :class, gettext("Class"), class: "title text-primary-600 text-lg text-center") %> | ||||||
|  |  | ||||||
|         <%= select( |         <%= select( | ||||||
|           f, |           f, | ||||||
|           :type, |           :class, | ||||||
|           [ |           [ | ||||||
|             {gettext("All"), :all}, |             {gettext("All"), :all}, | ||||||
|             {gettext("Rifle"), :rifle}, |             {gettext("Rifle"), :rifle}, | ||||||
| @@ -95,7 +95,7 @@ | |||||||
|             {gettext("Pistol"), :pistol} |             {gettext("Pistol"), :pistol} | ||||||
|           ], |           ], | ||||||
|           class: "mx-2 my-1 min-w-md input input-primary", |           class: "mx-2 my-1 min-w-md input input-primary", | ||||||
|           value: @type |           value: @class | ||||||
|         ) %> |         ) %> | ||||||
|       </.form> |       </.form> | ||||||
|  |  | ||||||
|   | |||||||
| @@ -10,8 +10,8 @@ | |||||||
| msgid "" | msgid "" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.ex:54 | #: lib/cannery_web/live/ammo_group_live/index.ex:59 | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.ex:62 | #: lib/cannery_web/live/ammo_group_live/index.ex:67 | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:38 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:38 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Add Ammo" | msgid "Add Ammo" | ||||||
| @@ -156,7 +156,7 @@ msgstr "" | |||||||
| msgid "Why not get some ready to shoot?" | msgid "Why not get some ready to shoot?" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:125 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:127 | ||||||
| #: lib/cannery_web/live/ammo_group_live/show.html.heex:103 | #: lib/cannery_web/live/ammo_group_live/show.html.heex:103 | ||||||
| #: lib/cannery_web/live/range_live/index.html.heex:45 | #: lib/cannery_web/live/range_live/index.html.heex:45 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| @@ -209,7 +209,7 @@ msgid "add an ammo type first" | |||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/components/move_ammo_group_component.ex:80 | #: lib/cannery_web/components/move_ammo_group_component.ex:80 | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:142 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:144 | ||||||
| #: lib/cannery_web/live/ammo_group_live/show.html.heex:96 | #: lib/cannery_web/live/ammo_group_live/show.html.heex:96 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Move ammo" | msgid "Move ammo" | ||||||
| @@ -300,7 +300,7 @@ msgstr "" | |||||||
| msgid "Edit %{tag_name}" | msgid "Edit %{tag_name}" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:164 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:166 | ||||||
| #: lib/cannery_web/live/ammo_group_live/show.html.heex:62 | #: lib/cannery_web/live/ammo_group_live/show.html.heex:62 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Edit ammo group of %{ammo_group_count} bullets" | msgid "Edit ammo group of %{ammo_group_count} bullets" | ||||||
| @@ -321,7 +321,7 @@ msgstr "" | |||||||
| msgid "Edit shot record of %{shot_group_count} shots" | msgid "Edit shot record of %{shot_group_count} shots" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:118 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:120 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Stage" | msgid "Stage" | ||||||
| msgstr "" | msgstr "" | ||||||
| @@ -332,7 +332,7 @@ msgstr "" | |||||||
| msgid "Tag %{container_name}" | msgid "Tag %{container_name}" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:117 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:119 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Unstage" | msgid "Unstage" | ||||||
| msgstr "" | msgstr "" | ||||||
| @@ -342,18 +342,18 @@ msgstr "" | |||||||
| msgid "View %{ammo_type_name}" | msgid "View %{ammo_type_name}" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:176 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:178 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Clone ammo group of %{ammo_group_count} bullets" | msgid "Clone ammo group of %{ammo_group_count} bullets" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:191 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:193 | ||||||
| #: lib/cannery_web/live/ammo_group_live/show.html.heex:76 | #: lib/cannery_web/live/ammo_group_live/show.html.heex:76 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Delete ammo group of %{ammo_group_count} bullets" | msgid "Delete ammo group of %{ammo_group_count} bullets" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:152 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:154 | ||||||
| #: lib/cannery_web/live/ammo_type_live/show.html.heex:206 | #: lib/cannery_web/live/ammo_type_live/show.html.heex:206 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "View ammo group of %{ammo_group_count} bullets" | msgid "View ammo group of %{ammo_group_count} bullets" | ||||||
|   | |||||||
| @@ -23,8 +23,8 @@ msgstr "" | |||||||
| ## Run "mix gettext.extract" to bring this file up to | ## Run "mix gettext.extract" to bring this file up to | ||||||
| ## date. Leave "msgstr"s empty as changing them here has no | ## date. Leave "msgstr"s empty as changing them here has no | ||||||
| ## effect: edit them in PO (.po) files instead. | ## effect: edit them in PO (.po) files instead. | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.ex:54 | #: lib/cannery_web/live/ammo_group_live/index.ex:59 | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.ex:62 | #: lib/cannery_web/live/ammo_group_live/index.ex:67 | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:38 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:38 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Add Ammo" | msgid "Add Ammo" | ||||||
| @@ -169,7 +169,7 @@ msgstr "Munition markieren" | |||||||
| msgid "Why not get some ready to shoot?" | msgid "Why not get some ready to shoot?" | ||||||
| msgstr "Warum nicht einige für den Schießstand auswählen?" | msgstr "Warum nicht einige für den Schießstand auswählen?" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:125 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:127 | ||||||
| #: lib/cannery_web/live/ammo_group_live/show.html.heex:103 | #: lib/cannery_web/live/ammo_group_live/show.html.heex:103 | ||||||
| #: lib/cannery_web/live/range_live/index.html.heex:45 | #: lib/cannery_web/live/range_live/index.html.heex:45 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| @@ -222,7 +222,7 @@ msgid "add an ammo type first" | |||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/components/move_ammo_group_component.ex:80 | #: lib/cannery_web/components/move_ammo_group_component.ex:80 | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:142 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:144 | ||||||
| #: lib/cannery_web/live/ammo_group_live/show.html.heex:96 | #: lib/cannery_web/live/ammo_group_live/show.html.heex:96 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Move ammo" | msgid "Move ammo" | ||||||
| @@ -313,7 +313,7 @@ msgstr "" | |||||||
| msgid "Edit %{tag_name}" | msgid "Edit %{tag_name}" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:164 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:166 | ||||||
| #: lib/cannery_web/live/ammo_group_live/show.html.heex:62 | #: lib/cannery_web/live/ammo_group_live/show.html.heex:62 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Edit ammo group of %{ammo_group_count} bullets" | msgid "Edit ammo group of %{ammo_group_count} bullets" | ||||||
| @@ -334,7 +334,7 @@ msgstr "" | |||||||
| msgid "Edit shot record of %{shot_group_count} shots" | msgid "Edit shot record of %{shot_group_count} shots" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:118 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:120 | ||||||
| #, elixir-autogen, elixir-format, fuzzy | #, elixir-autogen, elixir-format, fuzzy | ||||||
| msgid "Stage" | msgid "Stage" | ||||||
| msgstr "Munition markieren" | msgstr "Munition markieren" | ||||||
| @@ -345,7 +345,7 @@ msgstr "Munition markieren" | |||||||
| msgid "Tag %{container_name}" | msgid "Tag %{container_name}" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:117 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:119 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Unstage" | msgid "Unstage" | ||||||
| msgstr "" | msgstr "" | ||||||
| @@ -355,18 +355,18 @@ msgstr "" | |||||||
| msgid "View %{ammo_type_name}" | msgid "View %{ammo_type_name}" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:176 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:178 | ||||||
| #, elixir-autogen, elixir-format, fuzzy | #, elixir-autogen, elixir-format, fuzzy | ||||||
| msgid "Clone ammo group of %{ammo_group_count} bullets" | msgid "Clone ammo group of %{ammo_group_count} bullets" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:191 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:193 | ||||||
| #: lib/cannery_web/live/ammo_group_live/show.html.heex:76 | #: lib/cannery_web/live/ammo_group_live/show.html.heex:76 | ||||||
| #, elixir-autogen, elixir-format, fuzzy | #, elixir-autogen, elixir-format, fuzzy | ||||||
| msgid "Delete ammo group of %{ammo_group_count} bullets" | msgid "Delete ammo group of %{ammo_group_count} bullets" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:152 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:154 | ||||||
| #: lib/cannery_web/live/ammo_type_live/show.html.heex:206 | #: lib/cannery_web/live/ammo_type_live/show.html.heex:206 | ||||||
| #, elixir-autogen, elixir-format, fuzzy | #, elixir-autogen, elixir-format, fuzzy | ||||||
| msgid "View ammo group of %{ammo_group_count} bullets" | msgid "View ammo group of %{ammo_group_count} bullets" | ||||||
|   | |||||||
| @@ -31,8 +31,8 @@ msgstr "Admins:" | |||||||
|  |  | ||||||
| #: lib/cannery_web/components/core_components/topbar.html.heex:58 | #: lib/cannery_web/components/core_components/topbar.html.heex:58 | ||||||
| #: lib/cannery_web/components/shot_group_table_component.ex:41 | #: lib/cannery_web/components/shot_group_table_component.ex:41 | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.ex:70 | #: lib/cannery_web/live/ammo_group_live/index.ex:75 | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.ex:79 | #: lib/cannery_web/live/ammo_group_live/index.ex:84 | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:3 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:3 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Ammo" | msgid "Ammo" | ||||||
| @@ -262,7 +262,7 @@ msgstr "Neue Einladung" | |||||||
| msgid "New Tag" | msgid "New Tag" | ||||||
| msgstr "Neuer Tag" | msgstr "Neuer Tag" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:92 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:94 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "No Ammo" | msgid "No Ammo" | ||||||
| msgstr "Keine Munition" | msgstr "Keine Munition" | ||||||
| @@ -401,16 +401,9 @@ msgstr "Die selbst-gehostete Website zur Verwaltung von Schusswaffen" | |||||||
| msgid "Tracer" | msgid "Tracer" | ||||||
| msgstr "Leuchtspur" | msgstr "Leuchtspur" | ||||||
|  |  | ||||||
| #: lib/cannery_web/components/ammo_type_table_component.ex:150 |  | ||||||
| #: lib/cannery_web/components/container_table_component.ex:48 | #: lib/cannery_web/components/container_table_component.ex:48 | ||||||
| #: lib/cannery_web/components/move_ammo_group_component.ex:68 | #: lib/cannery_web/components/move_ammo_group_component.ex:68 | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:50 |  | ||||||
| #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:21 |  | ||||||
| #: lib/cannery_web/live/ammo_type_live/index.html.heex:29 |  | ||||||
| #: lib/cannery_web/live/ammo_type_live/show.html.heex:48 |  | ||||||
| #: lib/cannery_web/live/container_live/form_component.html.heex:39 | #: lib/cannery_web/live/container_live/form_component.html.heex:39 | ||||||
| #: lib/cannery_web/live/container_live/show.html.heex:97 |  | ||||||
| #: lib/cannery_web/live/range_live/index.html.heex:86 |  | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Type" | msgid "Type" | ||||||
| msgstr "Art" | msgstr "Art" | ||||||
| @@ -471,7 +464,7 @@ msgid "No ammo staged" | |||||||
| msgstr "Keine Munition selektiert" | msgstr "Keine Munition selektiert" | ||||||
|  |  | ||||||
| #: lib/cannery_web/components/add_shot_group_component.html.heex:3 | #: lib/cannery_web/components/add_shot_group_component.html.heex:3 | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.ex:30 | #: lib/cannery_web/live/ammo_group_live/index.ex:35 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Record shots" | msgid "Record shots" | ||||||
| msgstr "Schüsse dokumentieren" | msgstr "Schüsse dokumentieren" | ||||||
| @@ -512,7 +505,7 @@ msgstr "Patronen abgefeuert" | |||||||
| msgid "Shot Records" | msgid "Shot Records" | ||||||
| msgstr "Schießkladde" | msgstr "Schießkladde" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.ex:38 | #: lib/cannery_web/live/ammo_group_live/index.ex:43 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Move ammo" | msgid "Move ammo" | ||||||
| msgstr "Munition verschieben" | msgstr "Munition verschieben" | ||||||
| @@ -802,7 +795,7 @@ msgstr "" | |||||||
| msgid "Container:" | msgid "Container:" | ||||||
| msgstr "Behälter" | msgstr "Behälter" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:85 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:87 | ||||||
| #: lib/cannery_web/live/ammo_type_live/index.html.heex:64 | #: lib/cannery_web/live/ammo_type_live/index.html.heex:64 | ||||||
| #: lib/cannery_web/live/ammo_type_live/show.html.heex:166 | #: lib/cannery_web/live/ammo_type_live/show.html.heex:166 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| @@ -1054,7 +1047,7 @@ msgstr "" | |||||||
| msgid "Purchased on:" | msgid "Purchased on:" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.ex:46 | #: lib/cannery_web/live/ammo_group_live/index.ex:51 | ||||||
| #, elixir-autogen, elixir-format, fuzzy | #, elixir-autogen, elixir-format, fuzzy | ||||||
| msgid "Edit ammo" | msgid "Edit ammo" | ||||||
| msgstr "Munitionstyp bearbeiten" | msgstr "Munitionstyp bearbeiten" | ||||||
| @@ -1070,7 +1063,7 @@ msgstr "Keine Munitionsarten" | |||||||
| msgid "Search catalog" | msgid "Search catalog" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:79 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:81 | ||||||
| #, elixir-autogen, elixir-format, fuzzy | #, elixir-autogen, elixir-format, fuzzy | ||||||
| msgid "Search ammo" | msgid "Search ammo" | ||||||
| msgstr "" | msgstr "" | ||||||
| @@ -1256,7 +1249,7 @@ msgstr "" | |||||||
| msgid "Close modal" | msgid "Close modal" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:56 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:58 | ||||||
| #: lib/cannery_web/live/ammo_type_live/index.html.heex:35 | #: lib/cannery_web/live/ammo_type_live/index.html.heex:35 | ||||||
| #: lib/cannery_web/live/container_live/show.html.heex:103 | #: lib/cannery_web/live/container_live/show.html.heex:103 | ||||||
| #: lib/cannery_web/live/range_live/index.html.heex:92 | #: lib/cannery_web/live/range_live/index.html.heex:92 | ||||||
| @@ -1340,7 +1333,7 @@ msgstr "Keine Munition" | |||||||
| msgid "None specified" | msgid "None specified" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:59 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:61 | ||||||
| #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:25 | #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:25 | ||||||
| #: lib/cannery_web/live/ammo_type_live/index.html.heex:38 | #: lib/cannery_web/live/ammo_type_live/index.html.heex:38 | ||||||
| #: lib/cannery_web/live/ammo_type_live/show.html.heex:58 | #: lib/cannery_web/live/ammo_type_live/show.html.heex:58 | ||||||
| @@ -1365,7 +1358,7 @@ msgstr "Zündertyp" | |||||||
| msgid "Projectile" | msgid "Projectile" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:57 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:59 | ||||||
| #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:25 | #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:25 | ||||||
| #: lib/cannery_web/live/ammo_type_live/index.html.heex:36 | #: lib/cannery_web/live/ammo_type_live/index.html.heex:36 | ||||||
| #: lib/cannery_web/live/ammo_type_live/show.html.heex:56 | #: lib/cannery_web/live/ammo_type_live/show.html.heex:56 | ||||||
| @@ -1419,7 +1412,7 @@ msgstr "" | |||||||
| msgid "Shot type:" | msgid "Shot type:" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:58 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:60 | ||||||
| #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:25 | #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:25 | ||||||
| #: lib/cannery_web/live/ammo_type_live/index.html.heex:37 | #: lib/cannery_web/live/ammo_type_live/index.html.heex:37 | ||||||
| #: lib/cannery_web/live/ammo_type_live/show.html.heex:54 | #: lib/cannery_web/live/ammo_type_live/show.html.heex:54 | ||||||
| @@ -1461,3 +1454,14 @@ msgstr "" | |||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Wadding:" | msgid "Wadding:" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
|  | #: lib/cannery_web/components/ammo_type_table_component.ex:150 | ||||||
|  | #: lib/cannery_web/live/ammo_group_live/index.html.heex:50 | ||||||
|  | #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:21 | ||||||
|  | #: lib/cannery_web/live/ammo_type_live/index.html.heex:29 | ||||||
|  | #: lib/cannery_web/live/ammo_type_live/show.html.heex:48 | ||||||
|  | #: lib/cannery_web/live/container_live/show.html.heex:97 | ||||||
|  | #: lib/cannery_web/live/range_live/index.html.heex:86 | ||||||
|  | #, elixir-autogen, elixir-format | ||||||
|  | msgid "Class" | ||||||
|  | msgstr "" | ||||||
|   | |||||||
| @@ -173,7 +173,7 @@ msgstr "" | |||||||
| "Ungültige Nummer an Kopien. Muss zwischen 1 and %{max} liegen. War " | "Ungültige Nummer an Kopien. Muss zwischen 1 and %{max} liegen. War " | ||||||
| "%{multiplier}" | "%{multiplier}" | ||||||
|  |  | ||||||
| #: lib/cannery/ammo.ex:1114 | #: lib/cannery/ammo.ex:1123 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Invalid multiplier" | msgid "Invalid multiplier" | ||||||
| msgstr "" | msgstr "" | ||||||
|   | |||||||
| @@ -73,7 +73,7 @@ msgstr "" | |||||||
| msgid "Are you sure you want to delete %{name}?" | msgid "Are you sure you want to delete %{name}?" | ||||||
| msgstr "Sind Sie sicher, dass sie %{name} löschen möchten?" | msgstr "Sind Sie sicher, dass sie %{name} löschen möchten?" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:189 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:191 | ||||||
| #: lib/cannery_web/live/ammo_group_live/show.html.heex:74 | #: lib/cannery_web/live/ammo_group_live/show.html.heex:74 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Are you sure you want to delete this ammo?" | msgid "Are you sure you want to delete this ammo?" | ||||||
| @@ -234,7 +234,7 @@ msgstr "Möchten Sie die Sprache wechseln?" | |||||||
| msgid "Language updated successfully." | msgid "Language updated successfully." | ||||||
| msgstr "Spracheinstellung gespeichert." | msgstr "Spracheinstellung gespeichert." | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.ex:89 | #: lib/cannery_web/live/ammo_group_live/index.ex:94 | ||||||
| #: lib/cannery_web/live/ammo_group_live/show.ex:55 | #: lib/cannery_web/live/ammo_group_live/show.ex:55 | ||||||
| #, elixir-autogen, elixir-format, fuzzy | #, elixir-autogen, elixir-format, fuzzy | ||||||
| msgid "Ammo deleted succesfully" | msgid "Ammo deleted succesfully" | ||||||
|   | |||||||
| @@ -27,8 +27,8 @@ msgstr "" | |||||||
|  |  | ||||||
| #: lib/cannery_web/components/core_components/topbar.html.heex:58 | #: lib/cannery_web/components/core_components/topbar.html.heex:58 | ||||||
| #: lib/cannery_web/components/shot_group_table_component.ex:41 | #: lib/cannery_web/components/shot_group_table_component.ex:41 | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.ex:70 | #: lib/cannery_web/live/ammo_group_live/index.ex:75 | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.ex:79 | #: lib/cannery_web/live/ammo_group_live/index.ex:84 | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:3 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:3 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Ammo" | msgid "Ammo" | ||||||
| @@ -258,7 +258,7 @@ msgstr "" | |||||||
| msgid "New Tag" | msgid "New Tag" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:92 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:94 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "No Ammo" | msgid "No Ammo" | ||||||
| msgstr "" | msgstr "" | ||||||
| @@ -395,16 +395,9 @@ msgstr "" | |||||||
| msgid "Tracer" | msgid "Tracer" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/components/ammo_type_table_component.ex:150 |  | ||||||
| #: lib/cannery_web/components/container_table_component.ex:48 | #: lib/cannery_web/components/container_table_component.ex:48 | ||||||
| #: lib/cannery_web/components/move_ammo_group_component.ex:68 | #: lib/cannery_web/components/move_ammo_group_component.ex:68 | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:50 |  | ||||||
| #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:21 |  | ||||||
| #: lib/cannery_web/live/ammo_type_live/index.html.heex:29 |  | ||||||
| #: lib/cannery_web/live/ammo_type_live/show.html.heex:48 |  | ||||||
| #: lib/cannery_web/live/container_live/form_component.html.heex:39 | #: lib/cannery_web/live/container_live/form_component.html.heex:39 | ||||||
| #: lib/cannery_web/live/container_live/show.html.heex:97 |  | ||||||
| #: lib/cannery_web/live/range_live/index.html.heex:86 |  | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Type" | msgid "Type" | ||||||
| msgstr "" | msgstr "" | ||||||
| @@ -465,7 +458,7 @@ msgid "No ammo staged" | |||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/components/add_shot_group_component.html.heex:3 | #: lib/cannery_web/components/add_shot_group_component.html.heex:3 | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.ex:30 | #: lib/cannery_web/live/ammo_group_live/index.ex:35 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Record shots" | msgid "Record shots" | ||||||
| msgstr "" | msgstr "" | ||||||
| @@ -506,7 +499,7 @@ msgstr "" | |||||||
| msgid "Shot Records" | msgid "Shot Records" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.ex:38 | #: lib/cannery_web/live/ammo_group_live/index.ex:43 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Move ammo" | msgid "Move ammo" | ||||||
| msgstr "" | msgstr "" | ||||||
| @@ -796,7 +789,7 @@ msgstr "" | |||||||
| msgid "Container:" | msgid "Container:" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:85 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:87 | ||||||
| #: lib/cannery_web/live/ammo_type_live/index.html.heex:64 | #: lib/cannery_web/live/ammo_type_live/index.html.heex:64 | ||||||
| #: lib/cannery_web/live/ammo_type_live/show.html.heex:166 | #: lib/cannery_web/live/ammo_type_live/show.html.heex:166 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| @@ -1048,7 +1041,7 @@ msgstr "" | |||||||
| msgid "Purchased on:" | msgid "Purchased on:" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.ex:46 | #: lib/cannery_web/live/ammo_group_live/index.ex:51 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Edit ammo" | msgid "Edit ammo" | ||||||
| msgstr "" | msgstr "" | ||||||
| @@ -1064,7 +1057,7 @@ msgstr "" | |||||||
| msgid "Search catalog" | msgid "Search catalog" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:79 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:81 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Search ammo" | msgid "Search ammo" | ||||||
| msgstr "" | msgstr "" | ||||||
| @@ -1239,7 +1232,7 @@ msgstr "" | |||||||
| msgid "Close modal" | msgid "Close modal" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:56 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:58 | ||||||
| #: lib/cannery_web/live/ammo_type_live/index.html.heex:35 | #: lib/cannery_web/live/ammo_type_live/index.html.heex:35 | ||||||
| #: lib/cannery_web/live/container_live/show.html.heex:103 | #: lib/cannery_web/live/container_live/show.html.heex:103 | ||||||
| #: lib/cannery_web/live/range_live/index.html.heex:92 | #: lib/cannery_web/live/range_live/index.html.heex:92 | ||||||
| @@ -1323,7 +1316,7 @@ msgstr "" | |||||||
| msgid "None specified" | msgid "None specified" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:59 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:61 | ||||||
| #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:25 | #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:25 | ||||||
| #: lib/cannery_web/live/ammo_type_live/index.html.heex:38 | #: lib/cannery_web/live/ammo_type_live/index.html.heex:38 | ||||||
| #: lib/cannery_web/live/ammo_type_live/show.html.heex:58 | #: lib/cannery_web/live/ammo_type_live/show.html.heex:58 | ||||||
| @@ -1348,7 +1341,7 @@ msgstr "" | |||||||
| msgid "Projectile" | msgid "Projectile" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:57 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:59 | ||||||
| #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:25 | #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:25 | ||||||
| #: lib/cannery_web/live/ammo_type_live/index.html.heex:36 | #: lib/cannery_web/live/ammo_type_live/index.html.heex:36 | ||||||
| #: lib/cannery_web/live/ammo_type_live/show.html.heex:56 | #: lib/cannery_web/live/ammo_type_live/show.html.heex:56 | ||||||
| @@ -1402,7 +1395,7 @@ msgstr "" | |||||||
| msgid "Shot type:" | msgid "Shot type:" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:58 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:60 | ||||||
| #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:25 | #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:25 | ||||||
| #: lib/cannery_web/live/ammo_type_live/index.html.heex:37 | #: lib/cannery_web/live/ammo_type_live/index.html.heex:37 | ||||||
| #: lib/cannery_web/live/ammo_type_live/show.html.heex:54 | #: lib/cannery_web/live/ammo_type_live/show.html.heex:54 | ||||||
| @@ -1444,3 +1437,14 @@ msgstr "" | |||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Wadding:" | msgid "Wadding:" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
|  | #: lib/cannery_web/components/ammo_type_table_component.ex:150 | ||||||
|  | #: lib/cannery_web/live/ammo_group_live/index.html.heex:50 | ||||||
|  | #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:21 | ||||||
|  | #: lib/cannery_web/live/ammo_type_live/index.html.heex:29 | ||||||
|  | #: lib/cannery_web/live/ammo_type_live/show.html.heex:48 | ||||||
|  | #: lib/cannery_web/live/container_live/show.html.heex:97 | ||||||
|  | #: lib/cannery_web/live/range_live/index.html.heex:86 | ||||||
|  | #, elixir-autogen, elixir-format | ||||||
|  | msgid "Class" | ||||||
|  | msgstr "" | ||||||
|   | |||||||
| @@ -10,8 +10,8 @@ msgid "" | |||||||
| msgstr "" | msgstr "" | ||||||
| "Language: en\n" | "Language: en\n" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.ex:54 | #: lib/cannery_web/live/ammo_group_live/index.ex:59 | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.ex:62 | #: lib/cannery_web/live/ammo_group_live/index.ex:67 | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:38 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:38 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Add Ammo" | msgid "Add Ammo" | ||||||
| @@ -156,7 +156,7 @@ msgstr "" | |||||||
| msgid "Why not get some ready to shoot?" | msgid "Why not get some ready to shoot?" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:125 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:127 | ||||||
| #: lib/cannery_web/live/ammo_group_live/show.html.heex:103 | #: lib/cannery_web/live/ammo_group_live/show.html.heex:103 | ||||||
| #: lib/cannery_web/live/range_live/index.html.heex:45 | #: lib/cannery_web/live/range_live/index.html.heex:45 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| @@ -209,7 +209,7 @@ msgid "add an ammo type first" | |||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/components/move_ammo_group_component.ex:80 | #: lib/cannery_web/components/move_ammo_group_component.ex:80 | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:142 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:144 | ||||||
| #: lib/cannery_web/live/ammo_group_live/show.html.heex:96 | #: lib/cannery_web/live/ammo_group_live/show.html.heex:96 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Move ammo" | msgid "Move ammo" | ||||||
| @@ -300,7 +300,7 @@ msgstr "" | |||||||
| msgid "Edit %{tag_name}" | msgid "Edit %{tag_name}" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:164 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:166 | ||||||
| #: lib/cannery_web/live/ammo_group_live/show.html.heex:62 | #: lib/cannery_web/live/ammo_group_live/show.html.heex:62 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Edit ammo group of %{ammo_group_count} bullets" | msgid "Edit ammo group of %{ammo_group_count} bullets" | ||||||
| @@ -321,7 +321,7 @@ msgstr "" | |||||||
| msgid "Edit shot record of %{shot_group_count} shots" | msgid "Edit shot record of %{shot_group_count} shots" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:118 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:120 | ||||||
| #, elixir-autogen, elixir-format, fuzzy | #, elixir-autogen, elixir-format, fuzzy | ||||||
| msgid "Stage" | msgid "Stage" | ||||||
| msgstr "" | msgstr "" | ||||||
| @@ -332,7 +332,7 @@ msgstr "" | |||||||
| msgid "Tag %{container_name}" | msgid "Tag %{container_name}" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:117 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:119 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Unstage" | msgid "Unstage" | ||||||
| msgstr "" | msgstr "" | ||||||
| @@ -342,18 +342,18 @@ msgstr "" | |||||||
| msgid "View %{ammo_type_name}" | msgid "View %{ammo_type_name}" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:176 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:178 | ||||||
| #, elixir-autogen, elixir-format, fuzzy | #, elixir-autogen, elixir-format, fuzzy | ||||||
| msgid "Clone ammo group of %{ammo_group_count} bullets" | msgid "Clone ammo group of %{ammo_group_count} bullets" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:191 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:193 | ||||||
| #: lib/cannery_web/live/ammo_group_live/show.html.heex:76 | #: lib/cannery_web/live/ammo_group_live/show.html.heex:76 | ||||||
| #, elixir-autogen, elixir-format, fuzzy | #, elixir-autogen, elixir-format, fuzzy | ||||||
| msgid "Delete ammo group of %{ammo_group_count} bullets" | msgid "Delete ammo group of %{ammo_group_count} bullets" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:152 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:154 | ||||||
| #: lib/cannery_web/live/ammo_type_live/show.html.heex:206 | #: lib/cannery_web/live/ammo_type_live/show.html.heex:206 | ||||||
| #, elixir-autogen, elixir-format, fuzzy | #, elixir-autogen, elixir-format, fuzzy | ||||||
| msgid "View ammo group of %{ammo_group_count} bullets" | msgid "View ammo group of %{ammo_group_count} bullets" | ||||||
|   | |||||||
| @@ -27,8 +27,8 @@ msgstr "" | |||||||
|  |  | ||||||
| #: lib/cannery_web/components/core_components/topbar.html.heex:58 | #: lib/cannery_web/components/core_components/topbar.html.heex:58 | ||||||
| #: lib/cannery_web/components/shot_group_table_component.ex:41 | #: lib/cannery_web/components/shot_group_table_component.ex:41 | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.ex:70 | #: lib/cannery_web/live/ammo_group_live/index.ex:75 | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.ex:79 | #: lib/cannery_web/live/ammo_group_live/index.ex:84 | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:3 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:3 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Ammo" | msgid "Ammo" | ||||||
| @@ -258,7 +258,7 @@ msgstr "" | |||||||
| msgid "New Tag" | msgid "New Tag" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:92 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:94 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "No Ammo" | msgid "No Ammo" | ||||||
| msgstr "" | msgstr "" | ||||||
| @@ -395,16 +395,9 @@ msgstr "" | |||||||
| msgid "Tracer" | msgid "Tracer" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/components/ammo_type_table_component.ex:150 |  | ||||||
| #: lib/cannery_web/components/container_table_component.ex:48 | #: lib/cannery_web/components/container_table_component.ex:48 | ||||||
| #: lib/cannery_web/components/move_ammo_group_component.ex:68 | #: lib/cannery_web/components/move_ammo_group_component.ex:68 | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:50 |  | ||||||
| #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:21 |  | ||||||
| #: lib/cannery_web/live/ammo_type_live/index.html.heex:29 |  | ||||||
| #: lib/cannery_web/live/ammo_type_live/show.html.heex:48 |  | ||||||
| #: lib/cannery_web/live/container_live/form_component.html.heex:39 | #: lib/cannery_web/live/container_live/form_component.html.heex:39 | ||||||
| #: lib/cannery_web/live/container_live/show.html.heex:97 |  | ||||||
| #: lib/cannery_web/live/range_live/index.html.heex:86 |  | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Type" | msgid "Type" | ||||||
| msgstr "" | msgstr "" | ||||||
| @@ -465,7 +458,7 @@ msgid "No ammo staged" | |||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/components/add_shot_group_component.html.heex:3 | #: lib/cannery_web/components/add_shot_group_component.html.heex:3 | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.ex:30 | #: lib/cannery_web/live/ammo_group_live/index.ex:35 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Record shots" | msgid "Record shots" | ||||||
| msgstr "" | msgstr "" | ||||||
| @@ -506,7 +499,7 @@ msgstr "" | |||||||
| msgid "Shot Records" | msgid "Shot Records" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.ex:38 | #: lib/cannery_web/live/ammo_group_live/index.ex:43 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Move ammo" | msgid "Move ammo" | ||||||
| msgstr "" | msgstr "" | ||||||
| @@ -796,7 +789,7 @@ msgstr "" | |||||||
| msgid "Container:" | msgid "Container:" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:85 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:87 | ||||||
| #: lib/cannery_web/live/ammo_type_live/index.html.heex:64 | #: lib/cannery_web/live/ammo_type_live/index.html.heex:64 | ||||||
| #: lib/cannery_web/live/ammo_type_live/show.html.heex:166 | #: lib/cannery_web/live/ammo_type_live/show.html.heex:166 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| @@ -1048,7 +1041,7 @@ msgstr "" | |||||||
| msgid "Purchased on:" | msgid "Purchased on:" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.ex:46 | #: lib/cannery_web/live/ammo_group_live/index.ex:51 | ||||||
| #, elixir-autogen, elixir-format, fuzzy | #, elixir-autogen, elixir-format, fuzzy | ||||||
| msgid "Edit ammo" | msgid "Edit ammo" | ||||||
| msgstr "" | msgstr "" | ||||||
| @@ -1064,7 +1057,7 @@ msgstr "" | |||||||
| msgid "Search catalog" | msgid "Search catalog" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:79 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:81 | ||||||
| #, elixir-autogen, elixir-format, fuzzy | #, elixir-autogen, elixir-format, fuzzy | ||||||
| msgid "Search ammo" | msgid "Search ammo" | ||||||
| msgstr "" | msgstr "" | ||||||
| @@ -1239,7 +1232,7 @@ msgstr "" | |||||||
| msgid "Close modal" | msgid "Close modal" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:56 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:58 | ||||||
| #: lib/cannery_web/live/ammo_type_live/index.html.heex:35 | #: lib/cannery_web/live/ammo_type_live/index.html.heex:35 | ||||||
| #: lib/cannery_web/live/container_live/show.html.heex:103 | #: lib/cannery_web/live/container_live/show.html.heex:103 | ||||||
| #: lib/cannery_web/live/range_live/index.html.heex:92 | #: lib/cannery_web/live/range_live/index.html.heex:92 | ||||||
| @@ -1323,7 +1316,7 @@ msgstr "" | |||||||
| msgid "None specified" | msgid "None specified" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:59 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:61 | ||||||
| #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:25 | #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:25 | ||||||
| #: lib/cannery_web/live/ammo_type_live/index.html.heex:38 | #: lib/cannery_web/live/ammo_type_live/index.html.heex:38 | ||||||
| #: lib/cannery_web/live/ammo_type_live/show.html.heex:58 | #: lib/cannery_web/live/ammo_type_live/show.html.heex:58 | ||||||
| @@ -1348,7 +1341,7 @@ msgstr "" | |||||||
| msgid "Projectile" | msgid "Projectile" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:57 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:59 | ||||||
| #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:25 | #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:25 | ||||||
| #: lib/cannery_web/live/ammo_type_live/index.html.heex:36 | #: lib/cannery_web/live/ammo_type_live/index.html.heex:36 | ||||||
| #: lib/cannery_web/live/ammo_type_live/show.html.heex:56 | #: lib/cannery_web/live/ammo_type_live/show.html.heex:56 | ||||||
| @@ -1402,7 +1395,7 @@ msgstr "" | |||||||
| msgid "Shot type:" | msgid "Shot type:" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:58 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:60 | ||||||
| #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:25 | #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:25 | ||||||
| #: lib/cannery_web/live/ammo_type_live/index.html.heex:37 | #: lib/cannery_web/live/ammo_type_live/index.html.heex:37 | ||||||
| #: lib/cannery_web/live/ammo_type_live/show.html.heex:54 | #: lib/cannery_web/live/ammo_type_live/show.html.heex:54 | ||||||
| @@ -1444,3 +1437,14 @@ msgstr "" | |||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Wadding:" | msgid "Wadding:" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
|  | #: lib/cannery_web/components/ammo_type_table_component.ex:150 | ||||||
|  | #: lib/cannery_web/live/ammo_group_live/index.html.heex:50 | ||||||
|  | #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:21 | ||||||
|  | #: lib/cannery_web/live/ammo_type_live/index.html.heex:29 | ||||||
|  | #: lib/cannery_web/live/ammo_type_live/show.html.heex:48 | ||||||
|  | #: lib/cannery_web/live/container_live/show.html.heex:97 | ||||||
|  | #: lib/cannery_web/live/range_live/index.html.heex:86 | ||||||
|  | #, elixir-autogen, elixir-format | ||||||
|  | msgid "Class" | ||||||
|  | msgstr "" | ||||||
|   | |||||||
| @@ -156,7 +156,7 @@ msgstr "" | |||||||
| msgid "Invalid number of copies, must be between 1 and %{max}. Was %{multiplier}" | msgid "Invalid number of copies, must be between 1 and %{max}. Was %{multiplier}" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery/ammo.ex:1114 | #: lib/cannery/ammo.ex:1123 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Invalid multiplier" | msgid "Invalid multiplier" | ||||||
| msgstr "" | msgstr "" | ||||||
|   | |||||||
| @@ -58,7 +58,7 @@ msgstr "" | |||||||
| msgid "Are you sure you want to delete %{name}?" | msgid "Are you sure you want to delete %{name}?" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:189 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:191 | ||||||
| #: lib/cannery_web/live/ammo_group_live/show.html.heex:74 | #: lib/cannery_web/live/ammo_group_live/show.html.heex:74 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Are you sure you want to delete this ammo?" | msgid "Are you sure you want to delete this ammo?" | ||||||
| @@ -213,7 +213,7 @@ msgstr "" | |||||||
| msgid "Language updated successfully." | msgid "Language updated successfully." | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.ex:89 | #: lib/cannery_web/live/ammo_group_live/index.ex:94 | ||||||
| #: lib/cannery_web/live/ammo_group_live/show.ex:55 | #: lib/cannery_web/live/ammo_group_live/show.ex:55 | ||||||
| #, elixir-autogen, elixir-format, fuzzy | #, elixir-autogen, elixir-format, fuzzy | ||||||
| msgid "Ammo deleted succesfully" | msgid "Ammo deleted succesfully" | ||||||
|   | |||||||
| @@ -155,7 +155,7 @@ msgstr "" | |||||||
| msgid "Invalid number of copies, must be between 1 and %{max}. Was %{multiplier}" | msgid "Invalid number of copies, must be between 1 and %{max}. Was %{multiplier}" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery/ammo.ex:1114 | #: lib/cannery/ammo.ex:1123 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Invalid multiplier" | msgid "Invalid multiplier" | ||||||
| msgstr "" | msgstr "" | ||||||
|   | |||||||
| @@ -23,8 +23,8 @@ msgstr "" | |||||||
| ## Run "mix gettext.extract" to bring this file up to | ## Run "mix gettext.extract" to bring this file up to | ||||||
| ## date. Leave "msgstr"s empty as changing them here has no | ## date. Leave "msgstr"s empty as changing them here has no | ||||||
| ## effect: edit them in PO (.po) files instead. | ## effect: edit them in PO (.po) files instead. | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.ex:54 | #: lib/cannery_web/live/ammo_group_live/index.ex:59 | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.ex:62 | #: lib/cannery_web/live/ammo_group_live/index.ex:67 | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:38 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:38 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Add Ammo" | msgid "Add Ammo" | ||||||
| @@ -169,7 +169,7 @@ msgstr "Preparar munición" | |||||||
| msgid "Why not get some ready to shoot?" | msgid "Why not get some ready to shoot?" | ||||||
| msgstr "¿Por qué no preparar parte para disparar?" | msgstr "¿Por qué no preparar parte para disparar?" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:125 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:127 | ||||||
| #: lib/cannery_web/live/ammo_group_live/show.html.heex:103 | #: lib/cannery_web/live/ammo_group_live/show.html.heex:103 | ||||||
| #: lib/cannery_web/live/range_live/index.html.heex:45 | #: lib/cannery_web/live/range_live/index.html.heex:45 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| @@ -222,7 +222,7 @@ msgid "add an ammo type first" | |||||||
| msgstr "añade primero un tipo de munición" | msgstr "añade primero un tipo de munición" | ||||||
|  |  | ||||||
| #: lib/cannery_web/components/move_ammo_group_component.ex:80 | #: lib/cannery_web/components/move_ammo_group_component.ex:80 | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:142 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:144 | ||||||
| #: lib/cannery_web/live/ammo_group_live/show.html.heex:96 | #: lib/cannery_web/live/ammo_group_live/show.html.heex:96 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Move ammo" | msgid "Move ammo" | ||||||
| @@ -313,7 +313,7 @@ msgstr "" | |||||||
| msgid "Edit %{tag_name}" | msgid "Edit %{tag_name}" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:164 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:166 | ||||||
| #: lib/cannery_web/live/ammo_group_live/show.html.heex:62 | #: lib/cannery_web/live/ammo_group_live/show.html.heex:62 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Edit ammo group of %{ammo_group_count} bullets" | msgid "Edit ammo group of %{ammo_group_count} bullets" | ||||||
| @@ -334,7 +334,7 @@ msgstr "" | |||||||
| msgid "Edit shot record of %{shot_group_count} shots" | msgid "Edit shot record of %{shot_group_count} shots" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:118 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:120 | ||||||
| #, elixir-autogen, elixir-format, fuzzy | #, elixir-autogen, elixir-format, fuzzy | ||||||
| msgid "Stage" | msgid "Stage" | ||||||
| msgstr "Preparar munición" | msgstr "Preparar munición" | ||||||
| @@ -345,7 +345,7 @@ msgstr "Preparar munición" | |||||||
| msgid "Tag %{container_name}" | msgid "Tag %{container_name}" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:117 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:119 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Unstage" | msgid "Unstage" | ||||||
| msgstr "" | msgstr "" | ||||||
| @@ -355,18 +355,18 @@ msgstr "" | |||||||
| msgid "View %{ammo_type_name}" | msgid "View %{ammo_type_name}" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:176 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:178 | ||||||
| #, elixir-autogen, elixir-format, fuzzy | #, elixir-autogen, elixir-format, fuzzy | ||||||
| msgid "Clone ammo group of %{ammo_group_count} bullets" | msgid "Clone ammo group of %{ammo_group_count} bullets" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:191 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:193 | ||||||
| #: lib/cannery_web/live/ammo_group_live/show.html.heex:76 | #: lib/cannery_web/live/ammo_group_live/show.html.heex:76 | ||||||
| #, elixir-autogen, elixir-format, fuzzy | #, elixir-autogen, elixir-format, fuzzy | ||||||
| msgid "Delete ammo group of %{ammo_group_count} bullets" | msgid "Delete ammo group of %{ammo_group_count} bullets" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:152 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:154 | ||||||
| #: lib/cannery_web/live/ammo_type_live/show.html.heex:206 | #: lib/cannery_web/live/ammo_type_live/show.html.heex:206 | ||||||
| #, elixir-autogen, elixir-format, fuzzy | #, elixir-autogen, elixir-format, fuzzy | ||||||
| msgid "View ammo group of %{ammo_group_count} bullets" | msgid "View ammo group of %{ammo_group_count} bullets" | ||||||
|   | |||||||
| @@ -31,8 +31,8 @@ msgstr "Aministradores:" | |||||||
|  |  | ||||||
| #: lib/cannery_web/components/core_components/topbar.html.heex:58 | #: lib/cannery_web/components/core_components/topbar.html.heex:58 | ||||||
| #: lib/cannery_web/components/shot_group_table_component.ex:41 | #: lib/cannery_web/components/shot_group_table_component.ex:41 | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.ex:70 | #: lib/cannery_web/live/ammo_group_live/index.ex:75 | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.ex:79 | #: lib/cannery_web/live/ammo_group_live/index.ex:84 | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:3 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:3 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Ammo" | msgid "Ammo" | ||||||
| @@ -262,7 +262,7 @@ msgstr "Nueva Invitación" | |||||||
| msgid "New Tag" | msgid "New Tag" | ||||||
| msgstr "Nueva Etiqueta" | msgstr "Nueva Etiqueta" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:92 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:94 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "No Ammo" | msgid "No Ammo" | ||||||
| msgstr "Sin Munición" | msgstr "Sin Munición" | ||||||
| @@ -402,16 +402,9 @@ msgstr "La página de seguimiento de armas autogestionada" | |||||||
| msgid "Tracer" | msgid "Tracer" | ||||||
| msgstr "Trazadora" | msgstr "Trazadora" | ||||||
|  |  | ||||||
| #: lib/cannery_web/components/ammo_type_table_component.ex:150 |  | ||||||
| #: lib/cannery_web/components/container_table_component.ex:48 | #: lib/cannery_web/components/container_table_component.ex:48 | ||||||
| #: lib/cannery_web/components/move_ammo_group_component.ex:68 | #: lib/cannery_web/components/move_ammo_group_component.ex:68 | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:50 |  | ||||||
| #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:21 |  | ||||||
| #: lib/cannery_web/live/ammo_type_live/index.html.heex:29 |  | ||||||
| #: lib/cannery_web/live/ammo_type_live/show.html.heex:48 |  | ||||||
| #: lib/cannery_web/live/container_live/form_component.html.heex:39 | #: lib/cannery_web/live/container_live/form_component.html.heex:39 | ||||||
| #: lib/cannery_web/live/container_live/show.html.heex:97 |  | ||||||
| #: lib/cannery_web/live/range_live/index.html.heex:86 |  | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Type" | msgid "Type" | ||||||
| msgstr "Tipo" | msgstr "Tipo" | ||||||
| @@ -472,7 +465,7 @@ msgid "No ammo staged" | |||||||
| msgstr "No hay munición preparada" | msgstr "No hay munición preparada" | ||||||
|  |  | ||||||
| #: lib/cannery_web/components/add_shot_group_component.html.heex:3 | #: lib/cannery_web/components/add_shot_group_component.html.heex:3 | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.ex:30 | #: lib/cannery_web/live/ammo_group_live/index.ex:35 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Record shots" | msgid "Record shots" | ||||||
| msgstr "Tiros récord" | msgstr "Tiros récord" | ||||||
| @@ -513,7 +506,7 @@ msgstr "Balas disparadas" | |||||||
| msgid "Shot Records" | msgid "Shot Records" | ||||||
| msgstr "Récords de Tiro" | msgstr "Récords de Tiro" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.ex:38 | #: lib/cannery_web/live/ammo_group_live/index.ex:43 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Move ammo" | msgid "Move ammo" | ||||||
| msgstr "Mover munición" | msgstr "Mover munición" | ||||||
| @@ -804,7 +797,7 @@ msgstr "" | |||||||
| msgid "Container:" | msgid "Container:" | ||||||
| msgstr "Contenedor:" | msgstr "Contenedor:" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:85 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:87 | ||||||
| #: lib/cannery_web/live/ammo_type_live/index.html.heex:64 | #: lib/cannery_web/live/ammo_type_live/index.html.heex:64 | ||||||
| #: lib/cannery_web/live/ammo_type_live/show.html.heex:166 | #: lib/cannery_web/live/ammo_type_live/show.html.heex:166 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| @@ -1056,7 +1049,7 @@ msgstr "Comprada en" | |||||||
| msgid "Purchased on:" | msgid "Purchased on:" | ||||||
| msgstr "Comprada en:" | msgstr "Comprada en:" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.ex:46 | #: lib/cannery_web/live/ammo_group_live/index.ex:51 | ||||||
| #, elixir-autogen, elixir-format, fuzzy | #, elixir-autogen, elixir-format, fuzzy | ||||||
| msgid "Edit ammo" | msgid "Edit ammo" | ||||||
| msgstr "Editar munición" | msgstr "Editar munición" | ||||||
| @@ -1072,7 +1065,7 @@ msgstr "Sin tipo de Munición" | |||||||
| msgid "Search catalog" | msgid "Search catalog" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:79 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:81 | ||||||
| #, elixir-autogen, elixir-format, fuzzy | #, elixir-autogen, elixir-format, fuzzy | ||||||
| msgid "Search ammo" | msgid "Search ammo" | ||||||
| msgstr "" | msgstr "" | ||||||
| @@ -1258,7 +1251,7 @@ msgstr "" | |||||||
| msgid "Close modal" | msgid "Close modal" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:56 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:58 | ||||||
| #: lib/cannery_web/live/ammo_type_live/index.html.heex:35 | #: lib/cannery_web/live/ammo_type_live/index.html.heex:35 | ||||||
| #: lib/cannery_web/live/container_live/show.html.heex:103 | #: lib/cannery_web/live/container_live/show.html.heex:103 | ||||||
| #: lib/cannery_web/live/range_live/index.html.heex:92 | #: lib/cannery_web/live/range_live/index.html.heex:92 | ||||||
| @@ -1342,7 +1335,7 @@ msgstr "Sin Munición" | |||||||
| msgid "None specified" | msgid "None specified" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:59 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:61 | ||||||
| #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:25 | #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:25 | ||||||
| #: lib/cannery_web/live/ammo_type_live/index.html.heex:38 | #: lib/cannery_web/live/ammo_type_live/index.html.heex:38 | ||||||
| #: lib/cannery_web/live/ammo_type_live/show.html.heex:58 | #: lib/cannery_web/live/ammo_type_live/show.html.heex:58 | ||||||
| @@ -1367,7 +1360,7 @@ msgstr "Tipo de espoleta" | |||||||
| msgid "Projectile" | msgid "Projectile" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:57 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:59 | ||||||
| #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:25 | #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:25 | ||||||
| #: lib/cannery_web/live/ammo_type_live/index.html.heex:36 | #: lib/cannery_web/live/ammo_type_live/index.html.heex:36 | ||||||
| #: lib/cannery_web/live/ammo_type_live/show.html.heex:56 | #: lib/cannery_web/live/ammo_type_live/show.html.heex:56 | ||||||
| @@ -1421,7 +1414,7 @@ msgstr "" | |||||||
| msgid "Shot type:" | msgid "Shot type:" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:58 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:60 | ||||||
| #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:25 | #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:25 | ||||||
| #: lib/cannery_web/live/ammo_type_live/index.html.heex:37 | #: lib/cannery_web/live/ammo_type_live/index.html.heex:37 | ||||||
| #: lib/cannery_web/live/ammo_type_live/show.html.heex:54 | #: lib/cannery_web/live/ammo_type_live/show.html.heex:54 | ||||||
| @@ -1463,3 +1456,14 @@ msgstr "" | |||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Wadding:" | msgid "Wadding:" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
|  | #: lib/cannery_web/components/ammo_type_table_component.ex:150 | ||||||
|  | #: lib/cannery_web/live/ammo_group_live/index.html.heex:50 | ||||||
|  | #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:21 | ||||||
|  | #: lib/cannery_web/live/ammo_type_live/index.html.heex:29 | ||||||
|  | #: lib/cannery_web/live/ammo_type_live/show.html.heex:48 | ||||||
|  | #: lib/cannery_web/live/container_live/show.html.heex:97 | ||||||
|  | #: lib/cannery_web/live/range_live/index.html.heex:86 | ||||||
|  | #, elixir-autogen, elixir-format | ||||||
|  | msgid "Class" | ||||||
|  | msgstr "" | ||||||
|   | |||||||
| @@ -171,7 +171,7 @@ msgstr "No se ha podido procesar el número de copias" | |||||||
| msgid "Invalid number of copies, must be between 1 and %{max}. Was %{multiplier}" | msgid "Invalid number of copies, must be between 1 and %{max}. Was %{multiplier}" | ||||||
| msgstr "Número inválido de copias, debe ser entre 1 y %{max}. Fue %{multiplier" | msgstr "Número inválido de copias, debe ser entre 1 y %{max}. Fue %{multiplier" | ||||||
|  |  | ||||||
| #: lib/cannery/ammo.ex:1114 | #: lib/cannery/ammo.ex:1123 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Invalid multiplier" | msgid "Invalid multiplier" | ||||||
| msgstr "Multiplicador inválido" | msgstr "Multiplicador inválido" | ||||||
|   | |||||||
| @@ -73,7 +73,7 @@ msgstr "Está seguro que desea eliminar %{email}? Esta acción es permanente!" | |||||||
| msgid "Are you sure you want to delete %{name}?" | msgid "Are you sure you want to delete %{name}?" | ||||||
| msgstr "Está seguro que desea eliminar %{name}?" | msgstr "Está seguro que desea eliminar %{name}?" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:189 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:191 | ||||||
| #: lib/cannery_web/live/ammo_group_live/show.html.heex:74 | #: lib/cannery_web/live/ammo_group_live/show.html.heex:74 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Are you sure you want to delete this ammo?" | msgid "Are you sure you want to delete this ammo?" | ||||||
| @@ -233,7 +233,7 @@ msgstr "¿Está segure de que quiere cambiar el idioma?" | |||||||
| msgid "Language updated successfully." | msgid "Language updated successfully." | ||||||
| msgstr "Idioma cambiado exitosamente." | msgstr "Idioma cambiado exitosamente." | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.ex:89 | #: lib/cannery_web/live/ammo_group_live/index.ex:94 | ||||||
| #: lib/cannery_web/live/ammo_group_live/show.ex:55 | #: lib/cannery_web/live/ammo_group_live/show.ex:55 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Ammo deleted succesfully" | msgid "Ammo deleted succesfully" | ||||||
|   | |||||||
| @@ -23,8 +23,8 @@ msgstr "" | |||||||
| # # Run "mix gettext.extract" to bring this file up to | # # Run "mix gettext.extract" to bring this file up to | ||||||
| # # date. Leave "msgstr"s empty as changing them here has no | # # date. Leave "msgstr"s empty as changing them here has no | ||||||
| # # effect: edit them in PO (.po) files instead. | # # effect: edit them in PO (.po) files instead. | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.ex:54 | #: lib/cannery_web/live/ammo_group_live/index.ex:59 | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.ex:62 | #: lib/cannery_web/live/ammo_group_live/index.ex:67 | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:38 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:38 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Add Ammo" | msgid "Add Ammo" | ||||||
| @@ -169,7 +169,7 @@ msgstr "Munition préparée" | |||||||
| msgid "Why not get some ready to shoot?" | msgid "Why not get some ready to shoot?" | ||||||
| msgstr "Pourquoi pas en préparer pour tirer ?" | msgstr "Pourquoi pas en préparer pour tirer ?" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:125 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:127 | ||||||
| #: lib/cannery_web/live/ammo_group_live/show.html.heex:103 | #: lib/cannery_web/live/ammo_group_live/show.html.heex:103 | ||||||
| #: lib/cannery_web/live/range_live/index.html.heex:45 | #: lib/cannery_web/live/range_live/index.html.heex:45 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| @@ -222,7 +222,7 @@ msgid "add an ammo type first" | |||||||
| msgstr "Ajoutez d'abord un type de munitions" | msgstr "Ajoutez d'abord un type de munitions" | ||||||
|  |  | ||||||
| #: lib/cannery_web/components/move_ammo_group_component.ex:80 | #: lib/cannery_web/components/move_ammo_group_component.ex:80 | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:142 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:144 | ||||||
| #: lib/cannery_web/live/ammo_group_live/show.html.heex:96 | #: lib/cannery_web/live/ammo_group_live/show.html.heex:96 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Move ammo" | msgid "Move ammo" | ||||||
| @@ -313,7 +313,7 @@ msgstr "" | |||||||
| msgid "Edit %{tag_name}" | msgid "Edit %{tag_name}" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:164 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:166 | ||||||
| #: lib/cannery_web/live/ammo_group_live/show.html.heex:62 | #: lib/cannery_web/live/ammo_group_live/show.html.heex:62 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Edit ammo group of %{ammo_group_count} bullets" | msgid "Edit ammo group of %{ammo_group_count} bullets" | ||||||
| @@ -334,7 +334,7 @@ msgstr "" | |||||||
| msgid "Edit shot record of %{shot_group_count} shots" | msgid "Edit shot record of %{shot_group_count} shots" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:118 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:120 | ||||||
| #, elixir-autogen, elixir-format, fuzzy | #, elixir-autogen, elixir-format, fuzzy | ||||||
| msgid "Stage" | msgid "Stage" | ||||||
| msgstr "Munition préparée" | msgstr "Munition préparée" | ||||||
| @@ -345,7 +345,7 @@ msgstr "Munition préparée" | |||||||
| msgid "Tag %{container_name}" | msgid "Tag %{container_name}" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:117 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:119 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Unstage" | msgid "Unstage" | ||||||
| msgstr "" | msgstr "" | ||||||
| @@ -355,18 +355,18 @@ msgstr "" | |||||||
| msgid "View %{ammo_type_name}" | msgid "View %{ammo_type_name}" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:176 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:178 | ||||||
| #, elixir-autogen, elixir-format, fuzzy | #, elixir-autogen, elixir-format, fuzzy | ||||||
| msgid "Clone ammo group of %{ammo_group_count} bullets" | msgid "Clone ammo group of %{ammo_group_count} bullets" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:191 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:193 | ||||||
| #: lib/cannery_web/live/ammo_group_live/show.html.heex:76 | #: lib/cannery_web/live/ammo_group_live/show.html.heex:76 | ||||||
| #, elixir-autogen, elixir-format, fuzzy | #, elixir-autogen, elixir-format, fuzzy | ||||||
| msgid "Delete ammo group of %{ammo_group_count} bullets" | msgid "Delete ammo group of %{ammo_group_count} bullets" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:152 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:154 | ||||||
| #: lib/cannery_web/live/ammo_type_live/show.html.heex:206 | #: lib/cannery_web/live/ammo_type_live/show.html.heex:206 | ||||||
| #, elixir-autogen, elixir-format, fuzzy | #, elixir-autogen, elixir-format, fuzzy | ||||||
| msgid "View ammo group of %{ammo_group_count} bullets" | msgid "View ammo group of %{ammo_group_count} bullets" | ||||||
|   | |||||||
| @@ -31,8 +31,8 @@ msgstr "Administrateur·ices :" | |||||||
|  |  | ||||||
| #: lib/cannery_web/components/core_components/topbar.html.heex:58 | #: lib/cannery_web/components/core_components/topbar.html.heex:58 | ||||||
| #: lib/cannery_web/components/shot_group_table_component.ex:41 | #: lib/cannery_web/components/shot_group_table_component.ex:41 | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.ex:70 | #: lib/cannery_web/live/ammo_group_live/index.ex:75 | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.ex:79 | #: lib/cannery_web/live/ammo_group_live/index.ex:84 | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:3 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:3 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Ammo" | msgid "Ammo" | ||||||
| @@ -262,7 +262,7 @@ msgstr "Nouvelle invitation" | |||||||
| msgid "New Tag" | msgid "New Tag" | ||||||
| msgstr "Nouveau tag" | msgstr "Nouveau tag" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:92 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:94 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "No Ammo" | msgid "No Ammo" | ||||||
| msgstr "Aucune munition" | msgstr "Aucune munition" | ||||||
| @@ -403,16 +403,9 @@ msgstr "Le site web de suivi d’arme à feux auto-hébergé" | |||||||
| msgid "Tracer" | msgid "Tracer" | ||||||
| msgstr "Traceuse" | msgstr "Traceuse" | ||||||
|  |  | ||||||
| #: lib/cannery_web/components/ammo_type_table_component.ex:150 |  | ||||||
| #: lib/cannery_web/components/container_table_component.ex:48 | #: lib/cannery_web/components/container_table_component.ex:48 | ||||||
| #: lib/cannery_web/components/move_ammo_group_component.ex:68 | #: lib/cannery_web/components/move_ammo_group_component.ex:68 | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:50 |  | ||||||
| #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:21 |  | ||||||
| #: lib/cannery_web/live/ammo_type_live/index.html.heex:29 |  | ||||||
| #: lib/cannery_web/live/ammo_type_live/show.html.heex:48 |  | ||||||
| #: lib/cannery_web/live/container_live/form_component.html.heex:39 | #: lib/cannery_web/live/container_live/form_component.html.heex:39 | ||||||
| #: lib/cannery_web/live/container_live/show.html.heex:97 |  | ||||||
| #: lib/cannery_web/live/range_live/index.html.heex:86 |  | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Type" | msgid "Type" | ||||||
| msgstr "Type" | msgstr "Type" | ||||||
| @@ -473,7 +466,7 @@ msgid "No ammo staged" | |||||||
| msgstr "Aucune munition sélectionnée" | msgstr "Aucune munition sélectionnée" | ||||||
|  |  | ||||||
| #: lib/cannery_web/components/add_shot_group_component.html.heex:3 | #: lib/cannery_web/components/add_shot_group_component.html.heex:3 | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.ex:30 | #: lib/cannery_web/live/ammo_group_live/index.ex:35 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Record shots" | msgid "Record shots" | ||||||
| msgstr "Tirs enregistrés" | msgstr "Tirs enregistrés" | ||||||
| @@ -514,7 +507,7 @@ msgstr "Cartouches tirées" | |||||||
| msgid "Shot Records" | msgid "Shot Records" | ||||||
| msgstr "Enregistrements de tir" | msgstr "Enregistrements de tir" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.ex:38 | #: lib/cannery_web/live/ammo_group_live/index.ex:43 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Move ammo" | msgid "Move ammo" | ||||||
| msgstr "Déplacer munition" | msgstr "Déplacer munition" | ||||||
| @@ -805,7 +798,7 @@ msgstr "" | |||||||
| msgid "Container:" | msgid "Container:" | ||||||
| msgstr "Conteneur" | msgstr "Conteneur" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:85 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:87 | ||||||
| #: lib/cannery_web/live/ammo_type_live/index.html.heex:64 | #: lib/cannery_web/live/ammo_type_live/index.html.heex:64 | ||||||
| #: lib/cannery_web/live/ammo_type_live/show.html.heex:166 | #: lib/cannery_web/live/ammo_type_live/show.html.heex:166 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| @@ -1057,7 +1050,7 @@ msgstr "" | |||||||
| msgid "Purchased on:" | msgid "Purchased on:" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.ex:46 | #: lib/cannery_web/live/ammo_group_live/index.ex:51 | ||||||
| #, elixir-autogen, elixir-format, fuzzy | #, elixir-autogen, elixir-format, fuzzy | ||||||
| msgid "Edit ammo" | msgid "Edit ammo" | ||||||
| msgstr "Éditer le type de munition" | msgstr "Éditer le type de munition" | ||||||
| @@ -1073,7 +1066,7 @@ msgstr "Aucun type de munition" | |||||||
| msgid "Search catalog" | msgid "Search catalog" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:79 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:81 | ||||||
| #, elixir-autogen, elixir-format, fuzzy | #, elixir-autogen, elixir-format, fuzzy | ||||||
| msgid "Search ammo" | msgid "Search ammo" | ||||||
| msgstr "" | msgstr "" | ||||||
| @@ -1259,7 +1252,7 @@ msgstr "" | |||||||
| msgid "Close modal" | msgid "Close modal" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:56 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:58 | ||||||
| #: lib/cannery_web/live/ammo_type_live/index.html.heex:35 | #: lib/cannery_web/live/ammo_type_live/index.html.heex:35 | ||||||
| #: lib/cannery_web/live/container_live/show.html.heex:103 | #: lib/cannery_web/live/container_live/show.html.heex:103 | ||||||
| #: lib/cannery_web/live/range_live/index.html.heex:92 | #: lib/cannery_web/live/range_live/index.html.heex:92 | ||||||
| @@ -1343,7 +1336,7 @@ msgstr "Aucune munition" | |||||||
| msgid "None specified" | msgid "None specified" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:59 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:61 | ||||||
| #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:25 | #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:25 | ||||||
| #: lib/cannery_web/live/ammo_type_live/index.html.heex:38 | #: lib/cannery_web/live/ammo_type_live/index.html.heex:38 | ||||||
| #: lib/cannery_web/live/ammo_type_live/show.html.heex:58 | #: lib/cannery_web/live/ammo_type_live/show.html.heex:58 | ||||||
| @@ -1368,7 +1361,7 @@ msgstr "Type d’amorce" | |||||||
| msgid "Projectile" | msgid "Projectile" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:57 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:59 | ||||||
| #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:25 | #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:25 | ||||||
| #: lib/cannery_web/live/ammo_type_live/index.html.heex:36 | #: lib/cannery_web/live/ammo_type_live/index.html.heex:36 | ||||||
| #: lib/cannery_web/live/ammo_type_live/show.html.heex:56 | #: lib/cannery_web/live/ammo_type_live/show.html.heex:56 | ||||||
| @@ -1422,7 +1415,7 @@ msgstr "" | |||||||
| msgid "Shot type:" | msgid "Shot type:" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:58 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:60 | ||||||
| #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:25 | #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:25 | ||||||
| #: lib/cannery_web/live/ammo_type_live/index.html.heex:37 | #: lib/cannery_web/live/ammo_type_live/index.html.heex:37 | ||||||
| #: lib/cannery_web/live/ammo_type_live/show.html.heex:54 | #: lib/cannery_web/live/ammo_type_live/show.html.heex:54 | ||||||
| @@ -1464,3 +1457,14 @@ msgstr "" | |||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Wadding:" | msgid "Wadding:" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
|  | #: lib/cannery_web/components/ammo_type_table_component.ex:150 | ||||||
|  | #: lib/cannery_web/live/ammo_group_live/index.html.heex:50 | ||||||
|  | #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:21 | ||||||
|  | #: lib/cannery_web/live/ammo_type_live/index.html.heex:29 | ||||||
|  | #: lib/cannery_web/live/ammo_type_live/show.html.heex:48 | ||||||
|  | #: lib/cannery_web/live/container_live/show.html.heex:97 | ||||||
|  | #: lib/cannery_web/live/range_live/index.html.heex:86 | ||||||
|  | #, elixir-autogen, elixir-format | ||||||
|  | msgid "Class" | ||||||
|  | msgstr "" | ||||||
|   | |||||||
| @@ -172,7 +172,7 @@ msgstr "Impossible d'analyser le nombre de copies" | |||||||
| msgid "Invalid number of copies, must be between 1 and %{max}. Was %{multiplier}" | 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}" | msgstr "Nombre de copies invalide, doit être 1 et %{max}. Été %{multiplier}" | ||||||
|  |  | ||||||
| #: lib/cannery/ammo.ex:1114 | #: lib/cannery/ammo.ex:1123 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Invalid multiplier" | msgid "Invalid multiplier" | ||||||
| msgstr "Multiplicateur invalide" | msgstr "Multiplicateur invalide" | ||||||
|   | |||||||
| @@ -74,7 +74,7 @@ msgstr "" | |||||||
| msgid "Are you sure you want to delete %{name}?" | msgid "Are you sure you want to delete %{name}?" | ||||||
| msgstr "Êtes-vous certain·e de supprimer %{name} ?" | msgstr "Êtes-vous certain·e de supprimer %{name} ?" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:189 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:191 | ||||||
| #: lib/cannery_web/live/ammo_group_live/show.html.heex:74 | #: lib/cannery_web/live/ammo_group_live/show.html.heex:74 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Are you sure you want to delete this ammo?" | msgid "Are you sure you want to delete this ammo?" | ||||||
| @@ -235,7 +235,7 @@ msgstr "Êtes-vous certain·e de vouloir changer votre langue ?" | |||||||
| msgid "Language updated successfully." | msgid "Language updated successfully." | ||||||
| msgstr "Langue mise à jour avec succès." | msgstr "Langue mise à jour avec succès." | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.ex:89 | #: lib/cannery_web/live/ammo_group_live/index.ex:94 | ||||||
| #: lib/cannery_web/live/ammo_group_live/show.ex:55 | #: lib/cannery_web/live/ammo_group_live/show.ex:55 | ||||||
| #, elixir-autogen, elixir-format, fuzzy | #, elixir-autogen, elixir-format, fuzzy | ||||||
| msgid "Ammo deleted succesfully" | msgid "Ammo deleted succesfully" | ||||||
|   | |||||||
| @@ -21,8 +21,8 @@ msgstr "" | |||||||
| ## Run "mix gettext.extract" to bring this file up to | ## Run "mix gettext.extract" to bring this file up to | ||||||
| ## date. Leave "msgstr"s empty as changing them here has no | ## date. Leave "msgstr"s empty as changing them here has no | ||||||
| ## effect: edit them in PO (.po) files instead. | ## effect: edit them in PO (.po) files instead. | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.ex:54 | #: lib/cannery_web/live/ammo_group_live/index.ex:59 | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.ex:62 | #: lib/cannery_web/live/ammo_group_live/index.ex:67 | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:38 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:38 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Add Ammo" | msgid "Add Ammo" | ||||||
| @@ -167,7 +167,7 @@ msgstr "" | |||||||
| msgid "Why not get some ready to shoot?" | msgid "Why not get some ready to shoot?" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:125 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:127 | ||||||
| #: lib/cannery_web/live/ammo_group_live/show.html.heex:103 | #: lib/cannery_web/live/ammo_group_live/show.html.heex:103 | ||||||
| #: lib/cannery_web/live/range_live/index.html.heex:45 | #: lib/cannery_web/live/range_live/index.html.heex:45 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| @@ -220,7 +220,7 @@ msgid "add an ammo type first" | |||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/components/move_ammo_group_component.ex:80 | #: lib/cannery_web/components/move_ammo_group_component.ex:80 | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:142 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:144 | ||||||
| #: lib/cannery_web/live/ammo_group_live/show.html.heex:96 | #: lib/cannery_web/live/ammo_group_live/show.html.heex:96 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Move ammo" | msgid "Move ammo" | ||||||
| @@ -311,7 +311,7 @@ msgstr "" | |||||||
| msgid "Edit %{tag_name}" | msgid "Edit %{tag_name}" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:164 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:166 | ||||||
| #: lib/cannery_web/live/ammo_group_live/show.html.heex:62 | #: lib/cannery_web/live/ammo_group_live/show.html.heex:62 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Edit ammo group of %{ammo_group_count} bullets" | msgid "Edit ammo group of %{ammo_group_count} bullets" | ||||||
| @@ -332,7 +332,7 @@ msgstr "" | |||||||
| msgid "Edit shot record of %{shot_group_count} shots" | msgid "Edit shot record of %{shot_group_count} shots" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:118 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:120 | ||||||
| #, elixir-autogen, elixir-format, fuzzy | #, elixir-autogen, elixir-format, fuzzy | ||||||
| msgid "Stage" | msgid "Stage" | ||||||
| msgstr "" | msgstr "" | ||||||
| @@ -343,7 +343,7 @@ msgstr "" | |||||||
| msgid "Tag %{container_name}" | msgid "Tag %{container_name}" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:117 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:119 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Unstage" | msgid "Unstage" | ||||||
| msgstr "" | msgstr "" | ||||||
| @@ -353,18 +353,18 @@ msgstr "" | |||||||
| msgid "View %{ammo_type_name}" | msgid "View %{ammo_type_name}" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:176 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:178 | ||||||
| #, elixir-autogen, elixir-format, fuzzy | #, elixir-autogen, elixir-format, fuzzy | ||||||
| msgid "Clone ammo group of %{ammo_group_count} bullets" | msgid "Clone ammo group of %{ammo_group_count} bullets" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:191 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:193 | ||||||
| #: lib/cannery_web/live/ammo_group_live/show.html.heex:76 | #: lib/cannery_web/live/ammo_group_live/show.html.heex:76 | ||||||
| #, elixir-autogen, elixir-format, fuzzy | #, elixir-autogen, elixir-format, fuzzy | ||||||
| msgid "Delete ammo group of %{ammo_group_count} bullets" | msgid "Delete ammo group of %{ammo_group_count} bullets" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:152 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:154 | ||||||
| #: lib/cannery_web/live/ammo_type_live/show.html.heex:206 | #: lib/cannery_web/live/ammo_type_live/show.html.heex:206 | ||||||
| #, elixir-autogen, elixir-format, fuzzy | #, elixir-autogen, elixir-format, fuzzy | ||||||
| msgid "View ammo group of %{ammo_group_count} bullets" | msgid "View ammo group of %{ammo_group_count} bullets" | ||||||
|   | |||||||
| @@ -29,8 +29,8 @@ msgstr "" | |||||||
|  |  | ||||||
| #: lib/cannery_web/components/core_components/topbar.html.heex:58 | #: lib/cannery_web/components/core_components/topbar.html.heex:58 | ||||||
| #: lib/cannery_web/components/shot_group_table_component.ex:41 | #: lib/cannery_web/components/shot_group_table_component.ex:41 | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.ex:70 | #: lib/cannery_web/live/ammo_group_live/index.ex:75 | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.ex:79 | #: lib/cannery_web/live/ammo_group_live/index.ex:84 | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:3 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:3 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Ammo" | msgid "Ammo" | ||||||
| @@ -260,7 +260,7 @@ msgstr "" | |||||||
| msgid "New Tag" | msgid "New Tag" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:92 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:94 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "No Ammo" | msgid "No Ammo" | ||||||
| msgstr "" | msgstr "" | ||||||
| @@ -397,16 +397,9 @@ msgstr "" | |||||||
| msgid "Tracer" | msgid "Tracer" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/components/ammo_type_table_component.ex:150 |  | ||||||
| #: lib/cannery_web/components/container_table_component.ex:48 | #: lib/cannery_web/components/container_table_component.ex:48 | ||||||
| #: lib/cannery_web/components/move_ammo_group_component.ex:68 | #: lib/cannery_web/components/move_ammo_group_component.ex:68 | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:50 |  | ||||||
| #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:21 |  | ||||||
| #: lib/cannery_web/live/ammo_type_live/index.html.heex:29 |  | ||||||
| #: lib/cannery_web/live/ammo_type_live/show.html.heex:48 |  | ||||||
| #: lib/cannery_web/live/container_live/form_component.html.heex:39 | #: lib/cannery_web/live/container_live/form_component.html.heex:39 | ||||||
| #: lib/cannery_web/live/container_live/show.html.heex:97 |  | ||||||
| #: lib/cannery_web/live/range_live/index.html.heex:86 |  | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Type" | msgid "Type" | ||||||
| msgstr "" | msgstr "" | ||||||
| @@ -467,7 +460,7 @@ msgid "No ammo staged" | |||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/components/add_shot_group_component.html.heex:3 | #: lib/cannery_web/components/add_shot_group_component.html.heex:3 | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.ex:30 | #: lib/cannery_web/live/ammo_group_live/index.ex:35 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Record shots" | msgid "Record shots" | ||||||
| msgstr "" | msgstr "" | ||||||
| @@ -508,7 +501,7 @@ msgstr "" | |||||||
| msgid "Shot Records" | msgid "Shot Records" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.ex:38 | #: lib/cannery_web/live/ammo_group_live/index.ex:43 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Move ammo" | msgid "Move ammo" | ||||||
| msgstr "" | msgstr "" | ||||||
| @@ -798,7 +791,7 @@ msgstr "" | |||||||
| msgid "Container:" | msgid "Container:" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:85 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:87 | ||||||
| #: lib/cannery_web/live/ammo_type_live/index.html.heex:64 | #: lib/cannery_web/live/ammo_type_live/index.html.heex:64 | ||||||
| #: lib/cannery_web/live/ammo_type_live/show.html.heex:166 | #: lib/cannery_web/live/ammo_type_live/show.html.heex:166 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| @@ -1050,7 +1043,7 @@ msgstr "" | |||||||
| msgid "Purchased on:" | msgid "Purchased on:" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.ex:46 | #: lib/cannery_web/live/ammo_group_live/index.ex:51 | ||||||
| #, elixir-autogen, elixir-format, fuzzy | #, elixir-autogen, elixir-format, fuzzy | ||||||
| msgid "Edit ammo" | msgid "Edit ammo" | ||||||
| msgstr "" | msgstr "" | ||||||
| @@ -1066,7 +1059,7 @@ msgstr "" | |||||||
| msgid "Search catalog" | msgid "Search catalog" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:79 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:81 | ||||||
| #, elixir-autogen, elixir-format, fuzzy | #, elixir-autogen, elixir-format, fuzzy | ||||||
| msgid "Search ammo" | msgid "Search ammo" | ||||||
| msgstr "" | msgstr "" | ||||||
| @@ -1250,7 +1243,7 @@ msgstr "" | |||||||
| msgid "Close modal" | msgid "Close modal" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:56 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:58 | ||||||
| #: lib/cannery_web/live/ammo_type_live/index.html.heex:35 | #: lib/cannery_web/live/ammo_type_live/index.html.heex:35 | ||||||
| #: lib/cannery_web/live/container_live/show.html.heex:103 | #: lib/cannery_web/live/container_live/show.html.heex:103 | ||||||
| #: lib/cannery_web/live/range_live/index.html.heex:92 | #: lib/cannery_web/live/range_live/index.html.heex:92 | ||||||
| @@ -1334,7 +1327,7 @@ msgstr "" | |||||||
| msgid "None specified" | msgid "None specified" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:59 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:61 | ||||||
| #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:25 | #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:25 | ||||||
| #: lib/cannery_web/live/ammo_type_live/index.html.heex:38 | #: lib/cannery_web/live/ammo_type_live/index.html.heex:38 | ||||||
| #: lib/cannery_web/live/ammo_type_live/show.html.heex:58 | #: lib/cannery_web/live/ammo_type_live/show.html.heex:58 | ||||||
| @@ -1359,7 +1352,7 @@ msgstr "" | |||||||
| msgid "Projectile" | msgid "Projectile" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:57 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:59 | ||||||
| #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:25 | #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:25 | ||||||
| #: lib/cannery_web/live/ammo_type_live/index.html.heex:36 | #: lib/cannery_web/live/ammo_type_live/index.html.heex:36 | ||||||
| #: lib/cannery_web/live/ammo_type_live/show.html.heex:56 | #: lib/cannery_web/live/ammo_type_live/show.html.heex:56 | ||||||
| @@ -1413,7 +1406,7 @@ msgstr "" | |||||||
| msgid "Shot type:" | msgid "Shot type:" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:58 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:60 | ||||||
| #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:25 | #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:25 | ||||||
| #: lib/cannery_web/live/ammo_type_live/index.html.heex:37 | #: lib/cannery_web/live/ammo_type_live/index.html.heex:37 | ||||||
| #: lib/cannery_web/live/ammo_type_live/show.html.heex:54 | #: lib/cannery_web/live/ammo_type_live/show.html.heex:54 | ||||||
| @@ -1455,3 +1448,14 @@ msgstr "" | |||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Wadding:" | msgid "Wadding:" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
|  | #: lib/cannery_web/components/ammo_type_table_component.ex:150 | ||||||
|  | #: lib/cannery_web/live/ammo_group_live/index.html.heex:50 | ||||||
|  | #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:21 | ||||||
|  | #: lib/cannery_web/live/ammo_type_live/index.html.heex:29 | ||||||
|  | #: lib/cannery_web/live/ammo_type_live/show.html.heex:48 | ||||||
|  | #: lib/cannery_web/live/container_live/show.html.heex:97 | ||||||
|  | #: lib/cannery_web/live/range_live/index.html.heex:86 | ||||||
|  | #, elixir-autogen, elixir-format | ||||||
|  | msgid "Class" | ||||||
|  | msgstr "" | ||||||
|   | |||||||
| @@ -171,7 +171,7 @@ msgstr "" | |||||||
| msgid "Invalid number of copies, must be between 1 and %{max}. Was %{multiplier}" | msgid "Invalid number of copies, must be between 1 and %{max}. Was %{multiplier}" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery/ammo.ex:1114 | #: lib/cannery/ammo.ex:1123 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Invalid multiplier" | msgid "Invalid multiplier" | ||||||
| msgstr "" | msgstr "" | ||||||
|   | |||||||
| @@ -69,7 +69,7 @@ msgstr "" | |||||||
| msgid "Are you sure you want to delete %{name}?" | msgid "Are you sure you want to delete %{name}?" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:189 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:191 | ||||||
| #: lib/cannery_web/live/ammo_group_live/show.html.heex:74 | #: lib/cannery_web/live/ammo_group_live/show.html.heex:74 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Are you sure you want to delete this ammo?" | msgid "Are you sure you want to delete this ammo?" | ||||||
| @@ -224,7 +224,7 @@ msgstr "" | |||||||
| msgid "Language updated successfully." | msgid "Language updated successfully." | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.ex:89 | #: lib/cannery_web/live/ammo_group_live/index.ex:94 | ||||||
| #: lib/cannery_web/live/ammo_group_live/show.ex:55 | #: lib/cannery_web/live/ammo_group_live/show.ex:55 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Ammo deleted succesfully" | msgid "Ammo deleted succesfully" | ||||||
|   | |||||||
| @@ -58,7 +58,7 @@ msgstr "" | |||||||
| msgid "Are you sure you want to delete %{name}?" | msgid "Are you sure you want to delete %{name}?" | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.html.heex:189 | #: lib/cannery_web/live/ammo_group_live/index.html.heex:191 | ||||||
| #: lib/cannery_web/live/ammo_group_live/show.html.heex:74 | #: lib/cannery_web/live/ammo_group_live/show.html.heex:74 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Are you sure you want to delete this ammo?" | msgid "Are you sure you want to delete this ammo?" | ||||||
| @@ -213,7 +213,7 @@ msgstr "" | |||||||
| msgid "Language updated successfully." | msgid "Language updated successfully." | ||||||
| msgstr "" | msgstr "" | ||||||
|  |  | ||||||
| #: lib/cannery_web/live/ammo_group_live/index.ex:89 | #: lib/cannery_web/live/ammo_group_live/index.ex:94 | ||||||
| #: lib/cannery_web/live/ammo_group_live/show.ex:55 | #: lib/cannery_web/live/ammo_group_live/show.ex:55 | ||||||
| #, elixir-autogen, elixir-format | #, elixir-autogen, elixir-format | ||||||
| msgid "Ammo deleted succesfully" | msgid "Ammo deleted succesfully" | ||||||
|   | |||||||
| @@ -0,0 +1,7 @@ | |||||||
|  | defmodule Cannery.Repo.Migrations.RenameTypeToClass do | ||||||
|  |   use Ecto.Migration | ||||||
|  |  | ||||||
|  |   def change do | ||||||
|  |     rename table(:ammo_types), :type, to: :class | ||||||
|  |   end | ||||||
|  | end | ||||||
| @@ -11,11 +11,11 @@ defmodule Cannery.InvitesTest do | |||||||
|   @moduletag :invites_test |   @moduletag :invites_test | ||||||
|  |  | ||||||
|   @valid_attrs %{ |   @valid_attrs %{ | ||||||
|     "name" => "some name" |     name: "some name" | ||||||
|   } |   } | ||||||
|   @invalid_attrs %{ |   @invalid_attrs %{ | ||||||
|     "name" => nil, |     name: nil, | ||||||
|     "token" => nil |     token: nil | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   describe "invites" do |   describe "invites" do | ||||||
| @@ -57,7 +57,7 @@ defmodule Cannery.InvitesTest do | |||||||
|  |  | ||||||
|       assert {:ok, _user} = |       assert {:ok, _user} = | ||||||
|                Accounts.register_user( |                Accounts.register_user( | ||||||
|                  %{"email" => unique_user_email(), "password" => valid_user_password()}, |                  %{email: unique_user_email(), password: valid_user_password()}, | ||||||
|                  token |                  token | ||||||
|                ) |                ) | ||||||
|  |  | ||||||
| @@ -65,7 +65,7 @@ defmodule Cannery.InvitesTest do | |||||||
|  |  | ||||||
|       assert {:ok, _user} = |       assert {:ok, _user} = | ||||||
|                Accounts.register_user( |                Accounts.register_user( | ||||||
|                  %{"email" => unique_user_email(), "password" => valid_user_password()}, |                  %{email: unique_user_email(), password: valid_user_password()}, | ||||||
|                  token |                  token | ||||||
|                ) |                ) | ||||||
|  |  | ||||||
| @@ -81,13 +81,13 @@ defmodule Cannery.InvitesTest do | |||||||
|  |  | ||||||
|       assert {:ok, _user} = |       assert {:ok, _user} = | ||||||
|                Accounts.register_user( |                Accounts.register_user( | ||||||
|                  %{"email" => unique_user_email(), "password" => valid_user_password()}, |                  %{email: unique_user_email(), password: valid_user_password()}, | ||||||
|                  token |                  token | ||||||
|                ) |                ) | ||||||
|  |  | ||||||
|       assert {:ok, _user} = |       assert {:ok, _user} = | ||||||
|                Accounts.register_user( |                Accounts.register_user( | ||||||
|                  %{"email" => unique_user_email(), "password" => valid_user_password()}, |                  %{email: unique_user_email(), password: valid_user_password()}, | ||||||
|                  another_token |                  another_token | ||||||
|                ) |                ) | ||||||
|  |  | ||||||
| @@ -97,7 +97,7 @@ defmodule Cannery.InvitesTest do | |||||||
|  |  | ||||||
|       assert {:ok, _user} = |       assert {:ok, _user} = | ||||||
|                Accounts.register_user( |                Accounts.register_user( | ||||||
|                  %{"email" => unique_user_email(), "password" => valid_user_password()}, |                  %{email: unique_user_email(), password: valid_user_password()}, | ||||||
|                  token |                  token | ||||||
|                ) |                ) | ||||||
|  |  | ||||||
| @@ -138,21 +138,14 @@ defmodule Cannery.InvitesTest do | |||||||
|  |  | ||||||
|     test "create_invite/1 with valid data creates an unlimited invite", |     test "create_invite/1 with valid data creates an unlimited invite", | ||||||
|          %{current_user: current_user} do |          %{current_user: current_user} do | ||||||
|       assert {:ok, %Invite{} = invite} = |       assert {:ok, %Invite{} = invite} = Invites.create_invite(current_user, %{name: "some name"}) | ||||||
|                Invites.create_invite(current_user, %{ |  | ||||||
|                  "name" => "some name" |  | ||||||
|                }) |  | ||||||
|  |  | ||||||
|       assert invite.name == "some name" |       assert invite.name == "some name" | ||||||
|     end |     end | ||||||
|  |  | ||||||
|     test "create_invite/1 with valid data creates a limited invite", |     test "create_invite/1 with valid data creates a limited invite", | ||||||
|          %{current_user: current_user} do |          %{current_user: current_user} do | ||||||
|       assert {:ok, %Invite{} = invite} = |       assert {:ok, %Invite{} = invite} = | ||||||
|                Invites.create_invite(current_user, %{ |                Invites.create_invite(current_user, %{name: "some name", uses_left: 10}) | ||||||
|                  "name" => "some name", |  | ||||||
|                  "uses_left" => 10 |  | ||||||
|                }) |  | ||||||
|  |  | ||||||
|       assert invite.name == "some name" |       assert invite.name == "some name" | ||||||
|       assert invite.uses_left == 10 |       assert invite.uses_left == 10 | ||||||
| @@ -168,7 +161,7 @@ defmodule Cannery.InvitesTest do | |||||||
|       assert {:ok, %Invite{} = new_invite} = |       assert {:ok, %Invite{} = new_invite} = | ||||||
|                Invites.update_invite( |                Invites.update_invite( | ||||||
|                  invite, |                  invite, | ||||||
|                  %{"name" => "some updated name", "uses_left" => 5}, |                  %{name: "some updated name", uses_left: 5}, | ||||||
|                  current_user |                  current_user | ||||||
|                ) |                ) | ||||||
|  |  | ||||||
| @@ -178,12 +171,12 @@ defmodule Cannery.InvitesTest do | |||||||
|  |  | ||||||
|     test "update_invite/2 can set an invite to be unlimited", |     test "update_invite/2 can set an invite to be unlimited", | ||||||
|          %{invite: invite, current_user: current_user} do |          %{invite: invite, current_user: current_user} do | ||||||
|       {:ok, invite} = Invites.update_invite(invite, %{"uses_left" => 5}, current_user) |       {:ok, invite} = Invites.update_invite(invite, %{uses_left: 5}, current_user) | ||||||
|  |  | ||||||
|       assert {:ok, %Invite{} = new_invite} = |       assert {:ok, %Invite{} = new_invite} = | ||||||
|                Invites.update_invite( |                Invites.update_invite( | ||||||
|                  invite, |                  invite, | ||||||
|                  %{"name" => "some updated name", "uses_left" => nil}, |                  %{name: "some updated name", uses_left: nil}, | ||||||
|                  current_user |                  current_user | ||||||
|                ) |                ) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -63,8 +63,7 @@ defmodule Cannery.AccountsTest do | |||||||
|     end |     end | ||||||
|  |  | ||||||
|     test "validates email and password when given" do |     test "validates email and password when given" do | ||||||
|       {:error, changeset} = |       {:error, changeset} = Accounts.register_user(%{email: "not valid", password: "not valid"}) | ||||||
|         Accounts.register_user(%{"email" => "not valid", "password" => "not valid"}) |  | ||||||
|  |  | ||||||
|       assert %{ |       assert %{ | ||||||
|                email: ["must have the @ sign and no spaces"], |                email: ["must have the @ sign and no spaces"], | ||||||
| @@ -74,26 +73,25 @@ defmodule Cannery.AccountsTest do | |||||||
|  |  | ||||||
|     test "validates maximum values for email and password for security" do |     test "validates maximum values for email and password for security" do | ||||||
|       too_long = String.duplicate("db", 100) |       too_long = String.duplicate("db", 100) | ||||||
|       {:error, changeset} = Accounts.register_user(%{"email" => too_long, "password" => too_long}) |       {:error, changeset} = Accounts.register_user(%{email: too_long, password: too_long}) | ||||||
|       assert "should be at most 160 character(s)" in errors_on(changeset).email |       assert "should be at most 160 character(s)" in errors_on(changeset).email | ||||||
|       assert "should be at most 80 character(s)" in errors_on(changeset).password |       assert "should be at most 80 character(s)" in errors_on(changeset).password | ||||||
|     end |     end | ||||||
|  |  | ||||||
|     test "validates email uniqueness" do |     test "validates email uniqueness" do | ||||||
|       %{email: email} = user_fixture() |       %{email: email} = user_fixture() | ||||||
|       {:error, changeset} = Accounts.register_user(%{"email" => email}) |       {:error, changeset} = Accounts.register_user(%{email: email}) | ||||||
|       assert "has already been taken" in errors_on(changeset).email |       assert "has already been taken" in errors_on(changeset).email | ||||||
|  |  | ||||||
|       # Now try with the upper cased email too, to check that email case is ignored. |       # Now try with the upper cased email too, to check that email case is ignored. | ||||||
|       {:error, changeset} = Accounts.register_user(%{"email" => String.upcase(email)}) |       {:error, changeset} = Accounts.register_user(%{email: String.upcase(email)}) | ||||||
|       assert "has already been taken" in errors_on(changeset).email |       assert "has already been taken" in errors_on(changeset).email | ||||||
|     end |     end | ||||||
|  |  | ||||||
|     test "registers users with a hashed password" do |     test "registers users with a hashed password" do | ||||||
|       email = unique_user_email() |       email = unique_user_email() | ||||||
|  |  | ||||||
|       {:ok, user} = |       {:ok, user} = Accounts.register_user(%{email: email, password: valid_user_password()}) | ||||||
|         Accounts.register_user(%{"email" => email, "password" => valid_user_password()}) |  | ||||||
|  |  | ||||||
|       assert user.email == email |       assert user.email == email | ||||||
|       assert is_binary(user.hashed_password) |       assert is_binary(user.hashed_password) | ||||||
| @@ -103,11 +101,11 @@ defmodule Cannery.AccountsTest do | |||||||
|  |  | ||||||
|     test "records used invite during registration" do |     test "records used invite during registration" do | ||||||
|       {:ok, %{id: invite_id, token: token}} = |       {:ok, %{id: invite_id, token: token}} = | ||||||
|         admin_fixture() |> Invites.create_invite(%{"name" => "my invite"}) |         admin_fixture() |> Invites.create_invite(%{name: "my invite"}) | ||||||
|  |  | ||||||
|       assert {:ok, %{invite_id: ^invite_id}} = |       assert {:ok, %{invite_id: ^invite_id}} = | ||||||
|                Accounts.register_user( |                Accounts.register_user( | ||||||
|                  %{"email" => unique_user_email(), "password" => valid_user_password()}, |                  %{email: unique_user_email(), password: valid_user_password()}, | ||||||
|                  token |                  token | ||||||
|                ) |                ) | ||||||
|     end |     end | ||||||
| @@ -123,7 +121,7 @@ defmodule Cannery.AccountsTest do | |||||||
|       email = unique_user_email() |       email = unique_user_email() | ||||||
|       password = valid_user_password() |       password = valid_user_password() | ||||||
|  |  | ||||||
|       changeset = Accounts.change_user_registration(%{"email" => email, "password" => password}) |       changeset = Accounts.change_user_registration(%{email: email, password: password}) | ||||||
|  |  | ||||||
|       assert changeset.valid? |       assert changeset.valid? | ||||||
|       assert get_change(changeset, :email) == email |       assert get_change(changeset, :email) == email | ||||||
| @@ -151,7 +149,7 @@ defmodule Cannery.AccountsTest do | |||||||
|  |  | ||||||
|     test "validates email", %{user: user} do |     test "validates email", %{user: user} do | ||||||
|       {:error, changeset} = |       {:error, changeset} = | ||||||
|         Accounts.apply_user_email(user, valid_user_password(), %{"email" => "not valid"}) |         Accounts.apply_user_email(user, valid_user_password(), %{email: "not valid"}) | ||||||
|  |  | ||||||
|       assert %{email: ["must have the @ sign and no spaces"]} = errors_on(changeset) |       assert %{email: ["must have the @ sign and no spaces"]} = errors_on(changeset) | ||||||
|     end |     end | ||||||
| @@ -160,7 +158,7 @@ defmodule Cannery.AccountsTest do | |||||||
|       too_long = String.duplicate("db", 100) |       too_long = String.duplicate("db", 100) | ||||||
|  |  | ||||||
|       {:error, changeset} = |       {:error, changeset} = | ||||||
|         Accounts.apply_user_email(user, valid_user_password(), %{"email" => too_long}) |         Accounts.apply_user_email(user, valid_user_password(), %{email: too_long}) | ||||||
|  |  | ||||||
|       assert "should be at most 160 character(s)" in errors_on(changeset).email |       assert "should be at most 160 character(s)" in errors_on(changeset).email | ||||||
|     end |     end | ||||||
| @@ -169,21 +167,21 @@ defmodule Cannery.AccountsTest do | |||||||
|       %{email: email} = user_fixture() |       %{email: email} = user_fixture() | ||||||
|  |  | ||||||
|       {:error, changeset} = |       {:error, changeset} = | ||||||
|         Accounts.apply_user_email(user, valid_user_password(), %{"email" => email}) |         Accounts.apply_user_email(user, valid_user_password(), %{email: email}) | ||||||
|  |  | ||||||
|       assert "has already been taken" in errors_on(changeset).email |       assert "has already been taken" in errors_on(changeset).email | ||||||
|     end |     end | ||||||
|  |  | ||||||
|     test "validates current password", %{user: user} do |     test "validates current password", %{user: user} do | ||||||
|       {:error, changeset} = |       {:error, changeset} = | ||||||
|         Accounts.apply_user_email(user, "invalid", %{"email" => unique_user_email()}) |         Accounts.apply_user_email(user, "invalid", %{email: unique_user_email()}) | ||||||
|  |  | ||||||
|       assert %{current_password: ["is not valid"]} = errors_on(changeset) |       assert %{current_password: ["is not valid"]} = errors_on(changeset) | ||||||
|     end |     end | ||||||
|  |  | ||||||
|     test "applies the email without persisting it", %{user: user} do |     test "applies the email without persisting it", %{user: user} do | ||||||
|       email = unique_user_email() |       email = unique_user_email() | ||||||
|       {:ok, user} = Accounts.apply_user_email(user, valid_user_password(), %{"email" => email}) |       {:ok, user} = Accounts.apply_user_email(user, valid_user_password(), %{email: email}) | ||||||
|       assert user.email == email |       assert user.email == email | ||||||
|       assert Accounts.get_user!(user.id).email != email |       assert Accounts.get_user!(user.id).email != email | ||||||
|     end |     end | ||||||
| @@ -258,11 +256,7 @@ defmodule Cannery.AccountsTest do | |||||||
|     end |     end | ||||||
|  |  | ||||||
|     test "allows fields to be set" do |     test "allows fields to be set" do | ||||||
|       changeset = |       changeset = Accounts.change_user_password(%User{}, %{password: "new valid password"}) | ||||||
|         Accounts.change_user_password(%User{}, %{ |  | ||||||
|           "password" => "new valid password" |  | ||||||
|         }) |  | ||||||
|  |  | ||||||
|       assert changeset.valid? |       assert changeset.valid? | ||||||
|       assert get_change(changeset, :password) == "new valid password" |       assert get_change(changeset, :password) == "new valid password" | ||||||
|       assert is_nil(get_change(changeset, :hashed_password)) |       assert is_nil(get_change(changeset, :hashed_password)) | ||||||
| @@ -277,8 +271,8 @@ defmodule Cannery.AccountsTest do | |||||||
|     test "validates password", %{user: user} do |     test "validates password", %{user: user} do | ||||||
|       {:error, changeset} = |       {:error, changeset} = | ||||||
|         Accounts.update_user_password(user, valid_user_password(), %{ |         Accounts.update_user_password(user, valid_user_password(), %{ | ||||||
|           "password" => "not valid", |           password: "not valid", | ||||||
|           "password_confirmation" => "another" |           password_confirmation: "another" | ||||||
|         }) |         }) | ||||||
|  |  | ||||||
|       assert %{ |       assert %{ | ||||||
| @@ -291,14 +285,14 @@ defmodule Cannery.AccountsTest do | |||||||
|       too_long = String.duplicate("db", 100) |       too_long = String.duplicate("db", 100) | ||||||
|  |  | ||||||
|       {:error, changeset} = |       {:error, changeset} = | ||||||
|         Accounts.update_user_password(user, valid_user_password(), %{"password" => too_long}) |         Accounts.update_user_password(user, valid_user_password(), %{password: too_long}) | ||||||
|  |  | ||||||
|       assert "should be at most 80 character(s)" in errors_on(changeset).password |       assert "should be at most 80 character(s)" in errors_on(changeset).password | ||||||
|     end |     end | ||||||
|  |  | ||||||
|     test "validates current password", %{user: user} do |     test "validates current password", %{user: user} do | ||||||
|       {:error, changeset} = |       {:error, changeset} = | ||||||
|         Accounts.update_user_password(user, "invalid", %{"password" => valid_user_password()}) |         Accounts.update_user_password(user, "invalid", %{password: valid_user_password()}) | ||||||
|  |  | ||||||
|       assert %{current_password: ["is not valid"]} = errors_on(changeset) |       assert %{current_password: ["is not valid"]} = errors_on(changeset) | ||||||
|     end |     end | ||||||
| @@ -306,7 +300,7 @@ defmodule Cannery.AccountsTest do | |||||||
|     test "updates the password", %{user: user} do |     test "updates the password", %{user: user} do | ||||||
|       {:ok, user} = |       {:ok, user} = | ||||||
|         Accounts.update_user_password(user, valid_user_password(), %{ |         Accounts.update_user_password(user, valid_user_password(), %{ | ||||||
|           "password" => "new valid password" |           password: "new valid password" | ||||||
|         }) |         }) | ||||||
|  |  | ||||||
|       assert is_nil(user.password) |       assert is_nil(user.password) | ||||||
| @@ -318,7 +312,7 @@ defmodule Cannery.AccountsTest do | |||||||
|  |  | ||||||
|       {:ok, _} = |       {:ok, _} = | ||||||
|         Accounts.update_user_password(user, valid_user_password(), %{ |         Accounts.update_user_password(user, valid_user_password(), %{ | ||||||
|           "password" => "new valid password" |           password: "new valid password" | ||||||
|         }) |         }) | ||||||
|  |  | ||||||
|       refute Repo.get_by(UserToken, user_id: user.id) |       refute Repo.get_by(UserToken, user_id: user.id) | ||||||
| @@ -486,8 +480,8 @@ defmodule Cannery.AccountsTest do | |||||||
|     test "validates password", %{user: user} do |     test "validates password", %{user: user} do | ||||||
|       {:error, changeset} = |       {:error, changeset} = | ||||||
|         Accounts.reset_user_password(user, %{ |         Accounts.reset_user_password(user, %{ | ||||||
|           "password" => "not valid", |           password: "not valid", | ||||||
|           "password_confirmation" => "another" |           password_confirmation: "another" | ||||||
|         }) |         }) | ||||||
|  |  | ||||||
|       assert %{ |       assert %{ | ||||||
| @@ -498,13 +492,12 @@ defmodule Cannery.AccountsTest do | |||||||
|  |  | ||||||
|     test "validates maximum values for password for security", %{user: user} do |     test "validates maximum values for password for security", %{user: user} do | ||||||
|       too_long = String.duplicate("db", 100) |       too_long = String.duplicate("db", 100) | ||||||
|       {:error, changeset} = Accounts.reset_user_password(user, %{"password" => too_long}) |       {:error, changeset} = Accounts.reset_user_password(user, %{password: too_long}) | ||||||
|       assert "should be at most 80 character(s)" in errors_on(changeset).password |       assert "should be at most 80 character(s)" in errors_on(changeset).password | ||||||
|     end |     end | ||||||
|  |  | ||||||
|     test "updates the password", %{user: user} do |     test "updates the password", %{user: user} do | ||||||
|       {:ok, updated_user} = |       {:ok, updated_user} = Accounts.reset_user_password(user, %{password: "new valid password"}) | ||||||
|         Accounts.reset_user_password(user, %{"password" => "new valid password"}) |  | ||||||
|  |  | ||||||
|       assert is_nil(updated_user.password) |       assert is_nil(updated_user.password) | ||||||
|       assert Accounts.get_user_by_email_and_password(user.email, "new valid password") |       assert Accounts.get_user_by_email_and_password(user.email, "new valid password") | ||||||
| @@ -512,7 +505,7 @@ defmodule Cannery.AccountsTest do | |||||||
|  |  | ||||||
|     test "deletes all tokens for the given user", %{user: user} do |     test "deletes all tokens for the given user", %{user: user} do | ||||||
|       _session_token = Accounts.generate_user_session_token(user) |       _session_token = Accounts.generate_user_session_token(user) | ||||||
|       {:ok, _user} = Accounts.reset_user_password(user, %{"password" => "new valid password"}) |       {:ok, _user} = Accounts.reset_user_password(user, %{password: "new valid password"}) | ||||||
|       refute Repo.get_by(UserToken, user_id: user.id) |       refute Repo.get_by(UserToken, user_id: user.id) | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
|   | |||||||
| @@ -5,12 +5,7 @@ defmodule Cannery.ActivityLogTest do | |||||||
|  |  | ||||||
|   use Cannery.DataCase |   use Cannery.DataCase | ||||||
|   import Cannery.Fixtures |   import Cannery.Fixtures | ||||||
|  |   alias Cannery.{ActivityLog, ActivityLog.ShotGroup, Ammo} | ||||||
|   alias Cannery.{ |  | ||||||
|     ActivityLog, |  | ||||||
|     ActivityLog.ShotGroup, |  | ||||||
|     Ammo |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   @moduletag :activity_log_test |   @moduletag :activity_log_test | ||||||
|  |  | ||||||
| @@ -21,10 +16,10 @@ defmodule Cannery.ActivityLogTest do | |||||||
|       ammo_type = ammo_type_fixture(current_user) |       ammo_type = ammo_type_fixture(current_user) | ||||||
|  |  | ||||||
|       {1, [%{id: ammo_group_id} = ammo_group]} = |       {1, [%{id: ammo_group_id} = ammo_group]} = | ||||||
|         ammo_group_fixture(%{"count" => 25}, ammo_type, container, current_user) |         ammo_group_fixture(%{count: 25}, ammo_type, container, current_user) | ||||||
|  |  | ||||||
|       shot_group = |       shot_group = | ||||||
|         %{"count" => 5, "date" => ~N[2022-02-13 03:17:00], "notes" => "some notes"} |         %{count: 5, date: ~N[2022-02-13 03:17:00], notes: "some notes"} | ||||||
|         |> shot_group_fixture(current_user, ammo_group) |         |> shot_group_fixture(current_user, ammo_group) | ||||||
|  |  | ||||||
|       ammo_group = ammo_group_id |> Ammo.get_ammo_group!(current_user) |       ammo_group = ammo_group_id |> Ammo.get_ammo_group!(current_user) | ||||||
| @@ -54,7 +49,7 @@ defmodule Cannery.ActivityLogTest do | |||||||
|  |  | ||||||
|     test "create_shot_group/3 with valid data creates a shot_group", |     test "create_shot_group/3 with valid data creates a shot_group", | ||||||
|          %{current_user: current_user, ammo_group: ammo_group} do |          %{current_user: current_user, ammo_group: ammo_group} do | ||||||
|       valid_attrs = %{"count" => 10, "date" => ~D[2022-02-13], "notes" => "some notes"} |       valid_attrs = %{count: 10, date: ~D[2022-02-13], notes: "some notes"} | ||||||
|  |  | ||||||
|       assert {:ok, %ShotGroup{} = shot_group} = |       assert {:ok, %ShotGroup{} = shot_group} = | ||||||
|                ActivityLog.create_shot_group(valid_attrs, current_user, ammo_group) |                ActivityLog.create_shot_group(valid_attrs, current_user, ammo_group) | ||||||
| @@ -69,7 +64,7 @@ defmodule Cannery.ActivityLogTest do | |||||||
|            current_user: current_user, |            current_user: current_user, | ||||||
|            ammo_group: %{id: ammo_group_id, count: org_count} = ammo_group |            ammo_group: %{id: ammo_group_id, count: org_count} = ammo_group | ||||||
|          } do |          } do | ||||||
|       valid_attrs = %{"count" => 10, "date" => ~D[2022-02-13], "notes" => "some notes"} |       valid_attrs = %{count: 10, date: ~D[2022-02-13], notes: "some notes"} | ||||||
|  |  | ||||||
|       assert {:ok, %ShotGroup{} = shot_group} = |       assert {:ok, %ShotGroup{} = shot_group} = | ||||||
|                ActivityLog.create_shot_group(valid_attrs, current_user, ammo_group) |                ActivityLog.create_shot_group(valid_attrs, current_user, ammo_group) | ||||||
| @@ -82,7 +77,7 @@ defmodule Cannery.ActivityLogTest do | |||||||
|  |  | ||||||
|     test "create_shot_group/3 does not remove more than ammo group amount", |     test "create_shot_group/3 does not remove more than ammo group amount", | ||||||
|          %{current_user: current_user, ammo_group: %{id: ammo_group_id} = ammo_group} do |          %{current_user: current_user, ammo_group: %{id: ammo_group_id} = ammo_group} do | ||||||
|       valid_attrs = %{"count" => 20, "date" => ~D[2022-02-13], "notes" => "some notes"} |       valid_attrs = %{count: 20, date: ~D[2022-02-13], notes: "some notes"} | ||||||
|  |  | ||||||
|       assert {:ok, %ShotGroup{}} = |       assert {:ok, %ShotGroup{}} = | ||||||
|                ActivityLog.create_shot_group(valid_attrs, current_user, ammo_group) |                ActivityLog.create_shot_group(valid_attrs, current_user, ammo_group) | ||||||
| @@ -92,12 +87,12 @@ defmodule Cannery.ActivityLogTest do | |||||||
|       assert ammo_group.count == 0 |       assert ammo_group.count == 0 | ||||||
|  |  | ||||||
|       assert {:error, %Ecto.Changeset{}} = |       assert {:error, %Ecto.Changeset{}} = | ||||||
|                ActivityLog.create_shot_group(%{"count" => 1}, current_user, ammo_group) |                ActivityLog.create_shot_group(%{count: 1}, current_user, ammo_group) | ||||||
|     end |     end | ||||||
|  |  | ||||||
|     test "create_shot_group/3 with invalid data returns error changeset", |     test "create_shot_group/3 with invalid data returns error changeset", | ||||||
|          %{current_user: current_user, ammo_group: ammo_group} do |          %{current_user: current_user, ammo_group: ammo_group} do | ||||||
|       invalid_params = %{"count" => nil, "date" => nil, "notes" => nil} |       invalid_params = %{count: nil, date: nil, notes: nil} | ||||||
|  |  | ||||||
|       assert {:error, %Ecto.Changeset{}} = |       assert {:error, %Ecto.Changeset{}} = | ||||||
|                ActivityLog.create_shot_group(invalid_params, current_user, ammo_group) |                ActivityLog.create_shot_group(invalid_params, current_user, ammo_group) | ||||||
| @@ -113,9 +108,9 @@ defmodule Cannery.ActivityLogTest do | |||||||
|                ActivityLog.update_shot_group( |                ActivityLog.update_shot_group( | ||||||
|                  shot_group, |                  shot_group, | ||||||
|                  %{ |                  %{ | ||||||
|                    "count" => 10, |                    count: 10, | ||||||
|                    "date" => ~D[2022-02-13], |                    date: ~D[2022-02-13], | ||||||
|                    "notes" => "some updated notes" |                    notes: "some updated notes" | ||||||
|                  }, |                  }, | ||||||
|                  current_user |                  current_user | ||||||
|                ) |                ) | ||||||
| @@ -131,9 +126,9 @@ defmodule Cannery.ActivityLogTest do | |||||||
|                ActivityLog.update_shot_group( |                ActivityLog.update_shot_group( | ||||||
|                  shot_group, |                  shot_group, | ||||||
|                  %{ |                  %{ | ||||||
|                    "count" => 25, |                    count: 25, | ||||||
|                    "date" => ~D[2022-02-13], |                    date: ~D[2022-02-13], | ||||||
|                    "notes" => "some updated notes" |                    notes: "some updated notes" | ||||||
|                  }, |                  }, | ||||||
|                  current_user |                  current_user | ||||||
|                ) |                ) | ||||||
| @@ -149,14 +144,14 @@ defmodule Cannery.ActivityLogTest do | |||||||
|       assert {:error, %Ecto.Changeset{}} = |       assert {:error, %Ecto.Changeset{}} = | ||||||
|                ActivityLog.update_shot_group( |                ActivityLog.update_shot_group( | ||||||
|                  shot_group, |                  shot_group, | ||||||
|                  %{"count" => 26, "date" => nil, "notes" => nil}, |                  %{count: 26, date: nil, notes: nil}, | ||||||
|                  current_user |                  current_user | ||||||
|                ) |                ) | ||||||
|  |  | ||||||
|       assert {:error, %Ecto.Changeset{}} = |       assert {:error, %Ecto.Changeset{}} = | ||||||
|                ActivityLog.update_shot_group( |                ActivityLog.update_shot_group( | ||||||
|                  shot_group, |                  shot_group, | ||||||
|                  %{"count" => -1, "date" => nil, "notes" => nil}, |                  %{count: -1, date: nil, notes: nil}, | ||||||
|                  current_user |                  current_user | ||||||
|                ) |                ) | ||||||
|  |  | ||||||
| @@ -184,10 +179,10 @@ defmodule Cannery.ActivityLogTest do | |||||||
|       assert 0 = another_ammo_group |> ActivityLog.get_used_count(current_user) |       assert 0 = another_ammo_group |> ActivityLog.get_used_count(current_user) | ||||||
|       assert 5 = ammo_group |> ActivityLog.get_used_count(current_user) |       assert 5 = ammo_group |> ActivityLog.get_used_count(current_user) | ||||||
|  |  | ||||||
|       shot_group_fixture(%{"count" => 15}, current_user, ammo_group) |       shot_group_fixture(%{count: 15}, current_user, ammo_group) | ||||||
|       assert 20 = ammo_group |> ActivityLog.get_used_count(current_user) |       assert 20 = ammo_group |> ActivityLog.get_used_count(current_user) | ||||||
|  |  | ||||||
|       shot_group_fixture(%{"count" => 10}, current_user, ammo_group) |       shot_group_fixture(%{count: 10}, current_user, ammo_group) | ||||||
|       assert 30 = ammo_group |> ActivityLog.get_used_count(current_user) |       assert 30 = ammo_group |> ActivityLog.get_used_count(current_user) | ||||||
|  |  | ||||||
|       {1, [another_ammo_group]} = ammo_group_fixture(ammo_type, container, current_user) |       {1, [another_ammo_group]} = ammo_group_fixture(ammo_type, container, current_user) | ||||||
| @@ -206,17 +201,17 @@ defmodule Cannery.ActivityLogTest do | |||||||
|       assert %{ammo_group_id => 5} == |       assert %{ammo_group_id => 5} == | ||||||
|                [ammo_group, another_ammo_group] |> ActivityLog.get_used_counts(current_user) |                [ammo_group, another_ammo_group] |> ActivityLog.get_used_counts(current_user) | ||||||
|  |  | ||||||
|       shot_group_fixture(%{"count" => 5}, current_user, another_ammo_group) |       shot_group_fixture(%{count: 5}, current_user, another_ammo_group) | ||||||
|       used_counts = [ammo_group, another_ammo_group] |> ActivityLog.get_used_counts(current_user) |       used_counts = [ammo_group, another_ammo_group] |> ActivityLog.get_used_counts(current_user) | ||||||
|       assert %{^ammo_group_id => 5} = used_counts |       assert %{^ammo_group_id => 5} = used_counts | ||||||
|       assert %{^another_ammo_group_id => 5} = used_counts |       assert %{^another_ammo_group_id => 5} = used_counts | ||||||
|  |  | ||||||
|       shot_group_fixture(%{"count" => 15}, current_user, ammo_group) |       shot_group_fixture(%{count: 15}, current_user, ammo_group) | ||||||
|       used_counts = [ammo_group, another_ammo_group] |> ActivityLog.get_used_counts(current_user) |       used_counts = [ammo_group, another_ammo_group] |> ActivityLog.get_used_counts(current_user) | ||||||
|       assert %{^ammo_group_id => 20} = used_counts |       assert %{^ammo_group_id => 20} = used_counts | ||||||
|       assert %{^another_ammo_group_id => 5} = used_counts |       assert %{^another_ammo_group_id => 5} = used_counts | ||||||
|  |  | ||||||
|       shot_group_fixture(%{"count" => 10}, current_user, ammo_group) |       shot_group_fixture(%{count: 10}, current_user, ammo_group) | ||||||
|       used_counts = [ammo_group, another_ammo_group] |> ActivityLog.get_used_counts(current_user) |       used_counts = [ammo_group, another_ammo_group] |> ActivityLog.get_used_counts(current_user) | ||||||
|       assert %{^ammo_group_id => 30} = used_counts |       assert %{^ammo_group_id => 30} = used_counts | ||||||
|       assert %{^another_ammo_group_id => 5} = used_counts |       assert %{^another_ammo_group_id => 5} = used_counts | ||||||
| @@ -233,10 +228,10 @@ defmodule Cannery.ActivityLogTest do | |||||||
|       assert another_ammo_group |> ActivityLog.get_last_used_date(current_user) |> is_nil() |       assert another_ammo_group |> ActivityLog.get_last_used_date(current_user) |> is_nil() | ||||||
|       assert ^date = ammo_group |> ActivityLog.get_last_used_date(current_user) |       assert ^date = ammo_group |> ActivityLog.get_last_used_date(current_user) | ||||||
|  |  | ||||||
|       %{date: date} = shot_group_fixture(%{"date" => ~D[2022-11-10]}, current_user, ammo_group) |       %{date: date} = shot_group_fixture(%{date: ~D[2022-11-10]}, current_user, ammo_group) | ||||||
|       assert ^date = ammo_group |> ActivityLog.get_last_used_date(current_user) |       assert ^date = ammo_group |> ActivityLog.get_last_used_date(current_user) | ||||||
|  |  | ||||||
|       %{date: date} = shot_group_fixture(%{"date" => ~D[2022-11-11]}, current_user, ammo_group) |       %{date: date} = shot_group_fixture(%{date: ~D[2022-11-11]}, current_user, ammo_group) | ||||||
|       assert ^date = ammo_group |> ActivityLog.get_last_used_date(current_user) |       assert ^date = ammo_group |> ActivityLog.get_last_used_date(current_user) | ||||||
|     end |     end | ||||||
|  |  | ||||||
| @@ -254,7 +249,7 @@ defmodule Cannery.ActivityLogTest do | |||||||
|       assert %{ammo_group_id => date} == |       assert %{ammo_group_id => date} == | ||||||
|                [ammo_group, another_ammo_group] |> ActivityLog.get_last_used_dates(current_user) |                [ammo_group, another_ammo_group] |> ActivityLog.get_last_used_dates(current_user) | ||||||
|  |  | ||||||
|       shot_group_fixture(%{"date" => ~D[2022-11-09]}, current_user, another_ammo_group) |       shot_group_fixture(%{date: ~D[2022-11-09]}, current_user, another_ammo_group) | ||||||
|  |  | ||||||
|       # setting initial date |       # setting initial date | ||||||
|       last_used_shot_groups = |       last_used_shot_groups = | ||||||
| @@ -264,7 +259,7 @@ defmodule Cannery.ActivityLogTest do | |||||||
|       assert %{^another_ammo_group_id => ~D[2022-11-09]} = last_used_shot_groups |       assert %{^another_ammo_group_id => ~D[2022-11-09]} = last_used_shot_groups | ||||||
|  |  | ||||||
|       # setting another date |       # setting another date | ||||||
|       shot_group_fixture(%{"date" => ~D[2022-11-10]}, current_user, ammo_group) |       shot_group_fixture(%{date: ~D[2022-11-10]}, current_user, ammo_group) | ||||||
|  |  | ||||||
|       last_used_shot_groups = |       last_used_shot_groups = | ||||||
|         [ammo_group, another_ammo_group] |> ActivityLog.get_last_used_dates(current_user) |         [ammo_group, another_ammo_group] |> ActivityLog.get_last_used_dates(current_user) | ||||||
| @@ -273,7 +268,7 @@ defmodule Cannery.ActivityLogTest do | |||||||
|       assert %{^another_ammo_group_id => ~D[2022-11-09]} = last_used_shot_groups |       assert %{^another_ammo_group_id => ~D[2022-11-09]} = last_used_shot_groups | ||||||
|  |  | ||||||
|       # setting yet another date |       # setting yet another date | ||||||
|       shot_group_fixture(%{"date" => ~D[2022-11-11]}, current_user, ammo_group) |       shot_group_fixture(%{date: ~D[2022-11-11]}, current_user, ammo_group) | ||||||
|  |  | ||||||
|       last_used_shot_groups = |       last_used_shot_groups = | ||||||
|         [ammo_group, another_ammo_group] |> ActivityLog.get_last_used_dates(current_user) |         [ammo_group, another_ammo_group] |> ActivityLog.get_last_used_dates(current_user) | ||||||
| @@ -288,10 +283,10 @@ defmodule Cannery.ActivityLogTest do | |||||||
|       assert 0 = another_ammo_type |> ActivityLog.get_used_count_for_ammo_type(current_user) |       assert 0 = another_ammo_type |> ActivityLog.get_used_count_for_ammo_type(current_user) | ||||||
|       assert 5 = ammo_type |> ActivityLog.get_used_count_for_ammo_type(current_user) |       assert 5 = ammo_type |> ActivityLog.get_used_count_for_ammo_type(current_user) | ||||||
|  |  | ||||||
|       shot_group_fixture(%{"count" => 5}, current_user, ammo_group) |       shot_group_fixture(%{count: 5}, current_user, ammo_group) | ||||||
|       assert 10 = ammo_type |> ActivityLog.get_used_count_for_ammo_type(current_user) |       assert 10 = ammo_type |> ActivityLog.get_used_count_for_ammo_type(current_user) | ||||||
|  |  | ||||||
|       shot_group_fixture(%{"count" => 1}, current_user, ammo_group) |       shot_group_fixture(%{count: 1}, current_user, ammo_group) | ||||||
|       assert 11 = ammo_type |> ActivityLog.get_used_count_for_ammo_type(current_user) |       assert 11 = ammo_type |> ActivityLog.get_used_count_for_ammo_type(current_user) | ||||||
|     end |     end | ||||||
|  |  | ||||||
| @@ -309,7 +304,7 @@ defmodule Cannery.ActivityLogTest do | |||||||
|                |> ActivityLog.get_used_count_for_ammo_types(current_user) |                |> ActivityLog.get_used_count_for_ammo_types(current_user) | ||||||
|  |  | ||||||
|       # use generated ammo group |       # use generated ammo group | ||||||
|       shot_group_fixture(%{"count" => 5}, current_user, ammo_group) |       shot_group_fixture(%{count: 5}, current_user, ammo_group) | ||||||
|  |  | ||||||
|       used_counts = |       used_counts = | ||||||
|         [ammo_type, another_ammo_type] |> ActivityLog.get_used_count_for_ammo_types(current_user) |         [ammo_type, another_ammo_type] |> ActivityLog.get_used_count_for_ammo_types(current_user) | ||||||
| @@ -318,7 +313,7 @@ defmodule Cannery.ActivityLogTest do | |||||||
|       assert %{^another_ammo_type_id => 5} = used_counts |       assert %{^another_ammo_type_id => 5} = used_counts | ||||||
|  |  | ||||||
|       # use generated ammo group again |       # use generated ammo group again | ||||||
|       shot_group_fixture(%{"count" => 1}, current_user, ammo_group) |       shot_group_fixture(%{count: 1}, current_user, ammo_group) | ||||||
|  |  | ||||||
|       used_counts = |       used_counts = | ||||||
|         [ammo_type, another_ammo_type] |> ActivityLog.get_used_count_for_ammo_types(current_user) |         [ammo_type, another_ammo_type] |> ActivityLog.get_used_count_for_ammo_types(current_user) | ||||||
| @@ -348,21 +343,21 @@ defmodule Cannery.ActivityLogTest do | |||||||
|       other_user = user_fixture() |       other_user = user_fixture() | ||||||
|       other_container = container_fixture(other_user) |       other_container = container_fixture(other_user) | ||||||
|  |  | ||||||
|       for type <- ["rifle", "shotgun", "pistol"] do |       for class <- ["rifle", "shotgun", "pistol"] do | ||||||
|         other_ammo_type = ammo_type_fixture(%{"type" => type}, other_user) |         other_ammo_type = ammo_type_fixture(%{class: class}, other_user) | ||||||
|         {1, [other_ammo_group]} = ammo_group_fixture(other_ammo_type, other_container, other_user) |         {1, [other_ammo_group]} = ammo_group_fixture(other_ammo_type, other_container, other_user) | ||||||
|         shot_group_fixture(other_user, other_ammo_group) |         shot_group_fixture(other_user, other_ammo_group) | ||||||
|       end |       end | ||||||
|  |  | ||||||
|       rifle_ammo_type = ammo_type_fixture(%{"type" => "rifle"}, current_user) |       rifle_ammo_type = ammo_type_fixture(%{class: :rifle}, current_user) | ||||||
|       {1, [rifle_ammo_group]} = ammo_group_fixture(rifle_ammo_type, container, current_user) |       {1, [rifle_ammo_group]} = ammo_group_fixture(rifle_ammo_type, container, current_user) | ||||||
|       rifle_shot_group = shot_group_fixture(current_user, rifle_ammo_group) |       rifle_shot_group = shot_group_fixture(current_user, rifle_ammo_group) | ||||||
|  |  | ||||||
|       shotgun_ammo_type = ammo_type_fixture(%{"type" => "shotgun"}, current_user) |       shotgun_ammo_type = ammo_type_fixture(%{class: :shotgun}, current_user) | ||||||
|       {1, [shotgun_ammo_group]} = ammo_group_fixture(shotgun_ammo_type, container, current_user) |       {1, [shotgun_ammo_group]} = ammo_group_fixture(shotgun_ammo_type, container, current_user) | ||||||
|       shotgun_shot_group = shot_group_fixture(current_user, shotgun_ammo_group) |       shotgun_shot_group = shot_group_fixture(current_user, shotgun_ammo_group) | ||||||
|  |  | ||||||
|       pistol_ammo_type = ammo_type_fixture(%{"type" => "pistol"}, current_user) |       pistol_ammo_type = ammo_type_fixture(%{class: :pistol}, current_user) | ||||||
|       {1, [pistol_ammo_group]} = ammo_group_fixture(pistol_ammo_type, container, current_user) |       {1, [pistol_ammo_group]} = ammo_group_fixture(pistol_ammo_type, container, current_user) | ||||||
|       pistol_shot_group = shot_group_fixture(current_user, pistol_ammo_group) |       pistol_shot_group = shot_group_fixture(current_user, pistol_ammo_group) | ||||||
|  |  | ||||||
| @@ -389,14 +384,14 @@ defmodule Cannery.ActivityLogTest do | |||||||
|       container: container, |       container: container, | ||||||
|       current_user: current_user |       current_user: current_user | ||||||
|     } do |     } do | ||||||
|       shot_group_a = shot_group_fixture(%{"notes" => "amazing"}, current_user, ammo_group) |       shot_group_a = shot_group_fixture(%{notes: "amazing"}, current_user, ammo_group) | ||||||
|  |  | ||||||
|       {1, [another_ammo_group]} = |       {1, [another_ammo_group]} = | ||||||
|         ammo_group_fixture(%{"notes" => "stupendous"}, ammo_type, container, current_user) |         ammo_group_fixture(%{notes: "stupendous"}, ammo_type, container, current_user) | ||||||
|  |  | ||||||
|       shot_group_b = shot_group_fixture(current_user, another_ammo_group) |       shot_group_b = shot_group_fixture(current_user, another_ammo_group) | ||||||
|  |  | ||||||
|       another_ammo_type = ammo_type_fixture(%{"name" => "fabulous ammo"}, current_user) |       another_ammo_type = ammo_type_fixture(%{name: "fabulous ammo"}, current_user) | ||||||
|  |  | ||||||
|       {1, [yet_another_ammo_group]} = |       {1, [yet_another_ammo_group]} = | ||||||
|         ammo_group_fixture(another_ammo_type, container, current_user) |         ammo_group_fixture(another_ammo_type, container, current_user) | ||||||
|   | |||||||
| @@ -10,28 +10,28 @@ defmodule Cannery.AmmoTest do | |||||||
|   @moduletag :ammo_test |   @moduletag :ammo_test | ||||||
|  |  | ||||||
|   @valid_attrs %{ |   @valid_attrs %{ | ||||||
|     "bullet_type" => "some bullet_type", |     bullet_type: "some bullet_type", | ||||||
|     "case_material" => "some case_material", |     case_material: "some case_material", | ||||||
|     "desc" => "some desc", |     desc: "some desc", | ||||||
|     "manufacturer" => "some manufacturer", |     manufacturer: "some manufacturer", | ||||||
|     "name" => "some name", |     name: "some name", | ||||||
|     "grains" => 120 |     grains: 120 | ||||||
|   } |   } | ||||||
|   @update_attrs %{ |   @update_attrs %{ | ||||||
|     "bullet_type" => "some updated bullet_type", |     bullet_type: "some updated bullet_type", | ||||||
|     "case_material" => "some updated case_material", |     case_material: "some updated case_material", | ||||||
|     "desc" => "some updated desc", |     desc: "some updated desc", | ||||||
|     "manufacturer" => "some updated manufacturer", |     manufacturer: "some updated manufacturer", | ||||||
|     "name" => "some updated name", |     name: "some updated name", | ||||||
|     "grains" => 456 |     grains: 456 | ||||||
|   } |   } | ||||||
|   @invalid_attrs %{ |   @invalid_attrs %{ | ||||||
|     "bullet_type" => nil, |     bullet_type: nil, | ||||||
|     "case_material" => nil, |     case_material: nil, | ||||||
|     "desc" => nil, |     desc: nil, | ||||||
|     "manufacturer" => nil, |     manufacturer: nil, | ||||||
|     "name" => nil, |     name: nil, | ||||||
|     "grains" => nil |     grains: nil | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   describe "list_ammo_types/2" do |   describe "list_ammo_types/2" do | ||||||
| @@ -40,34 +40,34 @@ defmodule Cannery.AmmoTest do | |||||||
|  |  | ||||||
|       rifle_ammo_type = |       rifle_ammo_type = | ||||||
|         %{ |         %{ | ||||||
|           "name" => "bullets", |           name: "bullets", | ||||||
|           "type" => "rifle", |           class: :rifle, | ||||||
|           "desc" => "has some pews in it", |           desc: "has some pews in it", | ||||||
|           "grains" => 5 |           grains: 5 | ||||||
|         } |         } | ||||||
|         |> ammo_type_fixture(current_user) |         |> ammo_type_fixture(current_user) | ||||||
|  |  | ||||||
|       shotgun_ammo_type = |       shotgun_ammo_type = | ||||||
|         %{ |         %{ | ||||||
|           "name" => "hollows", |           name: "hollows", | ||||||
|           "type" => "shotgun", |           class: :shotgun, | ||||||
|           "grains" => 3 |           grains: 3 | ||||||
|         } |         } | ||||||
|         |> ammo_type_fixture(current_user) |         |> ammo_type_fixture(current_user) | ||||||
|  |  | ||||||
|       pistol_ammo_type = |       pistol_ammo_type = | ||||||
|         %{ |         %{ | ||||||
|           "type" => "pistol", |           class: :pistol, | ||||||
|           "name" => "jackets", |           name: "jackets", | ||||||
|           "desc" => "brass shell", |           desc: "brass shell", | ||||||
|           "tracer" => true |           tracer: true | ||||||
|         } |         } | ||||||
|         |> ammo_type_fixture(current_user) |         |> ammo_type_fixture(current_user) | ||||||
|  |  | ||||||
|       _shouldnt_return = |       _shouldnt_return = | ||||||
|         %{ |         %{ | ||||||
|           "name" => "bullet", |           name: "bullet", | ||||||
|           "desc" => "pews brass shell" |           desc: "pews brass shell" | ||||||
|         } |         } | ||||||
|         |> ammo_type_fixture(user_fixture()) |         |> ammo_type_fixture(user_fixture()) | ||||||
|  |  | ||||||
| @@ -228,7 +228,7 @@ defmodule Cannery.AmmoTest do | |||||||
|          %{ammo_type: ammo_type, current_user: current_user, container: container} do |          %{ammo_type: ammo_type, current_user: current_user, container: container} do | ||||||
|       {1, [_ammo_group]} = |       {1, [_ammo_group]} = | ||||||
|         ammo_group_fixture( |         ammo_group_fixture( | ||||||
|           %{"price_paid" => 25.00, "count" => 1}, |           %{price_paid: 25.00, count: 1}, | ||||||
|           ammo_type, |           ammo_type, | ||||||
|           container, |           container, | ||||||
|           current_user |           current_user | ||||||
| @@ -238,7 +238,7 @@ defmodule Cannery.AmmoTest do | |||||||
|  |  | ||||||
|       {1, [_ammo_group]} = |       {1, [_ammo_group]} = | ||||||
|         ammo_group_fixture( |         ammo_group_fixture( | ||||||
|           %{"price_paid" => 25.00, "count" => 1}, |           %{price_paid: 25.00, count: 1}, | ||||||
|           ammo_type, |           ammo_type, | ||||||
|           container, |           container, | ||||||
|           current_user |           current_user | ||||||
| @@ -248,7 +248,7 @@ defmodule Cannery.AmmoTest do | |||||||
|  |  | ||||||
|       {1, [_ammo_group]} = |       {1, [_ammo_group]} = | ||||||
|         ammo_group_fixture( |         ammo_group_fixture( | ||||||
|           %{"price_paid" => 70.00, "count" => 1}, |           %{price_paid: 70.00, count: 1}, | ||||||
|           ammo_type, |           ammo_type, | ||||||
|           container, |           container, | ||||||
|           current_user |           current_user | ||||||
| @@ -258,7 +258,7 @@ defmodule Cannery.AmmoTest do | |||||||
|  |  | ||||||
|       {1, [_ammo_group]} = |       {1, [_ammo_group]} = | ||||||
|         ammo_group_fixture( |         ammo_group_fixture( | ||||||
|           %{"price_paid" => 30.00, "count" => 1}, |           %{price_paid: 30.00, count: 1}, | ||||||
|           ammo_type, |           ammo_type, | ||||||
|           container, |           container, | ||||||
|           current_user |           current_user | ||||||
| @@ -282,7 +282,7 @@ defmodule Cannery.AmmoTest do | |||||||
|  |  | ||||||
|       {1, [_ammo_group]} = |       {1, [_ammo_group]} = | ||||||
|         ammo_group_fixture( |         ammo_group_fixture( | ||||||
|           %{"price_paid" => 25.00, "count" => 1}, |           %{price_paid: 25.00, count: 1}, | ||||||
|           another_ammo_type, |           another_ammo_type, | ||||||
|           container, |           container, | ||||||
|           current_user |           current_user | ||||||
| @@ -294,7 +294,7 @@ defmodule Cannery.AmmoTest do | |||||||
|  |  | ||||||
|       {1, [_ammo_group]} = |       {1, [_ammo_group]} = | ||||||
|         ammo_group_fixture( |         ammo_group_fixture( | ||||||
|           %{"price_paid" => 25.00, "count" => 1}, |           %{price_paid: 25.00, count: 1}, | ||||||
|           ammo_type, |           ammo_type, | ||||||
|           container, |           container, | ||||||
|           current_user |           current_user | ||||||
| @@ -308,7 +308,7 @@ defmodule Cannery.AmmoTest do | |||||||
|  |  | ||||||
|       {1, [_ammo_group]} = |       {1, [_ammo_group]} = | ||||||
|         ammo_group_fixture( |         ammo_group_fixture( | ||||||
|           %{"price_paid" => 25.00, "count" => 1}, |           %{price_paid: 25.00, count: 1}, | ||||||
|           ammo_type, |           ammo_type, | ||||||
|           container, |           container, | ||||||
|           current_user |           current_user | ||||||
| @@ -322,7 +322,7 @@ defmodule Cannery.AmmoTest do | |||||||
|  |  | ||||||
|       {1, [_ammo_group]} = |       {1, [_ammo_group]} = | ||||||
|         ammo_group_fixture( |         ammo_group_fixture( | ||||||
|           %{"price_paid" => 70.00, "count" => 1}, |           %{price_paid: 70.00, count: 1}, | ||||||
|           ammo_type, |           ammo_type, | ||||||
|           container, |           container, | ||||||
|           current_user |           current_user | ||||||
| @@ -336,7 +336,7 @@ defmodule Cannery.AmmoTest do | |||||||
|  |  | ||||||
|       {1, [_ammo_group]} = |       {1, [_ammo_group]} = | ||||||
|         ammo_group_fixture( |         ammo_group_fixture( | ||||||
|           %{"price_paid" => 30.00, "count" => 1}, |           %{price_paid: 30.00, count: 1}, | ||||||
|           ammo_type, |           ammo_type, | ||||||
|           container, |           container, | ||||||
|           current_user |           current_user | ||||||
| @@ -355,18 +355,18 @@ defmodule Cannery.AmmoTest do | |||||||
|       assert 0 = Ammo.get_round_count_for_ammo_type(another_ammo_type, current_user) |       assert 0 = Ammo.get_round_count_for_ammo_type(another_ammo_type, current_user) | ||||||
|  |  | ||||||
|       {1, [first_ammo_group]} = |       {1, [first_ammo_group]} = | ||||||
|         ammo_group_fixture(%{"count" => 1}, ammo_type, container, current_user) |         ammo_group_fixture(%{count: 1}, ammo_type, container, current_user) | ||||||
|  |  | ||||||
|       assert 1 = Ammo.get_round_count_for_ammo_type(ammo_type, current_user) |       assert 1 = Ammo.get_round_count_for_ammo_type(ammo_type, current_user) | ||||||
|  |  | ||||||
|       {1, [ammo_group]} = ammo_group_fixture(%{"count" => 50}, ammo_type, container, current_user) |       {1, [ammo_group]} = ammo_group_fixture(%{count: 50}, ammo_type, container, current_user) | ||||||
|  |  | ||||||
|       assert 51 = Ammo.get_round_count_for_ammo_type(ammo_type, current_user) |       assert 51 = Ammo.get_round_count_for_ammo_type(ammo_type, current_user) | ||||||
|  |  | ||||||
|       shot_group_fixture(%{"count" => 26}, current_user, ammo_group) |       shot_group_fixture(%{count: 26}, current_user, ammo_group) | ||||||
|       assert 25 = Ammo.get_round_count_for_ammo_type(ammo_type, current_user) |       assert 25 = Ammo.get_round_count_for_ammo_type(ammo_type, current_user) | ||||||
|  |  | ||||||
|       shot_group_fixture(%{"count" => 1}, current_user, first_ammo_group) |       shot_group_fixture(%{count: 1}, current_user, first_ammo_group) | ||||||
|       assert 24 = Ammo.get_round_count_for_ammo_type(ammo_type, current_user) |       assert 24 = Ammo.get_round_count_for_ammo_type(ammo_type, current_user) | ||||||
|     end |     end | ||||||
|  |  | ||||||
| @@ -376,7 +376,7 @@ defmodule Cannery.AmmoTest do | |||||||
|       container: container |       container: container | ||||||
|     } do |     } do | ||||||
|       {1, [first_ammo_group]} = |       {1, [first_ammo_group]} = | ||||||
|         ammo_group_fixture(%{"count" => 1}, ammo_type, container, current_user) |         ammo_group_fixture(%{count: 1}, ammo_type, container, current_user) | ||||||
|  |  | ||||||
|       assert %{ammo_type_id => 1} == |       assert %{ammo_type_id => 1} == | ||||||
|                [ammo_type] |> Ammo.get_round_count_for_ammo_types(current_user) |                [ammo_type] |> Ammo.get_round_count_for_ammo_types(current_user) | ||||||
| @@ -384,7 +384,7 @@ defmodule Cannery.AmmoTest do | |||||||
|       %{id: another_ammo_type_id} = another_ammo_type = ammo_type_fixture(current_user) |       %{id: another_ammo_type_id} = another_ammo_type = ammo_type_fixture(current_user) | ||||||
|  |  | ||||||
|       {1, [_another_ammo_group]} = |       {1, [_another_ammo_group]} = | ||||||
|         ammo_group_fixture(%{"count" => 1}, another_ammo_type, container, current_user) |         ammo_group_fixture(%{count: 1}, another_ammo_type, container, current_user) | ||||||
|  |  | ||||||
|       round_counts = |       round_counts = | ||||||
|         [ammo_type, another_ammo_type] |> Ammo.get_round_count_for_ammo_types(current_user) |         [ammo_type, another_ammo_type] |> Ammo.get_round_count_for_ammo_types(current_user) | ||||||
| @@ -392,7 +392,7 @@ defmodule Cannery.AmmoTest do | |||||||
|       assert %{^ammo_type_id => 1} = round_counts |       assert %{^ammo_type_id => 1} = round_counts | ||||||
|       assert %{^another_ammo_type_id => 1} = round_counts |       assert %{^another_ammo_type_id => 1} = round_counts | ||||||
|  |  | ||||||
|       {1, [ammo_group]} = ammo_group_fixture(%{"count" => 50}, ammo_type, container, current_user) |       {1, [ammo_group]} = ammo_group_fixture(%{count: 50}, ammo_type, container, current_user) | ||||||
|  |  | ||||||
|       round_counts = |       round_counts = | ||||||
|         [ammo_type, another_ammo_type] |> Ammo.get_round_count_for_ammo_types(current_user) |         [ammo_type, another_ammo_type] |> Ammo.get_round_count_for_ammo_types(current_user) | ||||||
| @@ -400,7 +400,7 @@ defmodule Cannery.AmmoTest do | |||||||
|       assert %{^ammo_type_id => 51} = round_counts |       assert %{^ammo_type_id => 51} = round_counts | ||||||
|       assert %{^another_ammo_type_id => 1} = round_counts |       assert %{^another_ammo_type_id => 1} = round_counts | ||||||
|  |  | ||||||
|       shot_group_fixture(%{"count" => 26}, current_user, ammo_group) |       shot_group_fixture(%{count: 26}, current_user, ammo_group) | ||||||
|  |  | ||||||
|       round_counts = |       round_counts = | ||||||
|         [ammo_type, another_ammo_type] |> Ammo.get_round_count_for_ammo_types(current_user) |         [ammo_type, another_ammo_type] |> Ammo.get_round_count_for_ammo_types(current_user) | ||||||
| @@ -408,7 +408,7 @@ defmodule Cannery.AmmoTest do | |||||||
|       assert %{^ammo_type_id => 25} = round_counts |       assert %{^ammo_type_id => 25} = round_counts | ||||||
|       assert %{^another_ammo_type_id => 1} = round_counts |       assert %{^another_ammo_type_id => 1} = round_counts | ||||||
|  |  | ||||||
|       shot_group_fixture(%{"count" => 1}, current_user, first_ammo_group) |       shot_group_fixture(%{count: 1}, current_user, first_ammo_group) | ||||||
|  |  | ||||||
|       round_counts = |       round_counts = | ||||||
|         [ammo_type, another_ammo_type] |> Ammo.get_round_count_for_ammo_types(current_user) |         [ammo_type, another_ammo_type] |> Ammo.get_round_count_for_ammo_types(current_user) | ||||||
| @@ -422,18 +422,18 @@ defmodule Cannery.AmmoTest do | |||||||
|       assert 0 = Ammo.get_historical_count_for_ammo_type(ammo_type, current_user) |       assert 0 = Ammo.get_historical_count_for_ammo_type(ammo_type, current_user) | ||||||
|  |  | ||||||
|       {1, [first_ammo_group]} = |       {1, [first_ammo_group]} = | ||||||
|         ammo_group_fixture(%{"count" => 1}, ammo_type, container, current_user) |         ammo_group_fixture(%{count: 1}, ammo_type, container, current_user) | ||||||
|  |  | ||||||
|       assert 1 = Ammo.get_historical_count_for_ammo_type(ammo_type, current_user) |       assert 1 = Ammo.get_historical_count_for_ammo_type(ammo_type, current_user) | ||||||
|  |  | ||||||
|       {1, [ammo_group]} = ammo_group_fixture(%{"count" => 50}, ammo_type, container, current_user) |       {1, [ammo_group]} = ammo_group_fixture(%{count: 50}, ammo_type, container, current_user) | ||||||
|  |  | ||||||
|       assert 51 = Ammo.get_historical_count_for_ammo_type(ammo_type, current_user) |       assert 51 = Ammo.get_historical_count_for_ammo_type(ammo_type, current_user) | ||||||
|  |  | ||||||
|       shot_group_fixture(%{"count" => 26}, current_user, ammo_group) |       shot_group_fixture(%{count: 26}, current_user, ammo_group) | ||||||
|       assert 51 = Ammo.get_historical_count_for_ammo_type(ammo_type, current_user) |       assert 51 = Ammo.get_historical_count_for_ammo_type(ammo_type, current_user) | ||||||
|  |  | ||||||
|       shot_group_fixture(%{"count" => 1}, current_user, first_ammo_group) |       shot_group_fixture(%{count: 1}, current_user, first_ammo_group) | ||||||
|       assert 51 = Ammo.get_historical_count_for_ammo_type(ammo_type, current_user) |       assert 51 = Ammo.get_historical_count_for_ammo_type(ammo_type, current_user) | ||||||
|     end |     end | ||||||
|  |  | ||||||
| @@ -446,7 +446,7 @@ defmodule Cannery.AmmoTest do | |||||||
|       assert %{} == [ammo_type] |> Ammo.get_historical_count_for_ammo_types(current_user) |       assert %{} == [ammo_type] |> Ammo.get_historical_count_for_ammo_types(current_user) | ||||||
|  |  | ||||||
|       {1, [first_ammo_group]} = |       {1, [first_ammo_group]} = | ||||||
|         ammo_group_fixture(%{"count" => 1}, ammo_type, container, current_user) |         ammo_group_fixture(%{count: 1}, ammo_type, container, current_user) | ||||||
|  |  | ||||||
|       assert %{ammo_type_id => 1} == |       assert %{ammo_type_id => 1} == | ||||||
|                [ammo_type] |> Ammo.get_historical_count_for_ammo_types(current_user) |                [ammo_type] |> Ammo.get_historical_count_for_ammo_types(current_user) | ||||||
| @@ -454,7 +454,7 @@ defmodule Cannery.AmmoTest do | |||||||
|       %{id: another_ammo_type_id} = another_ammo_type = ammo_type_fixture(current_user) |       %{id: another_ammo_type_id} = another_ammo_type = ammo_type_fixture(current_user) | ||||||
|  |  | ||||||
|       {1, [_ammo_group]} = |       {1, [_ammo_group]} = | ||||||
|         ammo_group_fixture(%{"count" => 1}, another_ammo_type, container, current_user) |         ammo_group_fixture(%{count: 1}, another_ammo_type, container, current_user) | ||||||
|  |  | ||||||
|       historical_counts = |       historical_counts = | ||||||
|         [ammo_type, another_ammo_type] |> Ammo.get_historical_count_for_ammo_types(current_user) |         [ammo_type, another_ammo_type] |> Ammo.get_historical_count_for_ammo_types(current_user) | ||||||
| @@ -462,7 +462,7 @@ defmodule Cannery.AmmoTest do | |||||||
|       assert %{^ammo_type_id => 1} = historical_counts |       assert %{^ammo_type_id => 1} = historical_counts | ||||||
|       assert %{^another_ammo_type_id => 1} = historical_counts |       assert %{^another_ammo_type_id => 1} = historical_counts | ||||||
|  |  | ||||||
|       {1, [ammo_group]} = ammo_group_fixture(%{"count" => 50}, ammo_type, container, current_user) |       {1, [ammo_group]} = ammo_group_fixture(%{count: 50}, ammo_type, container, current_user) | ||||||
|  |  | ||||||
|       historical_counts = |       historical_counts = | ||||||
|         [ammo_type, another_ammo_type] |> Ammo.get_historical_count_for_ammo_types(current_user) |         [ammo_type, another_ammo_type] |> Ammo.get_historical_count_for_ammo_types(current_user) | ||||||
| @@ -470,7 +470,7 @@ defmodule Cannery.AmmoTest do | |||||||
|       assert %{^ammo_type_id => 51} = historical_counts |       assert %{^ammo_type_id => 51} = historical_counts | ||||||
|       assert %{^another_ammo_type_id => 1} = historical_counts |       assert %{^another_ammo_type_id => 1} = historical_counts | ||||||
|  |  | ||||||
|       shot_group_fixture(%{"count" => 26}, current_user, ammo_group) |       shot_group_fixture(%{count: 26}, current_user, ammo_group) | ||||||
|  |  | ||||||
|       historical_counts = |       historical_counts = | ||||||
|         [ammo_type, another_ammo_type] |> Ammo.get_historical_count_for_ammo_types(current_user) |         [ammo_type, another_ammo_type] |> Ammo.get_historical_count_for_ammo_types(current_user) | ||||||
| @@ -478,7 +478,7 @@ defmodule Cannery.AmmoTest do | |||||||
|       assert %{^ammo_type_id => 51} = historical_counts |       assert %{^ammo_type_id => 51} = historical_counts | ||||||
|       assert %{^another_ammo_type_id => 1} = historical_counts |       assert %{^another_ammo_type_id => 1} = historical_counts | ||||||
|  |  | ||||||
|       shot_group_fixture(%{"count" => 1}, current_user, first_ammo_group) |       shot_group_fixture(%{count: 1}, current_user, first_ammo_group) | ||||||
|  |  | ||||||
|       historical_counts = |       historical_counts = | ||||||
|         [ammo_type, another_ammo_type] |> Ammo.get_historical_count_for_ammo_types(current_user) |         [ammo_type, another_ammo_type] |> Ammo.get_historical_count_for_ammo_types(current_user) | ||||||
| @@ -492,18 +492,18 @@ defmodule Cannery.AmmoTest do | |||||||
|       assert 0 = Ammo.get_used_ammo_groups_count_for_type(ammo_type, current_user) |       assert 0 = Ammo.get_used_ammo_groups_count_for_type(ammo_type, current_user) | ||||||
|  |  | ||||||
|       {1, [first_ammo_group]} = |       {1, [first_ammo_group]} = | ||||||
|         ammo_group_fixture(%{"count" => 1}, ammo_type, container, current_user) |         ammo_group_fixture(%{count: 1}, ammo_type, container, current_user) | ||||||
|  |  | ||||||
|       assert 0 = Ammo.get_used_ammo_groups_count_for_type(ammo_type, current_user) |       assert 0 = Ammo.get_used_ammo_groups_count_for_type(ammo_type, current_user) | ||||||
|  |  | ||||||
|       {1, [ammo_group]} = ammo_group_fixture(%{"count" => 50}, ammo_type, container, current_user) |       {1, [ammo_group]} = ammo_group_fixture(%{count: 50}, ammo_type, container, current_user) | ||||||
|  |  | ||||||
|       assert 0 = Ammo.get_used_ammo_groups_count_for_type(ammo_type, current_user) |       assert 0 = Ammo.get_used_ammo_groups_count_for_type(ammo_type, current_user) | ||||||
|  |  | ||||||
|       shot_group_fixture(%{"count" => 50}, current_user, ammo_group) |       shot_group_fixture(%{count: 50}, current_user, ammo_group) | ||||||
|       assert 1 = Ammo.get_used_ammo_groups_count_for_type(ammo_type, current_user) |       assert 1 = Ammo.get_used_ammo_groups_count_for_type(ammo_type, current_user) | ||||||
|  |  | ||||||
|       shot_group_fixture(%{"count" => 1}, current_user, first_ammo_group) |       shot_group_fixture(%{count: 1}, current_user, first_ammo_group) | ||||||
|       assert 2 = Ammo.get_used_ammo_groups_count_for_type(ammo_type, current_user) |       assert 2 = Ammo.get_used_ammo_groups_count_for_type(ammo_type, current_user) | ||||||
|     end |     end | ||||||
|  |  | ||||||
| @@ -525,7 +525,7 @@ defmodule Cannery.AmmoTest do | |||||||
|  |  | ||||||
|       # testing ammo type with ammo group |       # testing ammo type with ammo group | ||||||
|       {1, [first_ammo_group]} = |       {1, [first_ammo_group]} = | ||||||
|         ammo_group_fixture(%{"count" => 1}, ammo_type, container, current_user) |         ammo_group_fixture(%{count: 1}, ammo_type, container, current_user) | ||||||
|  |  | ||||||
|       assert %{} == |       assert %{} == | ||||||
|                [ammo_type, another_ammo_type] |                [ammo_type, another_ammo_type] | ||||||
| @@ -533,17 +533,17 @@ defmodule Cannery.AmmoTest do | |||||||
|  |  | ||||||
|       # testing ammo type with used ammo group |       # testing ammo type with used ammo group | ||||||
|       {1, [another_ammo_group]} = |       {1, [another_ammo_group]} = | ||||||
|         ammo_group_fixture(%{"count" => 50}, another_ammo_type, container, current_user) |         ammo_group_fixture(%{count: 50}, another_ammo_type, container, current_user) | ||||||
|  |  | ||||||
|       shot_group_fixture(%{"count" => 50}, current_user, another_ammo_group) |       shot_group_fixture(%{count: 50}, current_user, another_ammo_group) | ||||||
|  |  | ||||||
|       assert %{another_ammo_type_id => 1} == |       assert %{another_ammo_type_id => 1} == | ||||||
|                [ammo_type, another_ammo_type] |                [ammo_type, another_ammo_type] | ||||||
|                |> Ammo.get_used_ammo_groups_count_for_types(current_user) |                |> Ammo.get_used_ammo_groups_count_for_types(current_user) | ||||||
|  |  | ||||||
|       # testing two ammo types with zero and one used ammo groups |       # testing two ammo types with zero and one used ammo groups | ||||||
|       {1, [ammo_group]} = ammo_group_fixture(%{"count" => 50}, ammo_type, container, current_user) |       {1, [ammo_group]} = ammo_group_fixture(%{count: 50}, ammo_type, container, current_user) | ||||||
|       shot_group_fixture(%{"count" => 50}, current_user, ammo_group) |       shot_group_fixture(%{count: 50}, current_user, ammo_group) | ||||||
|  |  | ||||||
|       used_counts = |       used_counts = | ||||||
|         [ammo_type, another_ammo_type] |> Ammo.get_used_ammo_groups_count_for_types(current_user) |         [ammo_type, another_ammo_type] |> Ammo.get_used_ammo_groups_count_for_types(current_user) | ||||||
| @@ -552,7 +552,7 @@ defmodule Cannery.AmmoTest do | |||||||
|       assert %{^another_ammo_type_id => 1} = used_counts |       assert %{^another_ammo_type_id => 1} = used_counts | ||||||
|  |  | ||||||
|       # testing two ammo type with one and two used ammo groups |       # testing two ammo type with one and two used ammo groups | ||||||
|       shot_group_fixture(%{"count" => 1}, current_user, first_ammo_group) |       shot_group_fixture(%{count: 1}, current_user, first_ammo_group) | ||||||
|  |  | ||||||
|       used_counts = |       used_counts = | ||||||
|         [ammo_type, another_ammo_type] |> Ammo.get_used_ammo_groups_count_for_types(current_user) |         [ammo_type, another_ammo_type] |> Ammo.get_used_ammo_groups_count_for_types(current_user) | ||||||
| @@ -564,19 +564,18 @@ defmodule Cannery.AmmoTest do | |||||||
|     test "get_ammo_groups_count_for_container!/2 gets accurate ammo count for container", |     test "get_ammo_groups_count_for_container!/2 gets accurate ammo count for container", | ||||||
|          %{ammo_type: ammo_type, current_user: current_user, container: container} do |          %{ammo_type: ammo_type, current_user: current_user, container: container} do | ||||||
|       {1, [first_ammo_group]} = |       {1, [first_ammo_group]} = | ||||||
|         ammo_group_fixture(%{"count" => 5}, ammo_type, container, current_user) |         ammo_group_fixture(%{count: 5}, ammo_type, container, current_user) | ||||||
|  |  | ||||||
|       assert 1 = Ammo.get_ammo_groups_count_for_container!(container, current_user) |       assert 1 = Ammo.get_ammo_groups_count_for_container!(container, current_user) | ||||||
|  |  | ||||||
|       {25, _ammo_groups} = |       {25, _ammo_groups} = ammo_group_fixture(%{count: 5}, 25, ammo_type, container, current_user) | ||||||
|         ammo_group_fixture(%{"count" => 5}, 25, ammo_type, container, current_user) |  | ||||||
|  |  | ||||||
|       assert 26 = Ammo.get_ammo_groups_count_for_container!(container, current_user) |       assert 26 = Ammo.get_ammo_groups_count_for_container!(container, current_user) | ||||||
|  |  | ||||||
|       shot_group_fixture(%{"count" => 1}, current_user, first_ammo_group) |       shot_group_fixture(%{count: 1}, current_user, first_ammo_group) | ||||||
|       assert 26 = Ammo.get_ammo_groups_count_for_container!(container, current_user) |       assert 26 = Ammo.get_ammo_groups_count_for_container!(container, current_user) | ||||||
|  |  | ||||||
|       shot_group_fixture(%{"count" => 4}, current_user, first_ammo_group) |       shot_group_fixture(%{count: 4}, current_user, first_ammo_group) | ||||||
|       assert 25 = Ammo.get_ammo_groups_count_for_container!(container, current_user) |       assert 25 = Ammo.get_ammo_groups_count_for_container!(container, current_user) | ||||||
|     end |     end | ||||||
|  |  | ||||||
| @@ -588,10 +587,10 @@ defmodule Cannery.AmmoTest do | |||||||
|       %{id: another_container_id} = another_container = container_fixture(current_user) |       %{id: another_container_id} = another_container = container_fixture(current_user) | ||||||
|  |  | ||||||
|       {1, [first_ammo_group]} = |       {1, [first_ammo_group]} = | ||||||
|         ammo_group_fixture(%{"count" => 5}, ammo_type, container, current_user) |         ammo_group_fixture(%{count: 5}, ammo_type, container, current_user) | ||||||
|  |  | ||||||
|       {1, [_first_ammo_group]} = |       {1, [_first_ammo_group]} = | ||||||
|         ammo_group_fixture(%{"count" => 5}, ammo_type, another_container, current_user) |         ammo_group_fixture(%{count: 5}, ammo_type, another_container, current_user) | ||||||
|  |  | ||||||
|       ammo_groups_count = |       ammo_groups_count = | ||||||
|         [container, another_container] |         [container, another_container] | ||||||
| @@ -600,8 +599,7 @@ defmodule Cannery.AmmoTest do | |||||||
|       assert %{^container_id => 1} = ammo_groups_count |       assert %{^container_id => 1} = ammo_groups_count | ||||||
|       assert %{^another_container_id => 1} = ammo_groups_count |       assert %{^another_container_id => 1} = ammo_groups_count | ||||||
|  |  | ||||||
|       {25, _ammo_groups} = |       {25, _ammo_groups} = ammo_group_fixture(%{count: 5}, 25, ammo_type, container, current_user) | ||||||
|         ammo_group_fixture(%{"count" => 5}, 25, ammo_type, container, current_user) |  | ||||||
|  |  | ||||||
|       ammo_groups_count = |       ammo_groups_count = | ||||||
|         [container, another_container] |         [container, another_container] | ||||||
| @@ -610,7 +608,7 @@ defmodule Cannery.AmmoTest do | |||||||
|       assert %{^container_id => 26} = ammo_groups_count |       assert %{^container_id => 26} = ammo_groups_count | ||||||
|       assert %{^another_container_id => 1} = ammo_groups_count |       assert %{^another_container_id => 1} = ammo_groups_count | ||||||
|  |  | ||||||
|       shot_group_fixture(%{"count" => 1}, current_user, first_ammo_group) |       shot_group_fixture(%{count: 1}, current_user, first_ammo_group) | ||||||
|  |  | ||||||
|       ammo_groups_count = |       ammo_groups_count = | ||||||
|         [container, another_container] |         [container, another_container] | ||||||
| @@ -619,7 +617,7 @@ defmodule Cannery.AmmoTest do | |||||||
|       assert %{^container_id => 26} = ammo_groups_count |       assert %{^container_id => 26} = ammo_groups_count | ||||||
|       assert %{^another_container_id => 1} = ammo_groups_count |       assert %{^another_container_id => 1} = ammo_groups_count | ||||||
|  |  | ||||||
|       shot_group_fixture(%{"count" => 4}, current_user, first_ammo_group) |       shot_group_fixture(%{count: 4}, current_user, first_ammo_group) | ||||||
|  |  | ||||||
|       ammo_groups_count = |       ammo_groups_count = | ||||||
|         [container, another_container] |         [container, another_container] | ||||||
| @@ -632,16 +630,15 @@ defmodule Cannery.AmmoTest do | |||||||
|     test "get_round_count_for_container!/2 gets accurate total round count for container", |     test "get_round_count_for_container!/2 gets accurate total round count for container", | ||||||
|          %{ammo_type: ammo_type, current_user: current_user, container: container} do |          %{ammo_type: ammo_type, current_user: current_user, container: container} do | ||||||
|       {1, [first_ammo_group]} = |       {1, [first_ammo_group]} = | ||||||
|         ammo_group_fixture(%{"count" => 5}, ammo_type, container, current_user) |         ammo_group_fixture(%{count: 5}, ammo_type, container, current_user) | ||||||
|  |  | ||||||
|       assert 5 = Ammo.get_round_count_for_container!(container, current_user) |       assert 5 = Ammo.get_round_count_for_container!(container, current_user) | ||||||
|  |  | ||||||
|       {25, _ammo_groups} = |       {25, _ammo_groups} = ammo_group_fixture(%{count: 5}, 25, ammo_type, container, current_user) | ||||||
|         ammo_group_fixture(%{"count" => 5}, 25, ammo_type, container, current_user) |  | ||||||
|  |  | ||||||
|       assert 130 = Ammo.get_round_count_for_container!(container, current_user) |       assert 130 = Ammo.get_round_count_for_container!(container, current_user) | ||||||
|  |  | ||||||
|       shot_group_fixture(%{"count" => 5}, current_user, first_ammo_group) |       shot_group_fixture(%{count: 5}, current_user, first_ammo_group) | ||||||
|       assert 125 = Ammo.get_round_count_for_container!(container, current_user) |       assert 125 = Ammo.get_round_count_for_container!(container, current_user) | ||||||
|     end |     end | ||||||
|  |  | ||||||
| @@ -654,10 +651,10 @@ defmodule Cannery.AmmoTest do | |||||||
|       %{id: another_container_id} = another_container = container_fixture(current_user) |       %{id: another_container_id} = another_container = container_fixture(current_user) | ||||||
|  |  | ||||||
|       {1, [first_ammo_group]} = |       {1, [first_ammo_group]} = | ||||||
|         ammo_group_fixture(%{"count" => 5}, ammo_type, container, current_user) |         ammo_group_fixture(%{count: 5}, ammo_type, container, current_user) | ||||||
|  |  | ||||||
|       {1, [_first_ammo_group]} = |       {1, [_first_ammo_group]} = | ||||||
|         ammo_group_fixture(%{"count" => 5}, ammo_type, another_container, current_user) |         ammo_group_fixture(%{count: 5}, ammo_type, another_container, current_user) | ||||||
|  |  | ||||||
|       round_counts = |       round_counts = | ||||||
|         [container, another_container] |> Ammo.get_round_count_for_containers(current_user) |         [container, another_container] |> Ammo.get_round_count_for_containers(current_user) | ||||||
| @@ -665,8 +662,7 @@ defmodule Cannery.AmmoTest do | |||||||
|       assert %{^container_id => 5} = round_counts |       assert %{^container_id => 5} = round_counts | ||||||
|       assert %{^another_container_id => 5} = round_counts |       assert %{^another_container_id => 5} = round_counts | ||||||
|  |  | ||||||
|       {25, _ammo_groups} = |       {25, _ammo_groups} = ammo_group_fixture(%{count: 5}, 25, ammo_type, container, current_user) | ||||||
|         ammo_group_fixture(%{"count" => 5}, 25, ammo_type, container, current_user) |  | ||||||
|  |  | ||||||
|       round_counts = |       round_counts = | ||||||
|         [container, another_container] |> Ammo.get_round_count_for_containers(current_user) |         [container, another_container] |> Ammo.get_round_count_for_containers(current_user) | ||||||
| @@ -674,7 +670,7 @@ defmodule Cannery.AmmoTest do | |||||||
|       assert %{^container_id => 130} = round_counts |       assert %{^container_id => 130} = round_counts | ||||||
|       assert %{^another_container_id => 5} = round_counts |       assert %{^another_container_id => 5} = round_counts | ||||||
|  |  | ||||||
|       shot_group_fixture(%{"count" => 5}, current_user, first_ammo_group) |       shot_group_fixture(%{count: 5}, current_user, first_ammo_group) | ||||||
|  |  | ||||||
|       round_counts = |       round_counts = | ||||||
|         [container, another_container] |> Ammo.get_round_count_for_containers(current_user) |         [container, another_container] |> Ammo.get_round_count_for_containers(current_user) | ||||||
| @@ -686,20 +682,20 @@ defmodule Cannery.AmmoTest do | |||||||
|  |  | ||||||
|   describe "ammo_groups" do |   describe "ammo_groups" do | ||||||
|     @valid_attrs %{ |     @valid_attrs %{ | ||||||
|       "count" => 42, |       count: 42, | ||||||
|       "notes" => "some notes", |       notes: "some notes", | ||||||
|       "price_paid" => 120.5, |       price_paid: 120.5, | ||||||
|       "purchased_on" => ~D[2022-11-19] |       purchased_on: ~D[2022-11-19] | ||||||
|     } |     } | ||||||
|     @update_attrs %{ |     @update_attrs %{ | ||||||
|       "count" => 43, |       count: 43, | ||||||
|       "notes" => "some updated notes", |       notes: "some updated notes", | ||||||
|       "price_paid" => 456.7 |       price_paid: 456.7 | ||||||
|     } |     } | ||||||
|     @invalid_attrs %{ |     @invalid_attrs %{ | ||||||
|       "count" => nil, |       count: nil, | ||||||
|       "notes" => nil, |       notes: nil, | ||||||
|       "price_paid" => nil |       price_paid: nil | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     setup do |     setup do | ||||||
| @@ -708,8 +704,7 @@ defmodule Cannery.AmmoTest do | |||||||
|       container = container_fixture(current_user) |       container = container_fixture(current_user) | ||||||
|  |  | ||||||
|       {1, [ammo_group]} = |       {1, [ammo_group]} = | ||||||
|         %{"count" => 50, "price_paid" => 36.1} |         ammo_group_fixture(%{count: 50, price_paid: 36.1}, ammo_type, container, current_user) | ||||||
|         |> ammo_group_fixture(ammo_type, container, current_user) |  | ||||||
|  |  | ||||||
|       another_user = user_fixture() |       another_user = user_fixture() | ||||||
|       another_ammo_type = ammo_type_fixture(another_user) |       another_ammo_type = ammo_type_fixture(another_user) | ||||||
| @@ -744,9 +739,9 @@ defmodule Cannery.AmmoTest do | |||||||
|       other_container = container_fixture(other_user) |       other_container = container_fixture(other_user) | ||||||
|  |  | ||||||
|       {1, [another_ammo_group]} = |       {1, [another_ammo_group]} = | ||||||
|         ammo_group_fixture(%{"count" => 30}, other_ammo_type, other_container, other_user) |         ammo_group_fixture(%{count: 30}, other_ammo_type, other_container, other_user) | ||||||
|  |  | ||||||
|       shot_group_fixture(%{"count" => 30}, other_user, another_ammo_group) |       shot_group_fixture(%{count: 30}, other_user, another_ammo_group) | ||||||
|       assert Ammo.get_ammo_groups_count!(other_user) == 0 |       assert Ammo.get_ammo_groups_count!(other_user) == 0 | ||||||
|       assert Ammo.get_ammo_groups_count!(other_user, true) == 1 |       assert Ammo.get_ammo_groups_count!(other_user, true) == 1 | ||||||
|     end |     end | ||||||
| @@ -755,11 +750,11 @@ defmodule Cannery.AmmoTest do | |||||||
|       current_user = user_fixture() |       current_user = user_fixture() | ||||||
|       container = container_fixture(current_user) |       container = container_fixture(current_user) | ||||||
|  |  | ||||||
|       rifle_ammo_type = ammo_type_fixture(%{"type" => "rifle"}, current_user) |       rifle_ammo_type = ammo_type_fixture(%{class: :rifle}, current_user) | ||||||
|       {1, [rifle_ammo_group]} = ammo_group_fixture(rifle_ammo_type, container, current_user) |       {1, [rifle_ammo_group]} = ammo_group_fixture(rifle_ammo_type, container, current_user) | ||||||
|       shotgun_ammo_type = ammo_type_fixture(%{"type" => "shotgun"}, current_user) |       shotgun_ammo_type = ammo_type_fixture(%{class: :shotgun}, current_user) | ||||||
|       {1, [shotgun_ammo_group]} = ammo_group_fixture(shotgun_ammo_type, container, current_user) |       {1, [shotgun_ammo_group]} = ammo_group_fixture(shotgun_ammo_type, container, current_user) | ||||||
|       pistol_ammo_type = ammo_type_fixture(%{"type" => "pistol"}, current_user) |       pistol_ammo_type = ammo_type_fixture(%{class: :pistol}, current_user) | ||||||
|       {1, [pistol_ammo_group]} = ammo_group_fixture(pistol_ammo_type, container, current_user) |       {1, [pistol_ammo_group]} = ammo_group_fixture(pistol_ammo_type, container, current_user) | ||||||
|  |  | ||||||
|       assert [^rifle_ammo_group] = Ammo.list_ammo_groups(nil, :rifle, current_user, false) |       assert [^rifle_ammo_group] = Ammo.list_ammo_groups(nil, :rifle, current_user, false) | ||||||
| @@ -786,9 +781,9 @@ defmodule Cannery.AmmoTest do | |||||||
|       current_user: current_user |       current_user: current_user | ||||||
|     } do |     } do | ||||||
|       {1, [%{id: another_ammo_group_id} = another_ammo_group]} = |       {1, [%{id: another_ammo_group_id} = another_ammo_group]} = | ||||||
|         ammo_group_fixture(%{"count" => 30}, ammo_type, container, current_user) |         ammo_group_fixture(%{count: 30}, ammo_type, container, current_user) | ||||||
|  |  | ||||||
|       shot_group_fixture(%{"count" => 30}, current_user, another_ammo_group) |       shot_group_fixture(%{count: 30}, current_user, another_ammo_group) | ||||||
|       another_ammo_group = Ammo.get_ammo_group!(another_ammo_group_id, current_user) |       another_ammo_group = Ammo.get_ammo_group!(another_ammo_group_id, current_user) | ||||||
|  |  | ||||||
|       assert Ammo.list_ammo_groups(nil, :all, current_user, false) == [ammo_group] |       assert Ammo.list_ammo_groups(nil, :all, current_user, false) == [ammo_group] | ||||||
| @@ -806,20 +801,20 @@ defmodule Cannery.AmmoTest do | |||||||
|       current_user: current_user |       current_user: current_user | ||||||
|     } do |     } do | ||||||
|       {1, [another_ammo_group]} = |       {1, [another_ammo_group]} = | ||||||
|         %{"count" => 49, "notes" => "cool ammo group"} |         %{count: 49, notes: "cool ammo group"} | ||||||
|         |> ammo_group_fixture(ammo_type, container, current_user) |         |> ammo_group_fixture(ammo_type, container, current_user) | ||||||
|  |  | ||||||
|       another_ammo_type = ammo_type_fixture(%{"name" => "amazing ammo"}, current_user) |       another_ammo_type = ammo_type_fixture(%{name: "amazing ammo"}, current_user) | ||||||
|       another_container = container_fixture(%{"name" => "fantastic container"}, current_user) |       another_container = container_fixture(%{name: "fantastic container"}, current_user) | ||||||
|  |  | ||||||
|       tag = tag_fixture(%{"name" => "stupendous tag"}, current_user) |       tag = tag_fixture(%{name: "stupendous tag"}, current_user) | ||||||
|       Containers.add_tag!(another_container, tag, current_user) |       Containers.add_tag!(another_container, tag, current_user) | ||||||
|  |  | ||||||
|       {1, [amazing_ammo_group]} = |       {1, [amazing_ammo_group]} = | ||||||
|         ammo_group_fixture(%{"count" => 48}, another_ammo_type, container, current_user) |         ammo_group_fixture(%{count: 48}, another_ammo_type, container, current_user) | ||||||
|  |  | ||||||
|       {1, [fantastic_ammo_group]} = |       {1, [fantastic_ammo_group]} = | ||||||
|         ammo_group_fixture(%{"count" => 47}, ammo_type, another_container, current_user) |         ammo_group_fixture(%{count: 47}, ammo_type, another_container, current_user) | ||||||
|  |  | ||||||
|       ammo_groups = Ammo.list_ammo_groups(nil, :all, current_user, false) |       ammo_groups = Ammo.list_ammo_groups(nil, :all, current_user, false) | ||||||
|       assert Enum.count(ammo_groups) == 4 |       assert Enum.count(ammo_groups) == 4 | ||||||
| @@ -863,11 +858,11 @@ defmodule Cannery.AmmoTest do | |||||||
|       current_user = user_fixture() |       current_user = user_fixture() | ||||||
|       container = container_fixture(current_user) |       container = container_fixture(current_user) | ||||||
|  |  | ||||||
|       rifle_ammo_type = ammo_type_fixture(%{"type" => "rifle"}, current_user) |       rifle_ammo_type = ammo_type_fixture(%{class: :rifle}, current_user) | ||||||
|       {1, [rifle_ammo_group]} = ammo_group_fixture(rifle_ammo_type, container, current_user) |       {1, [rifle_ammo_group]} = ammo_group_fixture(rifle_ammo_type, container, current_user) | ||||||
|       shotgun_ammo_type = ammo_type_fixture(%{"type" => "shotgun"}, current_user) |       shotgun_ammo_type = ammo_type_fixture(%{class: :shotgun}, current_user) | ||||||
|       {1, [shotgun_ammo_group]} = ammo_group_fixture(shotgun_ammo_type, container, current_user) |       {1, [shotgun_ammo_group]} = ammo_group_fixture(shotgun_ammo_type, container, current_user) | ||||||
|       pistol_ammo_type = ammo_type_fixture(%{"type" => "pistol"}, current_user) |       pistol_ammo_type = ammo_type_fixture(%{class: :pistol}, current_user) | ||||||
|       {1, [pistol_ammo_group]} = ammo_group_fixture(pistol_ammo_type, container, current_user) |       {1, [pistol_ammo_group]} = ammo_group_fixture(pistol_ammo_type, container, current_user) | ||||||
|  |  | ||||||
|       another_container = container_fixture(current_user) |       another_container = container_fixture(current_user) | ||||||
| @@ -948,7 +943,7 @@ defmodule Cannery.AmmoTest do | |||||||
|       current_user: current_user |       current_user: current_user | ||||||
|     } do |     } do | ||||||
|       {1, [another_ammo_group]} = |       {1, [another_ammo_group]} = | ||||||
|         ammo_group_fixture(%{"staged" => true}, ammo_type, container, current_user) |         ammo_group_fixture(%{staged: true}, ammo_type, container, current_user) | ||||||
|  |  | ||||||
|       assert Ammo.list_staged_ammo_groups(current_user) == [another_ammo_group] |       assert Ammo.list_staged_ammo_groups(current_user) == [another_ammo_group] | ||||||
|     end |     end | ||||||
| @@ -979,7 +974,7 @@ defmodule Cannery.AmmoTest do | |||||||
|     } do |     } do | ||||||
|       assert {:ok, {1, [%AmmoGroup{} = ammo_group]}} = |       assert {:ok, {1, [%AmmoGroup{} = ammo_group]}} = | ||||||
|                @valid_attrs |                @valid_attrs | ||||||
|                |> Map.merge(%{"ammo_type_id" => ammo_type.id, "container_id" => container.id}) |                |> Map.merge(%{ammo_type_id: ammo_type.id, container_id: container.id}) | ||||||
|                |> Ammo.create_ammo_groups(1, current_user) |                |> Ammo.create_ammo_groups(1, current_user) | ||||||
|  |  | ||||||
|       assert ammo_group.count == 42 |       assert ammo_group.count == 42 | ||||||
| @@ -994,7 +989,7 @@ defmodule Cannery.AmmoTest do | |||||||
|     } do |     } do | ||||||
|       assert {:ok, {3, ammo_groups}} = |       assert {:ok, {3, ammo_groups}} = | ||||||
|                @valid_attrs |                @valid_attrs | ||||||
|                |> Map.merge(%{"ammo_type_id" => ammo_type.id, "container_id" => container.id}) |                |> Map.merge(%{ammo_type_id: ammo_type.id, container_id: container.id}) | ||||||
|                |> Ammo.create_ammo_groups(3, current_user) |                |> Ammo.create_ammo_groups(3, current_user) | ||||||
|  |  | ||||||
|       assert [%AmmoGroup{}, %AmmoGroup{}, %AmmoGroup{}] = ammo_groups |       assert [%AmmoGroup{}, %AmmoGroup{}, %AmmoGroup{}] = ammo_groups | ||||||
| @@ -1011,7 +1006,7 @@ defmodule Cannery.AmmoTest do | |||||||
|          %{ammo_type: ammo_type, container: container, current_user: current_user} do |          %{ammo_type: ammo_type, container: container, current_user: current_user} do | ||||||
|       assert {:error, %Changeset{}} = |       assert {:error, %Changeset{}} = | ||||||
|                @invalid_attrs |                @invalid_attrs | ||||||
|                |> Map.merge(%{"ammo_type_id" => ammo_type.id, "container_id" => container.id}) |                |> Map.merge(%{ammo_type_id: ammo_type.id, container_id: container.id}) | ||||||
|                |> Ammo.create_ammo_groups(1, current_user) |                |> Ammo.create_ammo_groups(1, current_user) | ||||||
|     end |     end | ||||||
|  |  | ||||||
| @@ -1043,15 +1038,15 @@ defmodule Cannery.AmmoTest do | |||||||
|          %{ammo_group: %{id: ammo_group_id} = ammo_group, current_user: current_user} do |          %{ammo_group: %{id: ammo_group_id} = ammo_group, current_user: current_user} do | ||||||
|       assert 100 = ammo_group |> Ammo.get_percentage_remaining(current_user) |       assert 100 = ammo_group |> Ammo.get_percentage_remaining(current_user) | ||||||
|  |  | ||||||
|       shot_group_fixture(%{"count" => 14}, current_user, ammo_group) |       shot_group_fixture(%{count: 14}, current_user, ammo_group) | ||||||
|       ammo_group = Ammo.get_ammo_group!(ammo_group_id, current_user) |       ammo_group = Ammo.get_ammo_group!(ammo_group_id, current_user) | ||||||
|       assert 72 = ammo_group |> Ammo.get_percentage_remaining(current_user) |       assert 72 = ammo_group |> Ammo.get_percentage_remaining(current_user) | ||||||
|  |  | ||||||
|       shot_group_fixture(%{"count" => 11}, current_user, ammo_group) |       shot_group_fixture(%{count: 11}, current_user, ammo_group) | ||||||
|       ammo_group = Ammo.get_ammo_group!(ammo_group_id, current_user) |       ammo_group = Ammo.get_ammo_group!(ammo_group_id, current_user) | ||||||
|       assert 50 = ammo_group |> Ammo.get_percentage_remaining(current_user) |       assert 50 = ammo_group |> Ammo.get_percentage_remaining(current_user) | ||||||
|  |  | ||||||
|       shot_group_fixture(%{"count" => 25}, current_user, ammo_group) |       shot_group_fixture(%{count: 25}, current_user, ammo_group) | ||||||
|       ammo_group = Ammo.get_ammo_group!(ammo_group_id, current_user) |       ammo_group = Ammo.get_ammo_group!(ammo_group_id, current_user) | ||||||
|       assert 0 = ammo_group |> Ammo.get_percentage_remaining(current_user) |       assert 0 = ammo_group |> Ammo.get_percentage_remaining(current_user) | ||||||
|     end |     end | ||||||
| @@ -1066,7 +1061,7 @@ defmodule Cannery.AmmoTest do | |||||||
|                [ammo_group] |> Ammo.get_percentages_remaining(current_user) |                [ammo_group] |> Ammo.get_percentages_remaining(current_user) | ||||||
|  |  | ||||||
|       {1, [%{id: another_ammo_group_id} = another_ammo_group]} = |       {1, [%{id: another_ammo_group_id} = another_ammo_group]} = | ||||||
|         %{"count" => 50, "price_paid" => 36.1} |         %{count: 50, price_paid: 36.1} | ||||||
|         |> ammo_group_fixture(ammo_type, container, current_user) |         |> ammo_group_fixture(ammo_type, container, current_user) | ||||||
|  |  | ||||||
|       percentages = |       percentages = | ||||||
| @@ -1075,7 +1070,7 @@ defmodule Cannery.AmmoTest do | |||||||
|       assert %{^ammo_group_id => 100} = percentages |       assert %{^ammo_group_id => 100} = percentages | ||||||
|       assert %{^another_ammo_group_id => 100} = percentages |       assert %{^another_ammo_group_id => 100} = percentages | ||||||
|  |  | ||||||
|       shot_group_fixture(%{"count" => 14}, current_user, ammo_group) |       shot_group_fixture(%{count: 14}, current_user, ammo_group) | ||||||
|       ammo_group = Ammo.get_ammo_group!(ammo_group_id, current_user) |       ammo_group = Ammo.get_ammo_group!(ammo_group_id, current_user) | ||||||
|  |  | ||||||
|       percentages = |       percentages = | ||||||
| @@ -1084,7 +1079,7 @@ defmodule Cannery.AmmoTest do | |||||||
|       assert %{^ammo_group_id => 72} = percentages |       assert %{^ammo_group_id => 72} = percentages | ||||||
|       assert %{^another_ammo_group_id => 100} = percentages |       assert %{^another_ammo_group_id => 100} = percentages | ||||||
|  |  | ||||||
|       shot_group_fixture(%{"count" => 11}, current_user, ammo_group) |       shot_group_fixture(%{count: 11}, current_user, ammo_group) | ||||||
|       ammo_group = Ammo.get_ammo_group!(ammo_group_id, current_user) |       ammo_group = Ammo.get_ammo_group!(ammo_group_id, current_user) | ||||||
|  |  | ||||||
|       percentages = |       percentages = | ||||||
| @@ -1093,7 +1088,7 @@ defmodule Cannery.AmmoTest do | |||||||
|       assert %{^ammo_group_id => 50} = percentages |       assert %{^ammo_group_id => 50} = percentages | ||||||
|       assert %{^another_ammo_group_id => 100} = percentages |       assert %{^another_ammo_group_id => 100} = percentages | ||||||
|  |  | ||||||
|       shot_group_fixture(%{"count" => 25}, current_user, ammo_group) |       shot_group_fixture(%{count: 25}, current_user, ammo_group) | ||||||
|       ammo_group = Ammo.get_ammo_group!(ammo_group_id, current_user) |       ammo_group = Ammo.get_ammo_group!(ammo_group_id, current_user) | ||||||
|  |  | ||||||
|       percentages = |       percentages = | ||||||
| @@ -1105,12 +1100,12 @@ defmodule Cannery.AmmoTest do | |||||||
|  |  | ||||||
|     test "get_cpr/2 gets accurate cpr", |     test "get_cpr/2 gets accurate cpr", | ||||||
|          %{ammo_type: ammo_type, container: container, current_user: current_user} do |          %{ammo_type: ammo_type, container: container, current_user: current_user} do | ||||||
|       {1, [ammo_group]} = ammo_group_fixture(%{"count" => 1}, ammo_type, container, current_user) |       {1, [ammo_group]} = ammo_group_fixture(%{count: 1}, ammo_type, container, current_user) | ||||||
|       assert ammo_group |> Ammo.get_cpr(current_user) |> is_nil() |       assert ammo_group |> Ammo.get_cpr(current_user) |> is_nil() | ||||||
|  |  | ||||||
|       {1, [ammo_group]} = |       {1, [ammo_group]} = | ||||||
|         ammo_group_fixture( |         ammo_group_fixture( | ||||||
|           %{"count" => 1, "price_paid" => 1.0}, |           %{count: 1, price_paid: 1.0}, | ||||||
|           ammo_type, |           ammo_type, | ||||||
|           container, |           container, | ||||||
|           current_user |           current_user | ||||||
| @@ -1120,7 +1115,7 @@ defmodule Cannery.AmmoTest do | |||||||
|  |  | ||||||
|       {1, [ammo_group]} = |       {1, [ammo_group]} = | ||||||
|         ammo_group_fixture( |         ammo_group_fixture( | ||||||
|           %{"count" => 2, "price_paid" => 3.0}, |           %{count: 2, price_paid: 3.0}, | ||||||
|           ammo_type, |           ammo_type, | ||||||
|           container, |           container, | ||||||
|           current_user |           current_user | ||||||
| @@ -1130,7 +1125,7 @@ defmodule Cannery.AmmoTest do | |||||||
|  |  | ||||||
|       {1, [ammo_group]} = |       {1, [ammo_group]} = | ||||||
|         ammo_group_fixture( |         ammo_group_fixture( | ||||||
|           %{"count" => 50, "price_paid" => 36.1}, |           %{count: 50, price_paid: 36.1}, | ||||||
|           ammo_type, |           ammo_type, | ||||||
|           container, |           container, | ||||||
|           current_user |           current_user | ||||||
| @@ -1139,19 +1134,19 @@ defmodule Cannery.AmmoTest do | |||||||
|       assert 0.722 = ammo_group |> Ammo.get_cpr(current_user) |       assert 0.722 = ammo_group |> Ammo.get_cpr(current_user) | ||||||
|  |  | ||||||
|       # with shot group, maintains total |       # with shot group, maintains total | ||||||
|       shot_group_fixture(%{"count" => 14}, current_user, ammo_group) |       shot_group_fixture(%{count: 14}, current_user, ammo_group) | ||||||
|       ammo_group = Ammo.get_ammo_group!(ammo_group.id, current_user) |       ammo_group = Ammo.get_ammo_group!(ammo_group.id, current_user) | ||||||
|       assert 0.722 = ammo_group |> Ammo.get_cpr(current_user) |       assert 0.722 = ammo_group |> Ammo.get_cpr(current_user) | ||||||
|     end |     end | ||||||
|  |  | ||||||
|     test "get_cprs/2 gets accurate cprs", |     test "get_cprs/2 gets accurate cprs", | ||||||
|          %{ammo_type: ammo_type, container: container, current_user: current_user} do |          %{ammo_type: ammo_type, container: container, current_user: current_user} do | ||||||
|       {1, [ammo_group]} = ammo_group_fixture(%{"count" => 1}, ammo_type, container, current_user) |       {1, [ammo_group]} = ammo_group_fixture(%{count: 1}, ammo_type, container, current_user) | ||||||
|       assert %{} == [ammo_group] |> Ammo.get_cprs(current_user) |       assert %{} == [ammo_group] |> Ammo.get_cprs(current_user) | ||||||
|  |  | ||||||
|       {1, [%{id: ammo_group_id} = ammo_group]} = |       {1, [%{id: ammo_group_id} = ammo_group]} = | ||||||
|         ammo_group_fixture( |         ammo_group_fixture( | ||||||
|           %{"count" => 1, "price_paid" => 1.0}, |           %{count: 1, price_paid: 1.0}, | ||||||
|           ammo_type, |           ammo_type, | ||||||
|           container, |           container, | ||||||
|           current_user |           current_user | ||||||
| @@ -1161,7 +1156,7 @@ defmodule Cannery.AmmoTest do | |||||||
|  |  | ||||||
|       {1, [%{id: another_ammo_group_id} = another_ammo_group]} = |       {1, [%{id: another_ammo_group_id} = another_ammo_group]} = | ||||||
|         ammo_group_fixture( |         ammo_group_fixture( | ||||||
|           %{"count" => 2, "price_paid" => 3.0}, |           %{count: 2, price_paid: 3.0}, | ||||||
|           ammo_type, |           ammo_type, | ||||||
|           container, |           container, | ||||||
|           current_user |           current_user | ||||||
| @@ -1173,7 +1168,7 @@ defmodule Cannery.AmmoTest do | |||||||
|  |  | ||||||
|       {1, [%{id: yet_another_ammo_group_id} = yet_another_ammo_group]} = |       {1, [%{id: yet_another_ammo_group_id} = yet_another_ammo_group]} = | ||||||
|         ammo_group_fixture( |         ammo_group_fixture( | ||||||
|           %{"count" => 50, "price_paid" => 36.1}, |           %{count: 50, price_paid: 36.1}, | ||||||
|           ammo_type, |           ammo_type, | ||||||
|           container, |           container, | ||||||
|           current_user |           current_user | ||||||
| @@ -1187,7 +1182,7 @@ defmodule Cannery.AmmoTest do | |||||||
|       assert %{^yet_another_ammo_group_id => 0.722} = cprs |       assert %{^yet_another_ammo_group_id => 0.722} = cprs | ||||||
|  |  | ||||||
|       # with shot group, maintains total |       # with shot group, maintains total | ||||||
|       shot_group_fixture(%{"count" => 14}, current_user, yet_another_ammo_group) |       shot_group_fixture(%{count: 14}, current_user, yet_another_ammo_group) | ||||||
|       yet_another_ammo_group = Ammo.get_ammo_group!(yet_another_ammo_group.id, current_user) |       yet_another_ammo_group = Ammo.get_ammo_group!(yet_another_ammo_group.id, current_user) | ||||||
|  |  | ||||||
|       cprs = |       cprs = | ||||||
| @@ -1202,15 +1197,15 @@ defmodule Cannery.AmmoTest do | |||||||
|          %{ammo_group: %{id: ammo_group_id} = ammo_group, current_user: current_user} do |          %{ammo_group: %{id: ammo_group_id} = ammo_group, current_user: current_user} do | ||||||
|       assert 50 = ammo_group |> Ammo.get_original_count(current_user) |       assert 50 = ammo_group |> Ammo.get_original_count(current_user) | ||||||
|  |  | ||||||
|       shot_group_fixture(%{"count" => 14}, current_user, ammo_group) |       shot_group_fixture(%{count: 14}, current_user, ammo_group) | ||||||
|       ammo_group = Ammo.get_ammo_group!(ammo_group_id, current_user) |       ammo_group = Ammo.get_ammo_group!(ammo_group_id, current_user) | ||||||
|       assert 50 = ammo_group |> Ammo.get_original_count(current_user) |       assert 50 = ammo_group |> Ammo.get_original_count(current_user) | ||||||
|  |  | ||||||
|       shot_group_fixture(%{"count" => 11}, current_user, ammo_group) |       shot_group_fixture(%{count: 11}, current_user, ammo_group) | ||||||
|       ammo_group = Ammo.get_ammo_group!(ammo_group_id, current_user) |       ammo_group = Ammo.get_ammo_group!(ammo_group_id, current_user) | ||||||
|       assert 50 = ammo_group |> Ammo.get_original_count(current_user) |       assert 50 = ammo_group |> Ammo.get_original_count(current_user) | ||||||
|  |  | ||||||
|       shot_group_fixture(%{"count" => 25}, current_user, ammo_group) |       shot_group_fixture(%{count: 25}, current_user, ammo_group) | ||||||
|       ammo_group = Ammo.get_ammo_group!(ammo_group_id, current_user) |       ammo_group = Ammo.get_ammo_group!(ammo_group_id, current_user) | ||||||
|       assert 50 = ammo_group |> Ammo.get_original_count(current_user) |       assert 50 = ammo_group |> Ammo.get_original_count(current_user) | ||||||
|     end |     end | ||||||
| @@ -1222,25 +1217,25 @@ defmodule Cannery.AmmoTest do | |||||||
|       current_user: current_user |       current_user: current_user | ||||||
|     } do |     } do | ||||||
|       {1, [%{id: another_ammo_group_id} = another_ammo_group]} = |       {1, [%{id: another_ammo_group_id} = another_ammo_group]} = | ||||||
|         ammo_group_fixture(%{"count" => 25}, ammo_type, container, current_user) |         ammo_group_fixture(%{count: 25}, ammo_type, container, current_user) | ||||||
|  |  | ||||||
|       original_counts = [ammo_group, another_ammo_group] |> Ammo.get_original_counts(current_user) |       original_counts = [ammo_group, another_ammo_group] |> Ammo.get_original_counts(current_user) | ||||||
|       assert %{^ammo_group_id => 50} = original_counts |       assert %{^ammo_group_id => 50} = original_counts | ||||||
|       assert %{^another_ammo_group_id => 25} = original_counts |       assert %{^another_ammo_group_id => 25} = original_counts | ||||||
|  |  | ||||||
|       shot_group_fixture(%{"count" => 14}, current_user, ammo_group) |       shot_group_fixture(%{count: 14}, current_user, ammo_group) | ||||||
|       ammo_group = Ammo.get_ammo_group!(ammo_group_id, current_user) |       ammo_group = Ammo.get_ammo_group!(ammo_group_id, current_user) | ||||||
|       original_counts = [ammo_group, another_ammo_group] |> Ammo.get_original_counts(current_user) |       original_counts = [ammo_group, another_ammo_group] |> Ammo.get_original_counts(current_user) | ||||||
|       assert %{^ammo_group_id => 50} = original_counts |       assert %{^ammo_group_id => 50} = original_counts | ||||||
|       assert %{^another_ammo_group_id => 25} = original_counts |       assert %{^another_ammo_group_id => 25} = original_counts | ||||||
|  |  | ||||||
|       shot_group_fixture(%{"count" => 11}, current_user, ammo_group) |       shot_group_fixture(%{count: 11}, current_user, ammo_group) | ||||||
|       ammo_group = Ammo.get_ammo_group!(ammo_group_id, current_user) |       ammo_group = Ammo.get_ammo_group!(ammo_group_id, current_user) | ||||||
|       original_counts = [ammo_group, another_ammo_group] |> Ammo.get_original_counts(current_user) |       original_counts = [ammo_group, another_ammo_group] |> Ammo.get_original_counts(current_user) | ||||||
|       assert %{^ammo_group_id => 50} = original_counts |       assert %{^ammo_group_id => 50} = original_counts | ||||||
|       assert %{^another_ammo_group_id => 25} = original_counts |       assert %{^another_ammo_group_id => 25} = original_counts | ||||||
|  |  | ||||||
|       shot_group_fixture(%{"count" => 25}, current_user, ammo_group) |       shot_group_fixture(%{count: 25}, current_user, ammo_group) | ||||||
|       ammo_group = Ammo.get_ammo_group!(ammo_group_id, current_user) |       ammo_group = Ammo.get_ammo_group!(ammo_group_id, current_user) | ||||||
|       original_counts = [ammo_group, another_ammo_group] |> Ammo.get_original_counts(current_user) |       original_counts = [ammo_group, another_ammo_group] |> Ammo.get_original_counts(current_user) | ||||||
|       assert %{^ammo_group_id => 50} = original_counts |       assert %{^ammo_group_id => 50} = original_counts | ||||||
|   | |||||||
| @@ -10,37 +10,37 @@ defmodule Cannery.ContainersTest do | |||||||
|   @moduletag :containers_test |   @moduletag :containers_test | ||||||
|  |  | ||||||
|   @valid_attrs %{ |   @valid_attrs %{ | ||||||
|     "desc" => "some desc", |     desc: "some desc", | ||||||
|     "location" => "some location", |     location: "some location", | ||||||
|     "name" => "some name", |     name: "some name", | ||||||
|     "type" => "some type" |     type: "some type" | ||||||
|   } |   } | ||||||
|   @update_attrs %{ |   @update_attrs %{ | ||||||
|     "desc" => "some updated desc", |     desc: "some updated desc", | ||||||
|     "location" => "some updated location", |     location: "some updated location", | ||||||
|     "name" => "some updated name", |     name: "some updated name", | ||||||
|     "type" => "some updated type" |     type: "some updated type" | ||||||
|   } |   } | ||||||
|   @invalid_attrs %{ |   @invalid_attrs %{ | ||||||
|     "desc" => nil, |     desc: nil, | ||||||
|     "location" => nil, |     location: nil, | ||||||
|     "name" => nil, |     name: nil, | ||||||
|     "type" => nil |     type: nil | ||||||
|   } |   } | ||||||
|   @valid_tag_attrs %{ |   @valid_tag_attrs %{ | ||||||
|     "bg_color" => "#100000", |     bg_color: "#100000", | ||||||
|     "name" => "some name", |     name: "some name", | ||||||
|     "text_color" => "#000000" |     text_color: "#000000" | ||||||
|   } |   } | ||||||
|   @update_tag_attrs %{ |   @update_tag_attrs %{ | ||||||
|     "bg_color" => "#100001", |     bg_color: "#100001", | ||||||
|     "name" => "some updated name", |     name: "some updated name", | ||||||
|     "text_color" => "#000001" |     text_color: "#000001" | ||||||
|   } |   } | ||||||
|   @invalid_tag_attrs %{ |   @invalid_tag_attrs %{ | ||||||
|     "bg_color" => nil, |     bg_color: nil, | ||||||
|     "name" => nil, |     name: nil, | ||||||
|     "text_color" => nil |     text_color: nil | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   describe "containers" do |   describe "containers" do | ||||||
| @@ -57,25 +57,24 @@ defmodule Cannery.ContainersTest do | |||||||
|  |  | ||||||
|     test "list_containers/2 returns relevant containers for a user", |     test "list_containers/2 returns relevant containers for a user", | ||||||
|          %{current_user: current_user} do |          %{current_user: current_user} do | ||||||
|       container_a = container_fixture(%{"name" => "my cool container"}, current_user) |       container_a = container_fixture(%{name: "my cool container"}, current_user) | ||||||
|       container_b = container_fixture(%{"desc" => "a fascinating description"}, current_user) |       container_b = container_fixture(%{desc: "a fascinating description"}, current_user) | ||||||
|  |  | ||||||
|       %{id: container_c_id} = |       %{id: container_c_id} = | ||||||
|         container_c = container_fixture(%{"location" => "a secret place"}, current_user) |         container_c = container_fixture(%{location: "a secret place"}, current_user) | ||||||
|  |  | ||||||
|       tag = tag_fixture(%{"name" => "stupendous tag"}, current_user) |       tag = tag_fixture(%{name: "stupendous tag"}, current_user) | ||||||
|       Containers.add_tag!(container_c, tag, current_user) |       Containers.add_tag!(container_c, tag, current_user) | ||||||
|       container_c = container_c_id |> Containers.get_container!(current_user) |       container_c = container_c_id |> Containers.get_container!(current_user) | ||||||
|  |  | ||||||
|       %{id: container_d_id} = |       %{id: container_d_id} = | ||||||
|         container_d = container_fixture(%{"type" => "musty old box"}, current_user) |         container_d = container_fixture(%{type: "musty old box"}, current_user) | ||||||
|  |  | ||||||
|       tag = tag_fixture(%{"name" => "amazing tag"}, current_user) |       tag = tag_fixture(%{name: "amazing tag"}, current_user) | ||||||
|       Containers.add_tag!(container_d, tag, current_user) |       Containers.add_tag!(container_d, tag, current_user) | ||||||
|       container_d = container_d_id |> Containers.get_container!(current_user) |       container_d = container_d_id |> Containers.get_container!(current_user) | ||||||
|  |  | ||||||
|       _shouldnt_return = |       _shouldnt_return = container_fixture(%{name: "another person's container"}, user_fixture()) | ||||||
|         container_fixture(%{"name" => "another person's container"}, user_fixture()) |  | ||||||
|  |  | ||||||
|       # attributes |       # attributes | ||||||
|       assert Containers.list_containers("cool", current_user) == [container_a] |       assert Containers.list_containers("cool", current_user) == [container_a] | ||||||
| @@ -109,7 +108,7 @@ defmodule Cannery.ContainersTest do | |||||||
|  |  | ||||||
|     test "create_container/2 with valid data creates a container", %{current_user: current_user} do |     test "create_container/2 with valid data creates a container", %{current_user: current_user} do | ||||||
|       assert {:ok, %Container{} = container} = |       assert {:ok, %Container{} = container} = | ||||||
|                @valid_attrs |> Containers.create_container(current_user) |                Containers.create_container(@valid_attrs, current_user) | ||||||
|  |  | ||||||
|       assert container.desc == "some desc" |       assert container.desc == "some desc" | ||||||
|       assert container.location == "some location" |       assert container.location == "some location" | ||||||
| @@ -120,7 +119,7 @@ defmodule Cannery.ContainersTest do | |||||||
|  |  | ||||||
|     test "create_container/2 with invalid data returns error changeset", |     test "create_container/2 with invalid data returns error changeset", | ||||||
|          %{current_user: current_user} do |          %{current_user: current_user} do | ||||||
|       assert {:error, %Changeset{}} = @invalid_attrs |> Containers.create_container(current_user) |       assert {:error, %Changeset{}} = Containers.create_container(@invalid_attrs, current_user) | ||||||
|     end |     end | ||||||
|  |  | ||||||
|     test "update_container/3 with valid data updates the container", |     test "update_container/3 with valid data updates the container", | ||||||
| @@ -163,15 +162,10 @@ defmodule Cannery.ContainersTest do | |||||||
|     end |     end | ||||||
|  |  | ||||||
|     test "list_tags/2 returns relevant tags for a user", %{current_user: current_user} do |     test "list_tags/2 returns relevant tags for a user", %{current_user: current_user} do | ||||||
|       tag_a = tag_fixture(%{"name" => "bullets"}, current_user) |       tag_a = tag_fixture(%{name: "bullets"}, current_user) | ||||||
|       tag_b = tag_fixture(%{"name" => "hollows"}, current_user) |       tag_b = tag_fixture(%{name: "hollows"}, current_user) | ||||||
|  |  | ||||||
|       _shouldnt_return = |       tag_fixture(%{name: "bullet", desc: "pews brass shell"}, user_fixture()) | ||||||
|         %{ |  | ||||||
|           "name" => "bullet", |  | ||||||
|           "desc" => "pews brass shell" |  | ||||||
|         } |  | ||||||
|         |> tag_fixture(user_fixture()) |  | ||||||
|  |  | ||||||
|       # name |       # name | ||||||
|       assert Containers.list_tags("bullet", current_user) == [tag_a] |       assert Containers.list_tags("bullet", current_user) == [tag_a] | ||||||
|   | |||||||
| @@ -4,7 +4,6 @@ defmodule CanneryWeb.UserAuthTest do | |||||||
|   """ |   """ | ||||||
|  |  | ||||||
|   use CanneryWeb.ConnCase, async: true |   use CanneryWeb.ConnCase, async: true | ||||||
|   import CanneryWeb.Gettext |  | ||||||
|   alias Cannery.Accounts |   alias Cannery.Accounts | ||||||
|   alias CanneryWeb.UserAuth |   alias CanneryWeb.UserAuth | ||||||
|  |  | ||||||
| @@ -148,7 +147,7 @@ defmodule CanneryWeb.UserAuthTest do | |||||||
|       assert redirected_to(conn) == Routes.user_session_path(conn, :new) |       assert redirected_to(conn) == Routes.user_session_path(conn, :new) | ||||||
|  |  | ||||||
|       assert get_flash(conn, :error) == |       assert get_flash(conn, :error) == | ||||||
|                dgettext("errors", "You must confirm your account and log in to access this page.") |                "You must confirm your account and log in to access this page." | ||||||
|     end |     end | ||||||
|  |  | ||||||
|     test "stores the path to redirect to on GET", %{conn: conn} do |     test "stores the path to redirect to on GET", %{conn: conn} do | ||||||
|   | |||||||
| @@ -4,7 +4,6 @@ defmodule CanneryWeb.UserConfirmationControllerTest do | |||||||
|   """ |   """ | ||||||
|  |  | ||||||
|   use CanneryWeb.ConnCase, async: true |   use CanneryWeb.ConnCase, async: true | ||||||
|   import CanneryWeb.Gettext |  | ||||||
|   alias Cannery.{Accounts, Repo} |   alias Cannery.{Accounts, Repo} | ||||||
|  |  | ||||||
|   @moduletag :user_confirmation_controller_test |   @moduletag :user_confirmation_controller_test | ||||||
| @@ -17,7 +16,7 @@ defmodule CanneryWeb.UserConfirmationControllerTest do | |||||||
|     test "renders the confirmation page", %{conn: conn} do |     test "renders the confirmation page", %{conn: conn} do | ||||||
|       conn = get(conn, Routes.user_confirmation_path(conn, :new)) |       conn = get(conn, Routes.user_confirmation_path(conn, :new)) | ||||||
|       response = html_response(conn, 200) |       response = html_response(conn, 200) | ||||||
|       assert response =~ dgettext("actions", "Resend confirmation instructions") |       assert response =~ "Resend confirmation instructions" | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
|  |  | ||||||
| @@ -25,18 +24,12 @@ defmodule CanneryWeb.UserConfirmationControllerTest do | |||||||
|     @tag :capture_log |     @tag :capture_log | ||||||
|     test "sends a new confirmation token", %{conn: conn, user: user} do |     test "sends a new confirmation token", %{conn: conn, user: user} do | ||||||
|       conn = |       conn = | ||||||
|         post(conn, Routes.user_confirmation_path(conn, :create), %{ |         post(conn, Routes.user_confirmation_path(conn, :create), %{user: %{email: user.email}}) | ||||||
|           "user" => %{"email" => user.email} |  | ||||||
|         }) |  | ||||||
|  |  | ||||||
|       assert redirected_to(conn) == "/" |       assert redirected_to(conn) == "/" | ||||||
|  |  | ||||||
|       assert get_flash(conn, :info) =~ |       assert get_flash(conn, :info) =~ | ||||||
|                dgettext( |                "If your email is in our system and it has not been confirmed yet, you will receive an email with instructions shortly." | ||||||
|                  "prompts", |  | ||||||
|                  "If your email is in our system and it has not been confirmed yet, " <> |  | ||||||
|                    "you will receive an email with instructions shortly." |  | ||||||
|                ) |  | ||||||
|  |  | ||||||
|       assert Repo.get_by!(Accounts.UserToken, user_id: user.id).context == "confirm" |       assert Repo.get_by!(Accounts.UserToken, user_id: user.id).context == "confirm" | ||||||
|     end |     end | ||||||
| @@ -45,34 +38,24 @@ defmodule CanneryWeb.UserConfirmationControllerTest do | |||||||
|       Repo.update!(Accounts.User.confirm_changeset(user)) |       Repo.update!(Accounts.User.confirm_changeset(user)) | ||||||
|  |  | ||||||
|       conn = |       conn = | ||||||
|         post(conn, Routes.user_confirmation_path(conn, :create), %{ |         post(conn, Routes.user_confirmation_path(conn, :create), %{user: %{email: user.email}}) | ||||||
|           "user" => %{"email" => user.email} |  | ||||||
|         }) |  | ||||||
|  |  | ||||||
|       assert redirected_to(conn) == "/" |       assert redirected_to(conn) == "/" | ||||||
|  |  | ||||||
|       assert get_flash(conn, :info) =~ |       assert get_flash(conn, :info) =~ | ||||||
|                dgettext( |                "If your email is in our system and it has not been confirmed yet, you will receive an email with instructions shortly." | ||||||
|                  "prompts", |  | ||||||
|                  "If your email is in our system and it has not been confirmed yet, " <> |  | ||||||
|                    "you will receive an email with instructions shortly." |  | ||||||
|                ) |  | ||||||
|     end |     end | ||||||
|  |  | ||||||
|     test "does not send confirmation token if email is invalid", %{conn: conn} do |     test "does not send confirmation token if email is invalid", %{conn: conn} do | ||||||
|       conn = |       conn = | ||||||
|         post(conn, Routes.user_confirmation_path(conn, :create), %{ |         post(conn, Routes.user_confirmation_path(conn, :create), %{ | ||||||
|           "user" => %{"email" => "unknown@example.com"} |           user: %{email: "unknown@example.com"} | ||||||
|         }) |         }) | ||||||
|  |  | ||||||
|       assert redirected_to(conn) == "/" |       assert redirected_to(conn) == "/" | ||||||
|  |  | ||||||
|       assert get_flash(conn, :info) =~ |       assert get_flash(conn, :info) =~ | ||||||
|                dgettext( |                "If your email is in our system and it has not been confirmed yet, you will receive an email with instructions shortly." | ||||||
|                  "prompts", |  | ||||||
|                  "If your email is in our system and it has not been confirmed yet, " <> |  | ||||||
|                    "you will receive an email with instructions shortly." |  | ||||||
|                ) |  | ||||||
|  |  | ||||||
|       assert Repo.all(Accounts.UserToken) == [] |       assert Repo.all(Accounts.UserToken) == [] | ||||||
|     end |     end | ||||||
| @@ -87,10 +70,7 @@ defmodule CanneryWeb.UserConfirmationControllerTest do | |||||||
|  |  | ||||||
|       conn = get(conn, Routes.user_confirmation_path(conn, :confirm, token)) |       conn = get(conn, Routes.user_confirmation_path(conn, :confirm, token)) | ||||||
|       assert redirected_to(conn) == "/" |       assert redirected_to(conn) == "/" | ||||||
|  |       assert get_flash(conn, :info) =~ "#{user.email} confirmed successfully" | ||||||
|       assert get_flash(conn, :info) =~ |  | ||||||
|                dgettext("prompts", "%{email} confirmed successfully", email: user.email) |  | ||||||
|  |  | ||||||
|       assert Accounts.get_user!(user.id).confirmed_at |       assert Accounts.get_user!(user.id).confirmed_at | ||||||
|       refute get_session(conn, :user_token) |       refute get_session(conn, :user_token) | ||||||
|       assert Repo.all(Accounts.UserToken) == [] |       assert Repo.all(Accounts.UserToken) == [] | ||||||
| @@ -99,8 +79,7 @@ defmodule CanneryWeb.UserConfirmationControllerTest do | |||||||
|       conn = get(conn, Routes.user_confirmation_path(conn, :confirm, token)) |       conn = get(conn, Routes.user_confirmation_path(conn, :confirm, token)) | ||||||
|       assert redirected_to(conn) == "/" |       assert redirected_to(conn) == "/" | ||||||
|  |  | ||||||
|       assert get_flash(conn, :error) =~ |       assert get_flash(conn, :error) =~ "User confirmation link is invalid or it has expired" | ||||||
|                dgettext("errors", "User confirmation link is invalid or it has expired") |  | ||||||
|  |  | ||||||
|       # When logged in |       # When logged in | ||||||
|       conn = |       conn = | ||||||
| @@ -115,10 +94,7 @@ defmodule CanneryWeb.UserConfirmationControllerTest do | |||||||
|     test "does not confirm email with invalid token", %{conn: conn, user: user} do |     test "does not confirm email with invalid token", %{conn: conn, user: user} do | ||||||
|       conn = get(conn, Routes.user_confirmation_path(conn, :confirm, "oops")) |       conn = get(conn, Routes.user_confirmation_path(conn, :confirm, "oops")) | ||||||
|       assert redirected_to(conn) == "/" |       assert redirected_to(conn) == "/" | ||||||
|  |       assert get_flash(conn, :error) =~ "User confirmation link is invalid or it has expired" | ||||||
|       assert get_flash(conn, :error) =~ |  | ||||||
|                dgettext("errors", "User confirmation link is invalid or it has expired") |  | ||||||
|  |  | ||||||
|       refute Accounts.get_user!(user.id).confirmed_at |       refute Accounts.get_user!(user.id).confirmed_at | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
|   | |||||||
| @@ -4,7 +4,6 @@ defmodule CanneryWeb.UserRegistrationControllerTest do | |||||||
|   """ |   """ | ||||||
|  |  | ||||||
|   use CanneryWeb.ConnCase, async: true |   use CanneryWeb.ConnCase, async: true | ||||||
|   import CanneryWeb.Gettext |  | ||||||
|  |  | ||||||
|   @moduletag :user_registration_controller_test |   @moduletag :user_registration_controller_test | ||||||
|  |  | ||||||
| @@ -12,8 +11,8 @@ defmodule CanneryWeb.UserRegistrationControllerTest do | |||||||
|     test "renders registration page", %{conn: conn} do |     test "renders registration page", %{conn: conn} do | ||||||
|       conn = get(conn, Routes.user_registration_path(conn, :new)) |       conn = get(conn, Routes.user_registration_path(conn, :new)) | ||||||
|       response = html_response(conn, 200) |       response = html_response(conn, 200) | ||||||
|       assert response =~ dgettext("actions", "Register") |       assert response =~ "Register" | ||||||
|       assert response =~ dgettext("actions", "Log in") |       assert response =~ "Log in" | ||||||
|     end |     end | ||||||
|  |  | ||||||
|     test "redirects if already logged in", %{conn: conn} do |     test "redirects if already logged in", %{conn: conn} do | ||||||
| @@ -29,11 +28,11 @@ defmodule CanneryWeb.UserRegistrationControllerTest do | |||||||
|  |  | ||||||
|       conn = |       conn = | ||||||
|         post(conn, Routes.user_registration_path(conn, :create), %{ |         post(conn, Routes.user_registration_path(conn, :create), %{ | ||||||
|           "user" => valid_user_attributes(email: email) |           user: valid_user_attributes(email: email) | ||||||
|         }) |         }) | ||||||
|  |  | ||||||
|       assert get_session(conn, :phoenix_flash) == %{ |       assert get_session(conn, :phoenix_flash) == %{ | ||||||
|                "info" => dgettext("prompts", "Please check your email to verify your account") |                "info" => "Please check your email to verify your account" | ||||||
|              } |              } | ||||||
|  |  | ||||||
|       assert redirected_to(conn) =~ "/" |       assert redirected_to(conn) =~ "/" | ||||||
| @@ -48,11 +47,11 @@ defmodule CanneryWeb.UserRegistrationControllerTest do | |||||||
|     test "render errors for invalid data", %{conn: conn} do |     test "render errors for invalid data", %{conn: conn} do | ||||||
|       conn = |       conn = | ||||||
|         post(conn, Routes.user_registration_path(conn, :create), %{ |         post(conn, Routes.user_registration_path(conn, :create), %{ | ||||||
|           "user" => %{"email" => "with spaces", "password" => "too short"} |           user: %{email: "with spaces", password: "too short"} | ||||||
|         }) |         }) | ||||||
|  |  | ||||||
|       response = html_response(conn, 200) |       response = html_response(conn, 200) | ||||||
|       assert response =~ gettext("Register") |       assert response =~ "Register" | ||||||
|       assert response =~ "must have the @ sign and no spaces" |       assert response =~ "must have the @ sign and no spaces" | ||||||
|       assert response =~ "should be at least 12 character" |       assert response =~ "should be at least 12 character" | ||||||
|     end |     end | ||||||
|   | |||||||
| @@ -4,7 +4,6 @@ defmodule CanneryWeb.UserResetPasswordControllerTest do | |||||||
|   """ |   """ | ||||||
|  |  | ||||||
|   use CanneryWeb.ConnCase, async: true |   use CanneryWeb.ConnCase, async: true | ||||||
|   import CanneryWeb.Gettext |  | ||||||
|   alias Cannery.{Accounts, Repo} |   alias Cannery.{Accounts, Repo} | ||||||
|  |  | ||||||
|   @moduletag :user_reset_password_controller_test |   @moduletag :user_reset_password_controller_test | ||||||
| @@ -17,7 +16,7 @@ defmodule CanneryWeb.UserResetPasswordControllerTest do | |||||||
|     test "renders the reset password page", %{conn: conn} do |     test "renders the reset password page", %{conn: conn} do | ||||||
|       conn = get(conn, Routes.user_reset_password_path(conn, :new)) |       conn = get(conn, Routes.user_reset_password_path(conn, :new)) | ||||||
|       response = html_response(conn, 200) |       response = html_response(conn, 200) | ||||||
|       assert response =~ dgettext("actions", "Forgot your password?") |       assert response =~ "Forgot your password?" | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
|  |  | ||||||
| @@ -25,17 +24,12 @@ defmodule CanneryWeb.UserResetPasswordControllerTest do | |||||||
|     @tag :capture_log |     @tag :capture_log | ||||||
|     test "sends a new reset password token", %{conn: conn, user: user} do |     test "sends a new reset password token", %{conn: conn, user: user} do | ||||||
|       conn = |       conn = | ||||||
|         post(conn, Routes.user_reset_password_path(conn, :create), %{ |         post(conn, Routes.user_reset_password_path(conn, :create), %{user: %{email: user.email}}) | ||||||
|           "user" => %{"email" => user.email} |  | ||||||
|         }) |  | ||||||
|  |  | ||||||
|       assert redirected_to(conn) == "/" |       assert redirected_to(conn) == "/" | ||||||
|  |  | ||||||
|       assert get_flash(conn, :info) =~ |       assert get_flash(conn, :info) =~ | ||||||
|                dgettext( |  | ||||||
|                  "prompts", |  | ||||||
|                "If your email is in our system, you will receive instructions to reset your password shortly." |                "If your email is in our system, you will receive instructions to reset your password shortly." | ||||||
|                ) |  | ||||||
|  |  | ||||||
|       assert Repo.get_by!(Accounts.UserToken, user_id: user.id).context == "reset_password" |       assert Repo.get_by!(Accounts.UserToken, user_id: user.id).context == "reset_password" | ||||||
|     end |     end | ||||||
| @@ -43,16 +37,13 @@ defmodule CanneryWeb.UserResetPasswordControllerTest do | |||||||
|     test "does not send reset password token if email is invalid", %{conn: conn} do |     test "does not send reset password token if email is invalid", %{conn: conn} do | ||||||
|       conn = |       conn = | ||||||
|         post(conn, Routes.user_reset_password_path(conn, :create), %{ |         post(conn, Routes.user_reset_password_path(conn, :create), %{ | ||||||
|           "user" => %{"email" => "unknown@example.com"} |           user: %{email: "unknown@example.com"} | ||||||
|         }) |         }) | ||||||
|  |  | ||||||
|       assert redirected_to(conn) == "/" |       assert redirected_to(conn) == "/" | ||||||
|  |  | ||||||
|       assert get_flash(conn, :info) =~ |       assert get_flash(conn, :info) =~ | ||||||
|                dgettext( |  | ||||||
|                  "prompts", |  | ||||||
|                "If your email is in our system, you will receive instructions to reset your password shortly." |                "If your email is in our system, you will receive instructions to reset your password shortly." | ||||||
|                ) |  | ||||||
|  |  | ||||||
|       assert Repo.all(Accounts.UserToken) == [] |       assert Repo.all(Accounts.UserToken) == [] | ||||||
|     end |     end | ||||||
| @@ -70,15 +61,13 @@ defmodule CanneryWeb.UserResetPasswordControllerTest do | |||||||
|  |  | ||||||
|     test "renders reset password", %{conn: conn, token: token} do |     test "renders reset password", %{conn: conn, token: token} do | ||||||
|       conn = get(conn, Routes.user_reset_password_path(conn, :edit, token)) |       conn = get(conn, Routes.user_reset_password_path(conn, :edit, token)) | ||||||
|       assert html_response(conn, 200) =~ dgettext("actions", "Reset password") |       assert html_response(conn, 200) =~ "Reset password" | ||||||
|     end |     end | ||||||
|  |  | ||||||
|     test "does not render reset password with invalid token", %{conn: conn} do |     test "does not render reset password with invalid token", %{conn: conn} do | ||||||
|       conn = get(conn, Routes.user_reset_password_path(conn, :edit, "oops")) |       conn = get(conn, Routes.user_reset_password_path(conn, :edit, "oops")) | ||||||
|       assert redirected_to(conn) == "/" |       assert redirected_to(conn) == "/" | ||||||
|  |       assert get_flash(conn, :error) =~ "Reset password link is invalid or it has expired" | ||||||
|       assert get_flash(conn, :error) =~ |  | ||||||
|                dgettext("errors", "Reset password link is invalid or it has expired") |  | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
|  |  | ||||||
| @@ -95,39 +84,37 @@ defmodule CanneryWeb.UserResetPasswordControllerTest do | |||||||
|     test "resets password once", %{conn: conn, user: user, token: token} do |     test "resets password once", %{conn: conn, user: user, token: token} do | ||||||
|       conn = |       conn = | ||||||
|         put(conn, Routes.user_reset_password_path(conn, :update, token), %{ |         put(conn, Routes.user_reset_password_path(conn, :update, token), %{ | ||||||
|           "user" => %{ |           user: %{ | ||||||
|             "password" => "new valid password", |             password: "new valid password", | ||||||
|             "password_confirmation" => "new valid password" |             password_confirmation: "new valid password" | ||||||
|           } |           } | ||||||
|         }) |         }) | ||||||
|  |  | ||||||
|       assert redirected_to(conn) == Routes.user_session_path(conn, :new) |       assert redirected_to(conn) == Routes.user_session_path(conn, :new) | ||||||
|       refute get_session(conn, :user_token) |       refute get_session(conn, :user_token) | ||||||
|       assert get_flash(conn, :info) =~ dgettext("prompts", "Password reset successfully") |       assert get_flash(conn, :info) =~ "Password reset successfully" | ||||||
|       assert Accounts.get_user_by_email_and_password(user.email, "new valid password") |       assert Accounts.get_user_by_email_and_password(user.email, "new valid password") | ||||||
|     end |     end | ||||||
|  |  | ||||||
|     test "does not reset password on invalid data", %{conn: conn, token: token} do |     test "does not reset password on invalid data", %{conn: conn, token: token} do | ||||||
|       conn = |       conn = | ||||||
|         put(conn, Routes.user_reset_password_path(conn, :update, token), %{ |         put(conn, Routes.user_reset_password_path(conn, :update, token), %{ | ||||||
|           "user" => %{ |           user: %{ | ||||||
|             "password" => "too short", |             password: "too short", | ||||||
|             "password_confirmation" => "does not match" |             password_confirmation: "does not match" | ||||||
|           } |           } | ||||||
|         }) |         }) | ||||||
|  |  | ||||||
|       response = html_response(conn, 200) |       response = html_response(conn, 200) | ||||||
|       assert response =~ gettext("Reset password") |       assert response =~ "Reset password" | ||||||
|       assert response =~ dgettext("errors", "should be at least 12 character(s)") |       assert response =~ "should be at least 12 character(s)" | ||||||
|       assert response =~ dgettext("errors", "does not match password") |       assert response =~ "does not match password" | ||||||
|     end |     end | ||||||
|  |  | ||||||
|     test "does not reset password with invalid token", %{conn: conn} do |     test "does not reset password with invalid token", %{conn: conn} do | ||||||
|       conn = put(conn, Routes.user_reset_password_path(conn, :update, "oops")) |       conn = put(conn, Routes.user_reset_password_path(conn, :update, "oops")) | ||||||
|       assert redirected_to(conn) == "/" |       assert redirected_to(conn) == "/" | ||||||
|  |       assert get_flash(conn, :error) =~ "Reset password link is invalid or it has expired" | ||||||
|       assert get_flash(conn, :error) =~ |  | ||||||
|                dgettext("errors", "Reset password link is invalid or it has expired") |  | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
| end | end | ||||||
|   | |||||||
| @@ -4,7 +4,6 @@ defmodule CanneryWeb.UserSessionControllerTest do | |||||||
|   """ |   """ | ||||||
|  |  | ||||||
|   use CanneryWeb.ConnCase, async: true |   use CanneryWeb.ConnCase, async: true | ||||||
|   import CanneryWeb.Gettext |  | ||||||
|  |  | ||||||
|   @moduletag :user_session_controller_test |   @moduletag :user_session_controller_test | ||||||
|  |  | ||||||
| @@ -16,7 +15,7 @@ defmodule CanneryWeb.UserSessionControllerTest do | |||||||
|     test "renders log in page", %{conn: conn} do |     test "renders log in page", %{conn: conn} do | ||||||
|       conn = get(conn, Routes.user_session_path(conn, :new)) |       conn = get(conn, Routes.user_session_path(conn, :new)) | ||||||
|       response = html_response(conn, 200) |       response = html_response(conn, 200) | ||||||
|       assert response =~ dgettext("actions", "Log in") |       assert response =~ "Log in" | ||||||
|     end |     end | ||||||
|  |  | ||||||
|     test "redirects if already logged in", %{conn: conn, current_user: current_user} do |     test "redirects if already logged in", %{conn: conn, current_user: current_user} do | ||||||
| @@ -29,7 +28,7 @@ defmodule CanneryWeb.UserSessionControllerTest do | |||||||
|     test "logs the user in", %{conn: conn, current_user: current_user} do |     test "logs the user in", %{conn: conn, current_user: current_user} do | ||||||
|       conn = |       conn = | ||||||
|         post(conn, Routes.user_session_path(conn, :create), %{ |         post(conn, Routes.user_session_path(conn, :create), %{ | ||||||
|           "user" => %{"email" => current_user.email, "password" => valid_user_password()} |           user: %{email: current_user.email, password: valid_user_password()} | ||||||
|         }) |         }) | ||||||
|  |  | ||||||
|       assert get_session(conn, :user_token) |       assert get_session(conn, :user_token) | ||||||
| @@ -39,16 +38,16 @@ defmodule CanneryWeb.UserSessionControllerTest do | |||||||
|       conn = get(conn, "/") |       conn = get(conn, "/") | ||||||
|       response = html_response(conn, 200) |       response = html_response(conn, 200) | ||||||
|       assert response =~ current_user.email |       assert response =~ current_user.email | ||||||
|       assert response =~ dgettext("prompts", "Are you sure you want to log out?") |       assert response =~ "Are you sure you want to log out?" | ||||||
|     end |     end | ||||||
|  |  | ||||||
|     test "logs the user in with remember me", %{conn: conn, current_user: current_user} do |     test "logs the user in with remember me", %{conn: conn, current_user: current_user} do | ||||||
|       conn = |       conn = | ||||||
|         post(conn, Routes.user_session_path(conn, :create), %{ |         post(conn, Routes.user_session_path(conn, :create), %{ | ||||||
|           "user" => %{ |           user: %{ | ||||||
|             "email" => current_user.email, |             email: current_user.email, | ||||||
|             "password" => valid_user_password(), |             password: valid_user_password(), | ||||||
|             "remember_me" => "true" |             remember_me: "true" | ||||||
|           } |           } | ||||||
|         }) |         }) | ||||||
|  |  | ||||||
| @@ -61,9 +60,9 @@ defmodule CanneryWeb.UserSessionControllerTest do | |||||||
|         conn |         conn | ||||||
|         |> init_test_session(user_return_to: "/foo/bar") |         |> init_test_session(user_return_to: "/foo/bar") | ||||||
|         |> post(Routes.user_session_path(conn, :create), %{ |         |> post(Routes.user_session_path(conn, :create), %{ | ||||||
|           "user" => %{ |           user: %{ | ||||||
|             "email" => current_user.email, |             email: current_user.email, | ||||||
|             "password" => valid_user_password() |             password: valid_user_password() | ||||||
|           } |           } | ||||||
|         }) |         }) | ||||||
|  |  | ||||||
| @@ -74,12 +73,12 @@ defmodule CanneryWeb.UserSessionControllerTest do | |||||||
|          %{conn: conn, current_user: current_user} do |          %{conn: conn, current_user: current_user} do | ||||||
|       conn = |       conn = | ||||||
|         post(conn, Routes.user_session_path(conn, :create), %{ |         post(conn, Routes.user_session_path(conn, :create), %{ | ||||||
|           "user" => %{"email" => current_user.email, "password" => "bad"} |           user: %{email: current_user.email, password: "bad"} | ||||||
|         }) |         }) | ||||||
|  |  | ||||||
|       response = html_response(conn, 200) |       response = html_response(conn, 200) | ||||||
|       assert response =~ dgettext("actions", "Log in") |       assert response =~ "Log in" | ||||||
|       assert response =~ dgettext("errors", "Invalid email or password") |       assert response =~ "Invalid email or password" | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
|  |  | ||||||
| @@ -88,14 +87,14 @@ defmodule CanneryWeb.UserSessionControllerTest do | |||||||
|       conn = conn |> log_in_user(current_user) |> delete(Routes.user_session_path(conn, :delete)) |       conn = conn |> log_in_user(current_user) |> delete(Routes.user_session_path(conn, :delete)) | ||||||
|       assert redirected_to(conn) == "/" |       assert redirected_to(conn) == "/" | ||||||
|       refute get_session(conn, :user_token) |       refute get_session(conn, :user_token) | ||||||
|       assert get_flash(conn, :info) =~ gettext("Logged out successfully") |       assert get_flash(conn, :info) =~ "Logged out successfully" | ||||||
|     end |     end | ||||||
|  |  | ||||||
|     test "succeeds even if the user is not logged in", %{conn: conn} do |     test "succeeds even if the user is not logged in", %{conn: conn} do | ||||||
|       conn = delete(conn, Routes.user_session_path(conn, :delete)) |       conn = delete(conn, Routes.user_session_path(conn, :delete)) | ||||||
|       assert redirected_to(conn) == "/" |       assert redirected_to(conn) == "/" | ||||||
|       refute get_session(conn, :user_token) |       refute get_session(conn, :user_token) | ||||||
|       assert get_flash(conn, :info) =~ gettext("Logged out successfully") |       assert get_flash(conn, :info) =~ "Logged out successfully" | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
| end | end | ||||||
|   | |||||||
| @@ -4,7 +4,6 @@ defmodule CanneryWeb.UserSettingsControllerTest do | |||||||
|   """ |   """ | ||||||
|  |  | ||||||
|   use CanneryWeb.ConnCase, async: true |   use CanneryWeb.ConnCase, async: true | ||||||
|   import CanneryWeb.Gettext |  | ||||||
|   alias Cannery.Accounts |   alias Cannery.Accounts | ||||||
|  |  | ||||||
|   @moduletag :user_settings_controller_test |   @moduletag :user_settings_controller_test | ||||||
| @@ -15,7 +14,7 @@ defmodule CanneryWeb.UserSettingsControllerTest do | |||||||
|     test "renders settings page", %{conn: conn} do |     test "renders settings page", %{conn: conn} do | ||||||
|       conn = get(conn, Routes.user_settings_path(conn, :edit)) |       conn = get(conn, Routes.user_settings_path(conn, :edit)) | ||||||
|       response = html_response(conn, 200) |       response = html_response(conn, 200) | ||||||
|       assert response =~ gettext("Settings") |       assert response =~ "Settings" | ||||||
|     end |     end | ||||||
|  |  | ||||||
|     test "redirects if user is not logged in" do |     test "redirects if user is not logged in" do | ||||||
| @@ -30,40 +29,36 @@ defmodule CanneryWeb.UserSettingsControllerTest do | |||||||
|          %{conn: conn, current_user: current_user} do |          %{conn: conn, current_user: current_user} do | ||||||
|       new_password_conn = |       new_password_conn = | ||||||
|         put(conn, Routes.user_settings_path(conn, :update), %{ |         put(conn, Routes.user_settings_path(conn, :update), %{ | ||||||
|           "action" => "update_password", |           action: "update_password", | ||||||
|           "current_password" => valid_user_password(), |           current_password: valid_user_password(), | ||||||
|           "user" => %{ |           user: %{ | ||||||
|             "password" => "new valid password", |             password: "new valid password", | ||||||
|             "password_confirmation" => "new valid password" |             password_confirmation: "new valid password" | ||||||
|           } |           } | ||||||
|         }) |         }) | ||||||
|  |  | ||||||
|       assert redirected_to(new_password_conn) == Routes.user_settings_path(conn, :edit) |       assert redirected_to(new_password_conn) == Routes.user_settings_path(conn, :edit) | ||||||
|       assert get_session(new_password_conn, :user_token) != get_session(conn, :user_token) |       assert get_session(new_password_conn, :user_token) != get_session(conn, :user_token) | ||||||
|  |       assert get_flash(new_password_conn, :info) =~ "Password updated successfully" | ||||||
|       assert get_flash(new_password_conn, :info) =~ |  | ||||||
|                dgettext("actions", "Password updated successfully") |  | ||||||
|  |  | ||||||
|       assert Accounts.get_user_by_email_and_password(current_user.email, "new valid password") |       assert Accounts.get_user_by_email_and_password(current_user.email, "new valid password") | ||||||
|     end |     end | ||||||
|  |  | ||||||
|     test "does not update password on invalid data", %{conn: conn} do |     test "does not update password on invalid data", %{conn: conn} do | ||||||
|       old_password_conn = |       old_password_conn = | ||||||
|         put(conn, Routes.user_settings_path(conn, :update), %{ |         put(conn, Routes.user_settings_path(conn, :update), %{ | ||||||
|           "action" => "update_password", |           action: "update_password", | ||||||
|           "current_password" => "invalid", |           current_password: "invalid", | ||||||
|           "user" => %{ |           user: %{ | ||||||
|             "password" => "too short", |             password: "too short", | ||||||
|             "password_confirmation" => "does not match" |             password_confirmation: "does not match" | ||||||
|           } |           } | ||||||
|         }) |         }) | ||||||
|  |  | ||||||
|       response = html_response(old_password_conn, 200) |       response = html_response(old_password_conn, 200) | ||||||
|       assert response =~ gettext("Settings") |       assert response =~ "Settings" | ||||||
|       assert response =~ dgettext("errors", "should be at least 12 character(s)") |       assert response =~ "should be at least 12 character(s)" | ||||||
|       assert response =~ dgettext("errors", "does not match password") |       assert response =~ "does not match password" | ||||||
|       assert response =~ dgettext("errors", "is not valid") |       assert response =~ "is not valid" | ||||||
|  |  | ||||||
|       assert get_session(old_password_conn, :user_token) == get_session(conn, :user_token) |       assert get_session(old_password_conn, :user_token) == get_session(conn, :user_token) | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
| @@ -73,18 +68,15 @@ defmodule CanneryWeb.UserSettingsControllerTest do | |||||||
|     test "updates the user email", %{conn: conn, current_user: current_user} do |     test "updates the user email", %{conn: conn, current_user: current_user} do | ||||||
|       conn = |       conn = | ||||||
|         put(conn, Routes.user_settings_path(conn, :update), %{ |         put(conn, Routes.user_settings_path(conn, :update), %{ | ||||||
|           "action" => "update_email", |           action: "update_email", | ||||||
|           "current_password" => valid_user_password(), |           current_password: valid_user_password(), | ||||||
|           "user" => %{"email" => unique_user_email()} |           user: %{email: unique_user_email()} | ||||||
|         }) |         }) | ||||||
|  |  | ||||||
|       assert redirected_to(conn) == Routes.user_settings_path(conn, :edit) |       assert redirected_to(conn) == Routes.user_settings_path(conn, :edit) | ||||||
|  |  | ||||||
|       assert get_flash(conn, :info) =~ |       assert get_flash(conn, :info) =~ | ||||||
|                dgettext( |  | ||||||
|                  "prompts", |  | ||||||
|                "A link to confirm your email change has been sent to the new address." |                "A link to confirm your email change has been sent to the new address." | ||||||
|                ) |  | ||||||
|  |  | ||||||
|       assert Accounts.get_user_by_email(current_user.email) |       assert Accounts.get_user_by_email(current_user.email) | ||||||
|     end |     end | ||||||
| @@ -92,15 +84,15 @@ defmodule CanneryWeb.UserSettingsControllerTest do | |||||||
|     test "does not update email on invalid data", %{conn: conn} do |     test "does not update email on invalid data", %{conn: conn} do | ||||||
|       conn = |       conn = | ||||||
|         put(conn, Routes.user_settings_path(conn, :update), %{ |         put(conn, Routes.user_settings_path(conn, :update), %{ | ||||||
|           "action" => "update_email", |           action: "update_email", | ||||||
|           "current_password" => "invalid", |           current_password: "invalid", | ||||||
|           "user" => %{"email" => "with spaces"} |           user: %{email: "with spaces"} | ||||||
|         }) |         }) | ||||||
|  |  | ||||||
|       response = html_response(conn, 200) |       response = html_response(conn, 200) | ||||||
|       assert response =~ gettext("Settings") |       assert response =~ "Settings" | ||||||
|       assert response =~ dgettext("errors", "must have the @ sign and no spaces") |       assert response =~ "must have the @ sign and no spaces" | ||||||
|       assert response =~ dgettext("errors", "is not valid") |       assert response =~ "is not valid" | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
|  |  | ||||||
| @@ -124,24 +116,19 @@ defmodule CanneryWeb.UserSettingsControllerTest do | |||||||
|          %{conn: conn, current_user: current_user, token: token, email: email} do |          %{conn: conn, current_user: current_user, token: token, email: email} do | ||||||
|       conn = get(conn, Routes.user_settings_path(conn, :confirm_email, token)) |       conn = get(conn, Routes.user_settings_path(conn, :confirm_email, token)) | ||||||
|       assert redirected_to(conn) == Routes.user_settings_path(conn, :edit) |       assert redirected_to(conn) == Routes.user_settings_path(conn, :edit) | ||||||
|       assert get_flash(conn, :info) =~ dgettext("prompts", "Email changed successfully") |       assert get_flash(conn, :info) =~ "Email changed successfully" | ||||||
|       refute Accounts.get_user_by_email(current_user.email) |       refute Accounts.get_user_by_email(current_user.email) | ||||||
|       assert Accounts.get_user_by_email(email) |       assert Accounts.get_user_by_email(email) | ||||||
|  |  | ||||||
|       conn = get(conn, Routes.user_settings_path(conn, :confirm_email, token)) |       conn = get(conn, Routes.user_settings_path(conn, :confirm_email, token)) | ||||||
|       assert redirected_to(conn) == Routes.user_settings_path(conn, :edit) |       assert redirected_to(conn) == Routes.user_settings_path(conn, :edit) | ||||||
|  |       assert get_flash(conn, :error) =~ "Email change link is invalid or it has expired" | ||||||
|       assert get_flash(conn, :error) =~ |  | ||||||
|                dgettext("errors", "Email change link is invalid or it has expired") |  | ||||||
|     end |     end | ||||||
|  |  | ||||||
|     test "does not update email with invalid token", %{conn: conn, current_user: current_user} do |     test "does not update email with invalid token", %{conn: conn, current_user: current_user} do | ||||||
|       conn = get(conn, Routes.user_settings_path(conn, :confirm_email, "oops")) |       conn = get(conn, Routes.user_settings_path(conn, :confirm_email, "oops")) | ||||||
|       assert redirected_to(conn) == Routes.user_settings_path(conn, :edit) |       assert redirected_to(conn) == Routes.user_settings_path(conn, :edit) | ||||||
|  |       assert get_flash(conn, :error) =~ "Email change link is invalid or it has expired" | ||||||
|       assert get_flash(conn, :error) =~ |  | ||||||
|                dgettext("errors", "Email change link is invalid or it has expired") |  | ||||||
|  |  | ||||||
|       assert Accounts.get_user_by_email(current_user.email) |       assert Accounts.get_user_by_email(current_user.email) | ||||||
|     end |     end | ||||||
|  |  | ||||||
|   | |||||||
| @@ -5,43 +5,40 @@ defmodule CanneryWeb.AmmoGroupLiveTest do | |||||||
|  |  | ||||||
|   use CanneryWeb.ConnCase |   use CanneryWeb.ConnCase | ||||||
|   import Phoenix.LiveViewTest |   import Phoenix.LiveViewTest | ||||||
|   import CanneryWeb.Gettext |  | ||||||
|   alias Cannery.{Ammo, Repo} |   alias Cannery.{Ammo, Repo} | ||||||
|  |  | ||||||
|   @moduletag :ammo_group_live_test |   @moduletag :ammo_group_live_test | ||||||
|   @shot_group_create_attrs %{"ammo_left" => 5, "notes" => "some notes"} |   @create_attrs %{count: 42, notes: "some notes", price_paid: 120.5} | ||||||
|   @shot_group_update_attrs %{ |   @update_attrs %{count: 43, notes: "some updated notes", price_paid: 456.7} | ||||||
|     "count" => 5, |   @invalid_attrs %{count: nil, notes: nil, price_paid: nil} | ||||||
|     "date" => ~N[2022-02-13 03:17:00], |  | ||||||
|     "notes" => "some updated notes" |  | ||||||
|   } |  | ||||||
|   @create_attrs %{"count" => 42, "notes" => "some notes", "price_paid" => 120.5} |  | ||||||
|   @update_attrs %{"count" => 43, "notes" => "some updated notes", "price_paid" => 456.7} |  | ||||||
|   @ammo_group_create_limit 10_000 |   @ammo_group_create_limit 10_000 | ||||||
|  |   @shot_group_create_attrs %{ammo_left: 5, notes: "some notes"} | ||||||
|  |   @shot_group_update_attrs %{ | ||||||
|  |     count: 5, | ||||||
|  |     date: ~N[2022-02-13 03:17:00], | ||||||
|  |     notes: "some updated notes" | ||||||
|  |   } | ||||||
|  |   @shot_group_invalid_attrs %{ammo_left: nil, count: nil, notes: nil} | ||||||
|   @empty_attrs %{ |   @empty_attrs %{ | ||||||
|     "price_paid" => 50, |     price_paid: 50, | ||||||
|     "count" => 20 |     count: 20 | ||||||
|   } |   } | ||||||
|   @shot_group_attrs %{ |   @shot_group_attrs %{ | ||||||
|     "price_paid" => 50, |     price_paid: 50, | ||||||
|     "count" => 20 |     count: 20 | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   # @invalid_attrs %{count: -1, notes: nil, price_paid: nil} |  | ||||||
|  |  | ||||||
|   defp create_ammo_group(%{current_user: current_user}) do |   defp create_ammo_group(%{current_user: current_user}) do | ||||||
|     ammo_type = ammo_type_fixture(current_user) |     ammo_type = ammo_type_fixture(current_user) | ||||||
|     container = container_fixture(current_user) |     container = container_fixture(current_user) | ||||||
|     {1, [ammo_group]} = ammo_group_fixture(@create_attrs, ammo_type, container, current_user) |     {1, [ammo_group]} = ammo_group_fixture(@create_attrs, ammo_type, container, current_user) | ||||||
|  |     [ammo_type: ammo_type, ammo_group: ammo_group, container: container] | ||||||
|     %{ammo_type: ammo_type, ammo_group: ammo_group, container: container} |  | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   defp create_shot_group(%{current_user: current_user, ammo_group: ammo_group}) do |   defp create_shot_group(%{current_user: current_user, ammo_group: ammo_group}) do | ||||||
|     shot_group = shot_group_fixture(@shot_group_update_attrs, current_user, ammo_group) |     shot_group = shot_group_fixture(@shot_group_update_attrs, current_user, ammo_group) | ||||||
|     ammo_group = ammo_group |> Repo.reload!() |     ammo_group = ammo_group |> Repo.reload!() | ||||||
|  |     [ammo_group: ammo_group, shot_group: shot_group] | ||||||
|     %{ammo_group: ammo_group, shot_group: shot_group} |  | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   defp create_empty_ammo_group(%{ |   defp create_empty_ammo_group(%{ | ||||||
| @@ -52,7 +49,7 @@ defmodule CanneryWeb.AmmoGroupLiveTest do | |||||||
|     {1, [ammo_group]} = ammo_group_fixture(@empty_attrs, ammo_type, container, current_user) |     {1, [ammo_group]} = ammo_group_fixture(@empty_attrs, ammo_type, container, current_user) | ||||||
|     shot_group = shot_group_fixture(@shot_group_attrs, current_user, ammo_group) |     shot_group = shot_group_fixture(@shot_group_attrs, current_user, ammo_group) | ||||||
|     ammo_group = ammo_group |> Repo.reload!() |     ammo_group = ammo_group |> Repo.reload!() | ||||||
|     %{empty_ammo_group: ammo_group, shot_group: shot_group} |     [empty_ammo_group: ammo_group, shot_group: shot_group] | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   describe "Index of ammo group" do |   describe "Index of ammo group" do | ||||||
| @@ -60,19 +57,18 @@ defmodule CanneryWeb.AmmoGroupLiveTest do | |||||||
|  |  | ||||||
|     test "lists all ammo_groups", %{conn: conn, ammo_group: ammo_group} do |     test "lists all ammo_groups", %{conn: conn, ammo_group: ammo_group} do | ||||||
|       {:ok, _index_live, html} = live(conn, Routes.ammo_group_index_path(conn, :index)) |       {:ok, _index_live, html} = live(conn, Routes.ammo_group_index_path(conn, :index)) | ||||||
|  |  | ||||||
|       ammo_group = ammo_group |> Repo.preload(:ammo_type) |       ammo_group = ammo_group |> Repo.preload(:ammo_type) | ||||||
|       assert html =~ gettext("Ammo") |       assert html =~ "Ammo" | ||||||
|       assert html =~ ammo_group.ammo_type.name |       assert html =~ ammo_group.ammo_type.name | ||||||
|     end |     end | ||||||
|  |  | ||||||
|     test "can sort by type", |     test "can sort by type", | ||||||
|          %{conn: conn, container: container, current_user: current_user} do |          %{conn: conn, container: container, current_user: current_user} do | ||||||
|       rifle_type = ammo_type_fixture(%{"type" => "rifle"}, current_user) |       rifle_type = ammo_type_fixture(%{class: :rifle}, current_user) | ||||||
|       {1, [rifle_ammo_group]} = ammo_group_fixture(rifle_type, container, current_user) |       {1, [rifle_ammo_group]} = ammo_group_fixture(rifle_type, container, current_user) | ||||||
|       shotgun_type = ammo_type_fixture(%{"type" => "shotgun"}, current_user) |       shotgun_type = ammo_type_fixture(%{class: :shotgun}, current_user) | ||||||
|       {1, [shotgun_ammo_group]} = ammo_group_fixture(shotgun_type, container, current_user) |       {1, [shotgun_ammo_group]} = ammo_group_fixture(shotgun_type, container, current_user) | ||||||
|       pistol_type = ammo_type_fixture(%{"type" => "pistol"}, current_user) |       pistol_type = ammo_type_fixture(%{class: :pistol}, current_user) | ||||||
|       {1, [pistol_ammo_group]} = ammo_group_fixture(pistol_type, container, current_user) |       {1, [pistol_ammo_group]} = ammo_group_fixture(pistol_type, container, current_user) | ||||||
|  |  | ||||||
|       {:ok, index_live, html} = live(conn, Routes.ammo_group_index_path(conn, :index)) |       {:ok, index_live, html} = live(conn, Routes.ammo_group_index_path(conn, :index)) | ||||||
| @@ -85,8 +81,8 @@ defmodule CanneryWeb.AmmoGroupLiveTest do | |||||||
|  |  | ||||||
|       html = |       html = | ||||||
|         index_live |         index_live | ||||||
|         |> form(~s/form[phx-change="change_type"]/) |         |> form(~s/form[phx-change="change_class"]/) | ||||||
|         |> render_change(ammo_type: %{type: :rifle}) |         |> render_change(ammo_type: %{class: :rifle}) | ||||||
|  |  | ||||||
|       assert html =~ rifle_ammo_group.ammo_type.name |       assert html =~ rifle_ammo_group.ammo_type.name | ||||||
|       refute html =~ shotgun_ammo_group.ammo_type.name |       refute html =~ shotgun_ammo_group.ammo_type.name | ||||||
| @@ -94,8 +90,8 @@ defmodule CanneryWeb.AmmoGroupLiveTest do | |||||||
|  |  | ||||||
|       html = |       html = | ||||||
|         index_live |         index_live | ||||||
|         |> form(~s/form[phx-change="change_type"]/) |         |> form(~s/form[phx-change="change_class"]/) | ||||||
|         |> render_change(ammo_type: %{type: :shotgun}) |         |> render_change(ammo_type: %{class: :shotgun}) | ||||||
|  |  | ||||||
|       refute html =~ rifle_ammo_group.ammo_type.name |       refute html =~ rifle_ammo_group.ammo_type.name | ||||||
|       assert html =~ shotgun_ammo_group.ammo_type.name |       assert html =~ shotgun_ammo_group.ammo_type.name | ||||||
| @@ -103,8 +99,8 @@ defmodule CanneryWeb.AmmoGroupLiveTest do | |||||||
|  |  | ||||||
|       html = |       html = | ||||||
|         index_live |         index_live | ||||||
|         |> form(~s/form[phx-change="change_type"]/) |         |> form(~s/form[phx-change="change_class"]/) | ||||||
|         |> render_change(ammo_type: %{type: :pistol}) |         |> render_change(ammo_type: %{class: :pistol}) | ||||||
|  |  | ||||||
|       refute html =~ rifle_ammo_group.ammo_type.name |       refute html =~ rifle_ammo_group.ammo_type.name | ||||||
|       refute html =~ shotgun_ammo_group.ammo_type.name |       refute html =~ shotgun_ammo_group.ammo_type.name | ||||||
| @@ -112,8 +108,8 @@ defmodule CanneryWeb.AmmoGroupLiveTest do | |||||||
|  |  | ||||||
|       html = |       html = | ||||||
|         index_live |         index_live | ||||||
|         |> form(~s/form[phx-change="change_type"]/) |         |> form(~s/form[phx-change="change_class"]/) | ||||||
|         |> render_change(ammo_type: %{type: :all}) |         |> render_change(ammo_type: %{class: :all}) | ||||||
|  |  | ||||||
|       assert html =~ rifle_ammo_group.ammo_type.name |       assert html =~ rifle_ammo_group.ammo_type.name | ||||||
|       assert html =~ shotgun_ammo_group.ammo_type.name |       assert html =~ shotgun_ammo_group.ammo_type.name | ||||||
| @@ -128,10 +124,9 @@ defmodule CanneryWeb.AmmoGroupLiveTest do | |||||||
|       assert html =~ ammo_group.ammo_type.name |       assert html =~ ammo_group.ammo_type.name | ||||||
|  |  | ||||||
|       assert index_live |       assert index_live | ||||||
|              |> form(~s/form[phx-change="search"]/, |              |> form(~s/form[phx-change="search"]/) | ||||||
|                search: %{search_term: ammo_group.ammo_type.name} |              |> render_change(search: %{search_term: ammo_group.ammo_type.name}) =~ | ||||||
|              ) |                ammo_group.ammo_type.name | ||||||
|              |> render_change() =~ ammo_group.ammo_type.name |  | ||||||
|  |  | ||||||
|       assert_patch( |       assert_patch( | ||||||
|         index_live, |         index_live, | ||||||
| @@ -139,14 +134,15 @@ defmodule CanneryWeb.AmmoGroupLiveTest do | |||||||
|       ) |       ) | ||||||
|  |  | ||||||
|       refute index_live |       refute index_live | ||||||
|              |> form(~s/form[phx-change="search"]/, search: %{search_term: "something_else"}) |              |> form(~s/form[phx-change="search"]/) | ||||||
|              |> render_change() =~ ammo_group.ammo_type.name |              |> render_change(search: %{search_term: "something_else"}) =~ | ||||||
|  |                ammo_group.ammo_type.name | ||||||
|  |  | ||||||
|       assert_patch(index_live, Routes.ammo_group_index_path(conn, :search, "something_else")) |       assert_patch(index_live, Routes.ammo_group_index_path(conn, :search, "something_else")) | ||||||
|  |  | ||||||
|       assert index_live |       assert index_live | ||||||
|              |> form(~s/form[phx-change="search"]/, search: %{search_term: ""}) |              |> form(~s/form[phx-change="search"]/) | ||||||
|              |> render_change() =~ ammo_group.ammo_type.name |              |> render_change(search: %{search_term: ""}) =~ ammo_group.ammo_type.name | ||||||
|  |  | ||||||
|       assert_patch(index_live, Routes.ammo_group_index_path(conn, :index)) |       assert_patch(index_live, Routes.ammo_group_index_path(conn, :index)) | ||||||
|     end |     end | ||||||
| @@ -154,85 +150,65 @@ defmodule CanneryWeb.AmmoGroupLiveTest do | |||||||
|     test "saves a single new ammo_group", %{conn: conn} do |     test "saves a single new ammo_group", %{conn: conn} do | ||||||
|       {:ok, index_live, _html} = live(conn, Routes.ammo_group_index_path(conn, :index)) |       {:ok, index_live, _html} = live(conn, Routes.ammo_group_index_path(conn, :index)) | ||||||
|  |  | ||||||
|       assert index_live |> element("a", dgettext("actions", "Add Ammo")) |> render_click() =~ |       assert index_live |> element("a", "Add Ammo") |> render_click() =~ "Add Ammo" | ||||||
|                dgettext("actions", "Add Ammo") |  | ||||||
|  |  | ||||||
|       assert_patch(index_live, Routes.ammo_group_index_path(conn, :new)) |       assert_patch(index_live, Routes.ammo_group_index_path(conn, :new)) | ||||||
|  |  | ||||||
|       # assert index_live |       assert index_live | ||||||
|       #        |> form("#ammo_group-form", ammo_group: @invalid_attrs) |              |> form("#ammo_group-form") | ||||||
|       #        |> render_change() =~ dgettext("errors", "can't be blank") |              |> render_change(ammo_group: @invalid_attrs) =~ "can't be blank" | ||||||
|  |  | ||||||
|       {:ok, _view, html} = |       {:ok, _view, html} = | ||||||
|         index_live |         index_live | ||||||
|         |> form("#ammo_group-form", ammo_group: @create_attrs) |         |> form("#ammo_group-form") | ||||||
|         |> render_submit() |         |> render_submit(ammo_group: @create_attrs) | ||||||
|         |> follow_redirect(conn, Routes.ammo_group_index_path(conn, :index)) |         |> follow_redirect(conn, Routes.ammo_group_index_path(conn, :index)) | ||||||
|  |  | ||||||
|       assert html =~ dgettext("prompts", "Ammo added successfully") |       assert html =~ "Ammo added successfully" | ||||||
|       assert html =~ "\n42\n" |       assert html =~ "\n42\n" | ||||||
|     end |     end | ||||||
|  |  | ||||||
|     test "saves multiple new ammo_groups", %{conn: conn, current_user: current_user} do |     test "saves multiple new ammo_groups", %{conn: conn, current_user: current_user} do | ||||||
|       multiplier = 25 |       multiplier = 25 | ||||||
|  |  | ||||||
|       {:ok, index_live, _html} = live(conn, Routes.ammo_group_index_path(conn, :index)) |       {:ok, index_live, _html} = live(conn, Routes.ammo_group_index_path(conn, :index)) | ||||||
|  |  | ||||||
|       assert index_live |> element("a", dgettext("actions", "Add Ammo")) |> render_click() =~ |       assert index_live |> element("a", "Add Ammo") |> render_click() =~ "Add Ammo" | ||||||
|                dgettext("actions", "Add Ammo") |  | ||||||
|  |  | ||||||
|       assert_patch(index_live, Routes.ammo_group_index_path(conn, :new)) |       assert_patch(index_live, Routes.ammo_group_index_path(conn, :new)) | ||||||
|  |  | ||||||
|       # assert index_live |       assert index_live | ||||||
|       #        |> form("#ammo_group-form", ammo_group: @invalid_attrs) |              |> form("#ammo_group-form") | ||||||
|       #        |> render_change() =~ dgettext("errors", "can't be blank") |              |> render_change(ammo_group: @invalid_attrs) =~ "can't be blank" | ||||||
|  |  | ||||||
|       {:ok, _view, html} = |       {:ok, _view, html} = | ||||||
|         index_live |         index_live | ||||||
|         |> form("#ammo_group-form", |         |> form("#ammo_group-form") | ||||||
|           ammo_group: @create_attrs |> Map.put("multiplier", to_string(multiplier)) |         |> render_submit(ammo_group: @create_attrs |> Map.put(:multiplier, multiplier)) | ||||||
|         ) |  | ||||||
|         |> render_submit() |  | ||||||
|         |> follow_redirect(conn, Routes.ammo_group_index_path(conn, :index)) |         |> follow_redirect(conn, Routes.ammo_group_index_path(conn, :index)) | ||||||
|  |  | ||||||
|       assert html =~ dgettext("prompts", "Ammo added successfully") |       assert html =~ "Ammo added successfully" | ||||||
|       assert Ammo.list_ammo_groups(nil, :all, current_user) |> Enum.count() == multiplier + 1 |       assert Ammo.list_ammo_groups(nil, :all, current_user) |> Enum.count() == multiplier + 1 | ||||||
|     end |     end | ||||||
|  |  | ||||||
|     test "does not save invalid number of new ammo_groups", %{conn: conn} do |     test "does not save invalid number of new ammo_groups", %{conn: conn} do | ||||||
|       {:ok, index_live, _html} = live(conn, Routes.ammo_group_index_path(conn, :index)) |       {:ok, index_live, _html} = live(conn, Routes.ammo_group_index_path(conn, :index)) | ||||||
|  |  | ||||||
|       assert index_live |> element("a", dgettext("actions", "Add Ammo")) |> render_click() =~ |       assert index_live |> element("a", "Add Ammo") |> render_click() =~ "Add Ammo" | ||||||
|                dgettext("actions", "Add Ammo") |  | ||||||
|  |  | ||||||
|       assert_patch(index_live, Routes.ammo_group_index_path(conn, :new)) |       assert_patch(index_live, Routes.ammo_group_index_path(conn, :new)) | ||||||
|  |  | ||||||
|       # assert index_live |       assert index_live | ||||||
|       #        |> form("#ammo_group-form", ammo_group: @invalid_attrs) |              |> form("#ammo_group-form") | ||||||
|       #        |> render_change() =~ dgettext("errors", "can't be blank") |              |> render_change(ammo_group: @invalid_attrs) =~ "can't be blank" | ||||||
|  |  | ||||||
|       assert index_live |       assert index_live | ||||||
|              |> form("#ammo_group-form", ammo_group: @create_attrs |> Map.put("multiplier", "0")) |              |> form("#ammo_group-form") | ||||||
|              |> render_submit() =~ |              |> render_submit(ammo_group: @create_attrs |> Map.put(:multiplier, "0")) =~ | ||||||
|                dgettext( |                "Invalid number of copies, must be between 1 and #{@ammo_group_create_limit}. Was 0" | ||||||
|                  "errors", |  | ||||||
|                  "Invalid number of copies, must be between 1 and %{max}. Was %{multiplier}", |  | ||||||
|                  multiplier: 0, |  | ||||||
|                  max: @ammo_group_create_limit |  | ||||||
|                ) |  | ||||||
|  |  | ||||||
|       assert index_live |       assert index_live | ||||||
|              |> form("#ammo_group-form", |              |> form("#ammo_group-form") | ||||||
|                ammo_group: |              |> render_submit( | ||||||
|                  @create_attrs |> Map.put("multiplier", to_string(@ammo_group_create_limit + 1)) |                ammo_group: @create_attrs |> Map.put(:multiplier, @ammo_group_create_limit + 1) | ||||||
|              ) |              ) =~ | ||||||
|              |> render_submit() =~ |                "Invalid number of copies, must be between 1 and #{@ammo_group_create_limit}. Was #{@ammo_group_create_limit + 1}" | ||||||
|                dgettext( |  | ||||||
|                  "errors", |  | ||||||
|                  "Invalid number of copies, must be between 1 and %{max}. Was %{multiplier}", |  | ||||||
|                  multiplier: @ammo_group_create_limit + 1, |  | ||||||
|                  max: @ammo_group_create_limit |  | ||||||
|                ) |  | ||||||
|     end |     end | ||||||
|  |  | ||||||
|     test "updates ammo_group in listing", %{conn: conn, ammo_group: ammo_group} do |     test "updates ammo_group in listing", %{conn: conn, ammo_group: ammo_group} do | ||||||
| @@ -240,22 +216,21 @@ defmodule CanneryWeb.AmmoGroupLiveTest do | |||||||
|  |  | ||||||
|       assert index_live |       assert index_live | ||||||
|              |> element(~s/a[aria-label="Edit ammo group of #{ammo_group.count} bullets"]/) |              |> element(~s/a[aria-label="Edit ammo group of #{ammo_group.count} bullets"]/) | ||||||
|              |> render_click() =~ |              |> render_click() =~ "Edit ammo" | ||||||
|                gettext("Edit ammo") |  | ||||||
|  |  | ||||||
|       assert_patch(index_live, Routes.ammo_group_index_path(conn, :edit, ammo_group)) |       assert_patch(index_live, Routes.ammo_group_index_path(conn, :edit, ammo_group)) | ||||||
|  |  | ||||||
|       # assert index_live |       assert index_live | ||||||
|       #        |> form("#ammo_group-form", ammo_group: @invalid_attrs) |              |> form("#ammo_group-form") | ||||||
|       #        |> render_change() =~ dgettext("errors", "can't be blank") |              |> render_change(ammo_group: @invalid_attrs) =~ "can't be blank" | ||||||
|  |  | ||||||
|       {:ok, _view, html} = |       {:ok, _view, html} = | ||||||
|         index_live |         index_live | ||||||
|         |> form("#ammo_group-form", ammo_group: @update_attrs) |         |> form("#ammo_group-form") | ||||||
|         |> render_submit() |         |> render_submit(ammo_group: @update_attrs) | ||||||
|         |> follow_redirect(conn, Routes.ammo_group_index_path(conn, :index)) |         |> follow_redirect(conn, Routes.ammo_group_index_path(conn, :index)) | ||||||
|  |  | ||||||
|       assert html =~ dgettext("prompts", "Ammo updated successfully") |       assert html =~ "Ammo updated successfully" | ||||||
|       assert html =~ "\n43\n" |       assert html =~ "\n43\n" | ||||||
|     end |     end | ||||||
|  |  | ||||||
| @@ -267,24 +242,38 @@ defmodule CanneryWeb.AmmoGroupLiveTest do | |||||||
|         |> element(~s/a[aria-label="Clone ammo group of #{ammo_group.count} bullets"]/) |         |> element(~s/a[aria-label="Clone ammo group of #{ammo_group.count} bullets"]/) | ||||||
|         |> render_click() |         |> render_click() | ||||||
|  |  | ||||||
|       assert html =~ dgettext("actions", "Add Ammo") |       assert html =~ "Add Ammo" | ||||||
|       assert html =~ gettext("$%{amount}", amount: display_currency(120.5)) |       assert html =~ "$#{display_currency(120.5)}" | ||||||
|  |  | ||||||
|       assert_patch(index_live, Routes.ammo_group_index_path(conn, :clone, ammo_group)) |       assert_patch(index_live, Routes.ammo_group_index_path(conn, :clone, ammo_group)) | ||||||
|  |  | ||||||
|       # assert index_live |       {:ok, _index_live, html} = | ||||||
|       #        |> form("#ammo_group-form", ammo_group: @invalid_attrs) |  | ||||||
|       #        |> render_change() =~ dgettext("errors", "can't be blank") |  | ||||||
|  |  | ||||||
|       {:ok, _view, html} = |  | ||||||
|         index_live |         index_live | ||||||
|         |> form("#ammo_group-form") |         |> form("#ammo_group-form") | ||||||
|         |> render_submit() |         |> render_submit() | ||||||
|         |> follow_redirect(conn, Routes.ammo_group_index_path(conn, :index)) |         |> follow_redirect(conn, Routes.ammo_group_index_path(conn, :index)) | ||||||
|  |  | ||||||
|       assert html =~ dgettext("prompts", "Ammo added successfully") |       assert html =~ "Ammo added successfully" | ||||||
|       assert html =~ "\n42\n" |       assert html =~ "\n42\n" | ||||||
|       assert html =~ gettext("$%{amount}", amount: display_currency(120.5)) |       assert html =~ "$#{display_currency(120.5)}" | ||||||
|  |     end | ||||||
|  |  | ||||||
|  |     test "checks validity when cloning", %{conn: conn, ammo_group: ammo_group} do | ||||||
|  |       {:ok, index_live, _html} = live(conn, Routes.ammo_group_index_path(conn, :index)) | ||||||
|  |  | ||||||
|  |       html = | ||||||
|  |         index_live | ||||||
|  |         |> element(~s/a[aria-label="Clone ammo group of #{ammo_group.count} bullets"]/) | ||||||
|  |         |> render_click() | ||||||
|  |  | ||||||
|  |       assert html =~ "Add Ammo" | ||||||
|  |       assert html =~ "$#{display_currency(120.5)}" | ||||||
|  |  | ||||||
|  |       assert_patch(index_live, Routes.ammo_group_index_path(conn, :clone, ammo_group)) | ||||||
|  |  | ||||||
|  |       assert index_live | ||||||
|  |              |> form("#ammo_group-form") | ||||||
|  |              |> render_change(ammo_group: @invalid_attrs) =~ "can't be blank" | ||||||
|     end |     end | ||||||
|  |  | ||||||
|     test "clones ammo_group in listing with updates", %{conn: conn, ammo_group: ammo_group} do |     test "clones ammo_group in listing with updates", %{conn: conn, ammo_group: ammo_group} do | ||||||
| @@ -295,24 +284,23 @@ defmodule CanneryWeb.AmmoGroupLiveTest do | |||||||
|         |> element(~s/a[aria-label="Clone ammo group of #{ammo_group.count} bullets"]/) |         |> element(~s/a[aria-label="Clone ammo group of #{ammo_group.count} bullets"]/) | ||||||
|         |> render_click() |         |> render_click() | ||||||
|  |  | ||||||
|       assert html =~ dgettext("actions", "Add Ammo") |       assert html =~ "Add Ammo" | ||||||
|       assert html =~ gettext("$%{amount}", amount: display_currency(120.5)) |       assert html =~ "$#{display_currency(120.5)}" | ||||||
|  |  | ||||||
|       assert_patch(index_live, Routes.ammo_group_index_path(conn, :clone, ammo_group)) |       assert_patch(index_live, Routes.ammo_group_index_path(conn, :clone, ammo_group)) | ||||||
|  |  | ||||||
|       # assert index_live |       assert index_live | ||||||
|       #        |> form("#ammo_group-form", ammo_group: @invalid_attrs) |              |> form("#ammo_group-form") | ||||||
|       #        |> render_change() =~ dgettext("errors", "can't be blank") |              |> render_change(ammo_group: @invalid_attrs) =~ "can't be blank" | ||||||
|  |  | ||||||
|       {:ok, _view, html} = |       {:ok, _view, html} = | ||||||
|         index_live |         index_live | ||||||
|         |> form("#ammo_group-form", ammo_group: Map.merge(@create_attrs, %{"count" => 43})) |         |> form("#ammo_group-form") | ||||||
|         |> render_submit() |         |> render_submit(ammo_group: @create_attrs |> Map.put(:count, 43)) | ||||||
|         |> follow_redirect(conn, Routes.ammo_group_index_path(conn, :index)) |         |> follow_redirect(conn, Routes.ammo_group_index_path(conn, :index)) | ||||||
|  |  | ||||||
|       assert html =~ dgettext("prompts", "Ammo added successfully") |       assert html =~ "Ammo added successfully" | ||||||
|       assert html =~ "\n43\n" |       assert html =~ "\n43\n" | ||||||
|       assert html =~ gettext("$%{amount}", amount: display_currency(120.5)) |       assert html =~ "$#{display_currency(120.5)}" | ||||||
|     end |     end | ||||||
|  |  | ||||||
|     test "deletes ammo_group in listing", %{conn: conn, ammo_group: ammo_group} do |     test "deletes ammo_group in listing", %{conn: conn, ammo_group: ammo_group} do | ||||||
| @@ -328,22 +316,20 @@ defmodule CanneryWeb.AmmoGroupLiveTest do | |||||||
|     test "saves new shot_group", %{conn: conn, ammo_group: ammo_group} do |     test "saves new shot_group", %{conn: conn, ammo_group: ammo_group} do | ||||||
|       {:ok, index_live, _html} = live(conn, Routes.ammo_group_index_path(conn, :index)) |       {:ok, index_live, _html} = live(conn, Routes.ammo_group_index_path(conn, :index)) | ||||||
|  |  | ||||||
|       assert index_live |> element("a", dgettext("actions", "Record shots")) |> render_click() =~ |       assert index_live |> element("a", "Record shots") |> render_click() =~ "Record shots" | ||||||
|                gettext("Record shots") |  | ||||||
|  |  | ||||||
|       assert_patch(index_live, Routes.ammo_group_index_path(conn, :add_shot_group, ammo_group)) |       assert_patch(index_live, Routes.ammo_group_index_path(conn, :add_shot_group, ammo_group)) | ||||||
|  |  | ||||||
|       # assert index_live |       assert index_live | ||||||
|       #        |> form("#shot_group-form", shot_group: @invalid_attrs) |              |> form("#shot-group-form") | ||||||
|       #        |> render_change() =~ dgettext("errors", "is invalid") |              |> render_change(shot_group: @shot_group_invalid_attrs) =~ "can't be blank" | ||||||
|  |  | ||||||
|       {:ok, _view, html} = |       {:ok, _view, html} = | ||||||
|         index_live |         index_live | ||||||
|         |> form("#shot-group-form", shot_group: @shot_group_create_attrs) |         |> form("#shot-group-form") | ||||||
|         |> render_submit() |         |> render_submit(shot_group: @shot_group_create_attrs) | ||||||
|         |> follow_redirect(conn, Routes.ammo_group_index_path(conn, :index)) |         |> follow_redirect(conn, Routes.ammo_group_index_path(conn, :index)) | ||||||
|  |  | ||||||
|       assert html =~ dgettext("prompts", "Shots recorded successfully") |       assert html =~ "Shots recorded successfully" | ||||||
|     end |     end | ||||||
|  |  | ||||||
|     @spec display_currency(float()) :: String.t() |     @spec display_currency(float()) :: String.t() | ||||||
| @@ -360,21 +346,20 @@ defmodule CanneryWeb.AmmoGroupLiveTest do | |||||||
|     } do |     } do | ||||||
|       {:ok, show_live, html} = live(conn, Routes.ammo_group_index_path(conn, :index)) |       {:ok, show_live, html} = live(conn, Routes.ammo_group_index_path(conn, :index)) | ||||||
|  |  | ||||||
|       assert html =~ dgettext("actions", "Show used") |       assert html =~ "Show used" | ||||||
|       refute html =~ gettext("$%{amount}", amount: display_currency(50.00)) |       refute html =~ "$#{display_currency(50.00)}" | ||||||
|  |  | ||||||
|       percentage = ammo_group |> Ammo.get_percentage_remaining(current_user) |       percentage = ammo_group |> Ammo.get_percentage_remaining(current_user) | ||||||
|       refute html =~ "\n#{gettext("%{percentage}%", percentage: percentage)}\n" |       refute html =~ "\n#{"#{percentage}%"}\n" | ||||||
|  |  | ||||||
|       html = |       html = | ||||||
|         show_live |         show_live | ||||||
|         |> element(~s/input[type="checkbox"][aria-labelledby="toggle_show_used-label"}]/) |         |> element(~s/input[type="checkbox"][aria-labelledby="toggle_show_used-label"}]/) | ||||||
|         |> render_click() |         |> render_click() | ||||||
|  |  | ||||||
|       assert html =~ gettext("$%{amount}", amount: display_currency(50.00)) |       assert html =~ "$#{display_currency(50.00)}" | ||||||
|  |  | ||||||
|       percentage = ammo_group |> Ammo.get_percentage_remaining(current_user) |       percentage = ammo_group |> Ammo.get_percentage_remaining(current_user) | ||||||
|       assert html =~ "\n#{gettext("%{percentage}%", percentage: percentage)}\n" |       assert html =~ "\n#{"#{percentage}%"}\n" | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
|  |  | ||||||
| @@ -383,9 +368,8 @@ defmodule CanneryWeb.AmmoGroupLiveTest do | |||||||
|  |  | ||||||
|     test "displays ammo_group", %{conn: conn, ammo_group: ammo_group} do |     test "displays ammo_group", %{conn: conn, ammo_group: ammo_group} do | ||||||
|       {:ok, _show_live, html} = live(conn, Routes.ammo_group_show_path(conn, :show, ammo_group)) |       {:ok, _show_live, html} = live(conn, Routes.ammo_group_show_path(conn, :show, ammo_group)) | ||||||
|  |  | ||||||
|       ammo_group = ammo_group |> Repo.preload(:ammo_type) |       ammo_group = ammo_group |> Repo.preload(:ammo_type) | ||||||
|       assert html =~ gettext("Show Ammo") |       assert html =~ "Show Ammo" | ||||||
|       assert html =~ ammo_group.ammo_type.name |       assert html =~ ammo_group.ammo_type.name | ||||||
|     end |     end | ||||||
|  |  | ||||||
| @@ -394,44 +378,41 @@ defmodule CanneryWeb.AmmoGroupLiveTest do | |||||||
|  |  | ||||||
|       assert show_live |       assert show_live | ||||||
|              |> element(~s/a[aria-label="Edit ammo group of #{ammo_group.count} bullets"]/) |              |> element(~s/a[aria-label="Edit ammo group of #{ammo_group.count} bullets"]/) | ||||||
|              |> render_click() =~ |              |> render_click() =~ "Edit Ammo" | ||||||
|                gettext("Edit Ammo") |  | ||||||
|  |  | ||||||
|       assert_patch(show_live, Routes.ammo_group_show_path(conn, :edit, ammo_group)) |       assert_patch(show_live, Routes.ammo_group_show_path(conn, :edit, ammo_group)) | ||||||
|  |  | ||||||
|       # assert show_live |       assert show_live | ||||||
|       #        |> form("#ammo_group-form", ammo_group: @invalid_attrs) |              |> form("#ammo_group-form") | ||||||
|       #        |> render_change() =~ dgettext("errors", "can't be blank") |              |> render_change(ammo_group: @invalid_attrs) =~ "can't be blank" | ||||||
|  |  | ||||||
|       {:ok, _view, html} = |       {:ok, _view, html} = | ||||||
|         show_live |         show_live | ||||||
|         |> form("#ammo_group-form", ammo_group: @update_attrs) |         |> form("#ammo_group-form") | ||||||
|         |> render_submit() |         |> render_submit(ammo_group: @update_attrs) | ||||||
|         |> follow_redirect(conn, Routes.ammo_group_show_path(conn, :show, ammo_group)) |         |> follow_redirect(conn, Routes.ammo_group_show_path(conn, :show, ammo_group)) | ||||||
|  |  | ||||||
|       assert html =~ dgettext("prompts", "Ammo updated successfully") |       assert html =~ "Ammo updated successfully" | ||||||
|       assert html =~ "some updated notes" |       assert html =~ "some updated notes" | ||||||
|     end |     end | ||||||
|  |  | ||||||
|     test "saves new shot_group", %{conn: conn, ammo_group: ammo_group} do |     test "saves new shot_group", %{conn: conn, ammo_group: ammo_group} do | ||||||
|       {:ok, index_live, _html} = live(conn, Routes.ammo_group_show_path(conn, :show, ammo_group)) |       {:ok, index_live, _html} = live(conn, Routes.ammo_group_show_path(conn, :show, ammo_group)) | ||||||
|  |  | ||||||
|       assert index_live |> element("a", dgettext("actions", "Record shots")) |> render_click() =~ |       assert index_live |> element("a", "Record shots") |> render_click() =~ "Record shots" | ||||||
|                gettext("Record shots") |  | ||||||
|  |  | ||||||
|       assert_patch(index_live, Routes.ammo_group_show_path(conn, :add_shot_group, ammo_group)) |       assert_patch(index_live, Routes.ammo_group_show_path(conn, :add_shot_group, ammo_group)) | ||||||
|  |  | ||||||
|       # assert index_live |       assert index_live | ||||||
|       #        |> form("#shot_group-form", shot_group: @invalid_attrs) |              |> form("#shot-group-form") | ||||||
|       #        |> render_change() =~ dgettext("errors", "is invalid") |              |> render_change(shot_group: @shot_group_invalid_attrs) =~ "can't be blank" | ||||||
|  |  | ||||||
|       {:ok, _view, html} = |       {:ok, _view, html} = | ||||||
|         index_live |         index_live | ||||||
|         |> form("#shot-group-form", shot_group: @shot_group_create_attrs) |         |> form("#shot-group-form") | ||||||
|         |> render_submit() |         |> render_submit(shot_group: @shot_group_create_attrs) | ||||||
|         |> follow_redirect(conn, Routes.ammo_group_show_path(conn, :show, ammo_group)) |         |> follow_redirect(conn, Routes.ammo_group_show_path(conn, :show, ammo_group)) | ||||||
|  |  | ||||||
|       assert html =~ dgettext("prompts", "Shots recorded successfully") |       assert html =~ "Shots recorded successfully" | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
|  |  | ||||||
| @@ -444,25 +425,24 @@ defmodule CanneryWeb.AmmoGroupLiveTest do | |||||||
|  |  | ||||||
|       assert index_live |       assert index_live | ||||||
|              |> element(~s/a[aria-label="Edit shot group of #{shot_group.count} shots"]/) |              |> element(~s/a[aria-label="Edit shot group of #{shot_group.count} shots"]/) | ||||||
|              |> render_click() =~ |              |> render_click() =~ "Edit Shot Records" | ||||||
|                gettext("Edit Shot Records") |  | ||||||
|  |  | ||||||
|       assert_patch( |       assert_patch( | ||||||
|         index_live, |         index_live, | ||||||
|         Routes.ammo_group_show_path(conn, :edit_shot_group, ammo_group, shot_group) |         Routes.ammo_group_show_path(conn, :edit_shot_group, ammo_group, shot_group) | ||||||
|       ) |       ) | ||||||
|  |  | ||||||
|       # assert index_live |       assert index_live | ||||||
|       #        |> form("#shot_group-form", shot_group: @invalid_attrs) |              |> form("#shot-group-form") | ||||||
|       #        |> render_change() =~ dgettext("errors", "is invalid") |              |> render_change(shot_group: @shot_group_invalid_attrs) =~ "can't be blank" | ||||||
|  |  | ||||||
|       {:ok, _view, html} = |       {:ok, _view, html} = | ||||||
|         index_live |         index_live | ||||||
|         |> form("#shot-group-form", shot_group: @shot_group_update_attrs) |         |> form("#shot-group-form") | ||||||
|         |> render_submit() |         |> render_submit(shot_group: @shot_group_update_attrs) | ||||||
|         |> follow_redirect(conn, Routes.ammo_group_show_path(conn, :show, ammo_group)) |         |> follow_redirect(conn, Routes.ammo_group_show_path(conn, :show, ammo_group)) | ||||||
|  |  | ||||||
|       assert html =~ dgettext("actions", "Shot records updated successfully") |       assert html =~ "Shot records updated successfully" | ||||||
|       assert html =~ "some updated notes" |       assert html =~ "some updated notes" | ||||||
|     end |     end | ||||||
|  |  | ||||||
|   | |||||||
| @@ -5,54 +5,51 @@ defmodule CanneryWeb.AmmoTypeLiveTest do | |||||||
|  |  | ||||||
|   use CanneryWeb.ConnCase |   use CanneryWeb.ConnCase | ||||||
|   import Phoenix.LiveViewTest |   import Phoenix.LiveViewTest | ||||||
|   import CanneryWeb.Gettext |  | ||||||
|   alias Cannery.{Ammo, Repo} |   alias Cannery.{Ammo, Repo} | ||||||
|  |  | ||||||
|   @moduletag :ammo_type_live_test |   @moduletag :ammo_type_live_test | ||||||
|  |  | ||||||
|   @create_attrs %{ |   @create_attrs %{ | ||||||
|     "bullet_type" => "some bullet_type", |     bullet_type: "some bullet_type", | ||||||
|     "case_material" => "some case_material", |     case_material: "some case_material", | ||||||
|     "desc" => "some desc", |     desc: "some desc", | ||||||
|     "manufacturer" => "some manufacturer", |     manufacturer: "some manufacturer", | ||||||
|     "name" => "some name", |     name: "some name", | ||||||
|     "grains" => 120 |     grains: 120 | ||||||
|   } |   } | ||||||
|   @update_attrs %{ |   @update_attrs %{ | ||||||
|     "bullet_type" => "some updated bullet_type", |     bullet_type: "some updated bullet_type", | ||||||
|     "case_material" => "some updated case_material", |     case_material: "some updated case_material", | ||||||
|     "desc" => "some updated desc", |     desc: "some updated desc", | ||||||
|     "manufacturer" => "some updated manufacturer", |     manufacturer: "some updated manufacturer", | ||||||
|     "name" => "some updated name", |     name: "some updated name", | ||||||
|     "grains" => 456 |     grains: 456 | ||||||
|  |   } | ||||||
|  |   @invalid_attrs %{ | ||||||
|  |     bullet_type: nil, | ||||||
|  |     case_material: nil, | ||||||
|  |     desc: nil, | ||||||
|  |     manufacturer: nil, | ||||||
|  |     name: nil, | ||||||
|  |     grains: nil | ||||||
|   } |   } | ||||||
|   @ammo_group_attrs %{ |   @ammo_group_attrs %{ | ||||||
|     "notes" => "some ammo group", |     notes: "some ammo group", | ||||||
|     "count" => 20 |     count: 20 | ||||||
|   } |   } | ||||||
|   @shot_group_attrs %{ |   @shot_group_attrs %{ | ||||||
|     "notes" => "some shot group", |     notes: "some shot group", | ||||||
|     "count" => 20 |     count: 20 | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   # @invalid_attrs %{ |  | ||||||
|   #   "bullet_type" => nil, |  | ||||||
|   #   "case_material" => nil, |  | ||||||
|   #   "desc" => nil, |  | ||||||
|   #   "manufacturer" => nil, |  | ||||||
|   #   "name" => nil, |  | ||||||
|   #   "grains" => nil |  | ||||||
|   # } |  | ||||||
|  |  | ||||||
|   defp create_ammo_type(%{current_user: current_user}) do |   defp create_ammo_type(%{current_user: current_user}) do | ||||||
|     %{ammo_type: ammo_type_fixture(@create_attrs, current_user)} |     [ammo_type: ammo_type_fixture(@create_attrs, current_user)] | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   defp create_ammo_group(%{ammo_type: ammo_type, current_user: current_user}) do |   defp create_ammo_group(%{ammo_type: ammo_type, current_user: current_user}) do | ||||||
|     container = container_fixture(current_user) |     container = container_fixture(current_user) | ||||||
|     {1, [ammo_group]} = ammo_group_fixture(@ammo_group_attrs, ammo_type, container, current_user) |     {1, [ammo_group]} = ammo_group_fixture(@ammo_group_attrs, ammo_type, container, current_user) | ||||||
|  |     [ammo_group: ammo_group, container: container] | ||||||
|     %{ammo_group: ammo_group, container: container} |  | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   defp create_empty_ammo_group(%{ammo_type: ammo_type, current_user: current_user}) do |   defp create_empty_ammo_group(%{ammo_type: ammo_type, current_user: current_user}) do | ||||||
| @@ -60,8 +57,7 @@ defmodule CanneryWeb.AmmoTypeLiveTest do | |||||||
|     {1, [ammo_group]} = ammo_group_fixture(@ammo_group_attrs, ammo_type, container, current_user) |     {1, [ammo_group]} = ammo_group_fixture(@ammo_group_attrs, ammo_type, container, current_user) | ||||||
|     shot_group = shot_group_fixture(@shot_group_attrs, current_user, ammo_group) |     shot_group = shot_group_fixture(@shot_group_attrs, current_user, ammo_group) | ||||||
|     ammo_group = ammo_group |> Repo.reload!() |     ammo_group = ammo_group |> Repo.reload!() | ||||||
|  |     [ammo_group: ammo_group, container: container, shot_group: shot_group] | ||||||
|     %{ammo_group: ammo_group, container: container, shot_group: shot_group} |  | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   describe "Index" do |   describe "Index" do | ||||||
| @@ -69,15 +65,14 @@ defmodule CanneryWeb.AmmoTypeLiveTest do | |||||||
|  |  | ||||||
|     test "lists all ammo_types", %{conn: conn, ammo_type: ammo_type} do |     test "lists all ammo_types", %{conn: conn, ammo_type: ammo_type} do | ||||||
|       {:ok, _index_live, html} = live(conn, Routes.ammo_type_index_path(conn, :index)) |       {:ok, _index_live, html} = live(conn, Routes.ammo_type_index_path(conn, :index)) | ||||||
|  |       assert html =~ "Catalog" | ||||||
|       assert html =~ gettext("Catalog") |  | ||||||
|       assert html =~ ammo_type.bullet_type |       assert html =~ ammo_type.bullet_type | ||||||
|     end |     end | ||||||
|  |  | ||||||
|     test "can sort by type", %{conn: conn, current_user: current_user} do |     test "can sort by class", %{conn: conn, current_user: current_user} do | ||||||
|       rifle_type = ammo_type_fixture(%{"type" => "rifle"}, current_user) |       rifle_type = ammo_type_fixture(%{class: :rifle}, current_user) | ||||||
|       shotgun_type = ammo_type_fixture(%{"type" => "shotgun"}, current_user) |       shotgun_type = ammo_type_fixture(%{class: :shotgun}, current_user) | ||||||
|       pistol_type = ammo_type_fixture(%{"type" => "pistol"}, current_user) |       pistol_type = ammo_type_fixture(%{class: :pistol}, current_user) | ||||||
|  |  | ||||||
|       {:ok, index_live, html} = live(conn, Routes.ammo_type_index_path(conn, :index)) |       {:ok, index_live, html} = live(conn, Routes.ammo_type_index_path(conn, :index)) | ||||||
|  |  | ||||||
| @@ -89,8 +84,8 @@ defmodule CanneryWeb.AmmoTypeLiveTest do | |||||||
|  |  | ||||||
|       html = |       html = | ||||||
|         index_live |         index_live | ||||||
|         |> form(~s/form[phx-change="change_type"]/) |         |> form(~s/form[phx-change="change_class"]/) | ||||||
|         |> render_change(ammo_type: %{type: :rifle}) |         |> render_change(ammo_type: %{class: :rifle}) | ||||||
|  |  | ||||||
|       assert html =~ rifle_type.name |       assert html =~ rifle_type.name | ||||||
|       refute html =~ shotgun_type.name |       refute html =~ shotgun_type.name | ||||||
| @@ -98,8 +93,8 @@ defmodule CanneryWeb.AmmoTypeLiveTest do | |||||||
|  |  | ||||||
|       html = |       html = | ||||||
|         index_live |         index_live | ||||||
|         |> form(~s/form[phx-change="change_type"]/) |         |> form(~s/form[phx-change="change_class"]/) | ||||||
|         |> render_change(ammo_type: %{type: :shotgun}) |         |> render_change(ammo_type: %{class: :shotgun}) | ||||||
|  |  | ||||||
|       refute html =~ rifle_type.name |       refute html =~ rifle_type.name | ||||||
|       assert html =~ shotgun_type.name |       assert html =~ shotgun_type.name | ||||||
| @@ -107,8 +102,8 @@ defmodule CanneryWeb.AmmoTypeLiveTest do | |||||||
|  |  | ||||||
|       html = |       html = | ||||||
|         index_live |         index_live | ||||||
|         |> form(~s/form[phx-change="change_type"]/) |         |> form(~s/form[phx-change="change_class"]/) | ||||||
|         |> render_change(ammo_type: %{type: :pistol}) |         |> render_change(ammo_type: %{class: :pistol}) | ||||||
|  |  | ||||||
|       refute html =~ rifle_type.name |       refute html =~ rifle_type.name | ||||||
|       refute html =~ shotgun_type.name |       refute html =~ shotgun_type.name | ||||||
| @@ -116,8 +111,8 @@ defmodule CanneryWeb.AmmoTypeLiveTest do | |||||||
|  |  | ||||||
|       html = |       html = | ||||||
|         index_live |         index_live | ||||||
|         |> form(~s/form[phx-change="change_type"]/) |         |> form(~s/form[phx-change="change_class"]/) | ||||||
|         |> render_change(ammo_type: %{type: :all}) |         |> render_change(ammo_type: %{class: :all}) | ||||||
|  |  | ||||||
|       assert html =~ rifle_type.name |       assert html =~ rifle_type.name | ||||||
|       assert html =~ shotgun_type.name |       assert html =~ shotgun_type.name | ||||||
| @@ -152,14 +147,12 @@ defmodule CanneryWeb.AmmoTypeLiveTest do | |||||||
|     test "saves new ammo_type", %{conn: conn, current_user: current_user, ammo_type: ammo_type} do |     test "saves new ammo_type", %{conn: conn, current_user: current_user, ammo_type: ammo_type} do | ||||||
|       {:ok, index_live, _html} = live(conn, Routes.ammo_type_index_path(conn, :index)) |       {:ok, index_live, _html} = live(conn, Routes.ammo_type_index_path(conn, :index)) | ||||||
|  |  | ||||||
|       assert index_live |> element("a", dgettext("actions", "New Ammo type")) |> render_click() =~ |       assert index_live |> element("a", "New Ammo type") |> render_click() =~ "New Ammo type" | ||||||
|                gettext("New Ammo type") |  | ||||||
|  |  | ||||||
|       assert_patch(index_live, Routes.ammo_type_index_path(conn, :new)) |       assert_patch(index_live, Routes.ammo_type_index_path(conn, :new)) | ||||||
|  |  | ||||||
|       # assert index_live |       assert index_live | ||||||
|       #        |> form("#ammo_type-form", ammo_type: @invalid_attrs) |              |> form("#ammo_type-form") | ||||||
|       #        |> render_change() =~ dgettext("errors", "can't be blank") |              |> render_change(ammo_type: @invalid_attrs) =~ "can't be blank" | ||||||
|  |  | ||||||
|       {:ok, _view, html} = |       {:ok, _view, html} = | ||||||
|         index_live |         index_live | ||||||
| @@ -168,7 +161,7 @@ defmodule CanneryWeb.AmmoTypeLiveTest do | |||||||
|         |> follow_redirect(conn, Routes.ammo_type_index_path(conn, :index)) |         |> follow_redirect(conn, Routes.ammo_type_index_path(conn, :index)) | ||||||
|  |  | ||||||
|       ammo_type = ammo_type.id |> Ammo.get_ammo_type!(current_user) |       ammo_type = ammo_type.id |> Ammo.get_ammo_type!(current_user) | ||||||
|       assert html =~ dgettext("prompts", "%{name} created successfully", name: ammo_type.name) |       assert html =~ "#{ammo_type.name} created successfully" | ||||||
|       assert html =~ "some bullet_type" |       assert html =~ "some bullet_type" | ||||||
|     end |     end | ||||||
|  |  | ||||||
| @@ -177,13 +170,13 @@ defmodule CanneryWeb.AmmoTypeLiveTest do | |||||||
|       {:ok, index_live, _html} = live(conn, Routes.ammo_type_index_path(conn, :index)) |       {:ok, index_live, _html} = live(conn, Routes.ammo_type_index_path(conn, :index)) | ||||||
|  |  | ||||||
|       assert index_live |> element(~s/a[aria-label="Edit #{ammo_type.name}"]/) |> render_click() =~ |       assert index_live |> element(~s/a[aria-label="Edit #{ammo_type.name}"]/) |> render_click() =~ | ||||||
|                gettext("Edit %{ammo_type_name}", ammo_type_name: ammo_type.name) |                "Edit #{ammo_type.name}" | ||||||
|  |  | ||||||
|       assert_patch(index_live, Routes.ammo_type_index_path(conn, :edit, ammo_type)) |       assert_patch(index_live, Routes.ammo_type_index_path(conn, :edit, ammo_type)) | ||||||
|  |  | ||||||
|       # assert index_live |       assert index_live | ||||||
|       #        |> form("#ammo_type-form", ammo_type: @invalid_attrs) |              |> form("#ammo_type-form") | ||||||
|       #        |> render_change() =~ dgettext("errors", "can't be blank") |              |> render_change(ammo_type: @invalid_attrs) =~ "can't be blank" | ||||||
|  |  | ||||||
|       {:ok, _view, html} = |       {:ok, _view, html} = | ||||||
|         index_live |         index_live | ||||||
| @@ -192,7 +185,7 @@ defmodule CanneryWeb.AmmoTypeLiveTest do | |||||||
|         |> follow_redirect(conn, Routes.ammo_type_index_path(conn, :index)) |         |> follow_redirect(conn, Routes.ammo_type_index_path(conn, :index)) | ||||||
|  |  | ||||||
|       ammo_type = ammo_type.id |> Ammo.get_ammo_type!(current_user) |       ammo_type = ammo_type.id |> Ammo.get_ammo_type!(current_user) | ||||||
|       assert html =~ dgettext("prompts", "%{name} updated successfully", name: ammo_type.name) |       assert html =~ "#{ammo_type.name} updated successfully" | ||||||
|       assert html =~ "some updated bullet_type" |       assert html =~ "some updated bullet_type" | ||||||
|     end |     end | ||||||
|  |  | ||||||
| @@ -201,14 +194,14 @@ defmodule CanneryWeb.AmmoTypeLiveTest do | |||||||
|       {:ok, index_live, _html} = live(conn, Routes.ammo_type_index_path(conn, :index)) |       {:ok, index_live, _html} = live(conn, Routes.ammo_type_index_path(conn, :index)) | ||||||
|  |  | ||||||
|       html = index_live |> element(~s/a[aria-label="Clone #{ammo_type.name}"]/) |> render_click() |       html = index_live |> element(~s/a[aria-label="Clone #{ammo_type.name}"]/) |> render_click() | ||||||
|       assert html =~ gettext("New Ammo type") |       assert html =~ "New Ammo type" | ||||||
|       assert html =~ "some bullet_type" |       assert html =~ "some bullet_type" | ||||||
|  |  | ||||||
|       assert_patch(index_live, Routes.ammo_type_index_path(conn, :clone, ammo_type)) |       assert_patch(index_live, Routes.ammo_type_index_path(conn, :clone, ammo_type)) | ||||||
|  |  | ||||||
|       # assert index_live |       assert index_live | ||||||
|       #        |> form("#ammo_type-form", ammo_type: @invalid_attrs) |              |> form("#ammo_type-form") | ||||||
|       #        |> render_change() =~ dgettext("errors", "can't be blank") |              |> render_change(ammo_type: @invalid_attrs) =~ "can't be blank" | ||||||
|  |  | ||||||
|       {:ok, _view, html} = |       {:ok, _view, html} = | ||||||
|         index_live |         index_live | ||||||
| @@ -217,7 +210,7 @@ defmodule CanneryWeb.AmmoTypeLiveTest do | |||||||
|         |> follow_redirect(conn, Routes.ammo_type_index_path(conn, :index)) |         |> follow_redirect(conn, Routes.ammo_type_index_path(conn, :index)) | ||||||
|  |  | ||||||
|       ammo_type = ammo_type.id |> Ammo.get_ammo_type!(current_user) |       ammo_type = ammo_type.id |> Ammo.get_ammo_type!(current_user) | ||||||
|       assert html =~ dgettext("prompts", "%{name} created successfully", name: ammo_type.name) |       assert html =~ "#{ammo_type.name} created successfully" | ||||||
|       assert html =~ "some bullet_type" |       assert html =~ "some bullet_type" | ||||||
|     end |     end | ||||||
|  |  | ||||||
| @@ -226,31 +219,30 @@ defmodule CanneryWeb.AmmoTypeLiveTest do | |||||||
|       {:ok, index_live, _html} = live(conn, Routes.ammo_type_index_path(conn, :index)) |       {:ok, index_live, _html} = live(conn, Routes.ammo_type_index_path(conn, :index)) | ||||||
|  |  | ||||||
|       html = index_live |> element(~s/a[aria-label="Clone #{ammo_type.name}"]/) |> render_click() |       html = index_live |> element(~s/a[aria-label="Clone #{ammo_type.name}"]/) |> render_click() | ||||||
|       assert html =~ gettext("New Ammo type") |       assert html =~ "New Ammo type" | ||||||
|       assert html =~ "some bullet_type" |       assert html =~ "some bullet_type" | ||||||
|  |  | ||||||
|       assert_patch(index_live, Routes.ammo_type_index_path(conn, :clone, ammo_type)) |       assert_patch(index_live, Routes.ammo_type_index_path(conn, :clone, ammo_type)) | ||||||
|  |  | ||||||
|       # assert index_live |       assert index_live | ||||||
|       #        |> form("#ammo_type-form", ammo_type: @invalid_attrs) |              |> form("#ammo_type-form") | ||||||
|       #        |> render_change() =~ dgettext("errors", "can't be blank") |              |> render_change(ammo_type: @invalid_attrs) =~ "can't be blank" | ||||||
|  |  | ||||||
|       {:ok, _view, html} = |       {:ok, _view, html} = | ||||||
|         index_live |         index_live | ||||||
|         |> form("#ammo_type-form") |         |> form("#ammo_type-form") | ||||||
|         |> render_submit( |         |> render_submit( | ||||||
|           ammo_type: Map.merge(@create_attrs, %{"bullet_type" => "some updated bullet_type"}) |           ammo_type: Map.merge(@create_attrs, %{bullet_type: "some updated bullet_type"}) | ||||||
|         ) |         ) | ||||||
|         |> follow_redirect(conn, Routes.ammo_type_index_path(conn, :index)) |         |> follow_redirect(conn, Routes.ammo_type_index_path(conn, :index)) | ||||||
|  |  | ||||||
|       ammo_type = ammo_type.id |> Ammo.get_ammo_type!(current_user) |       ammo_type = ammo_type.id |> Ammo.get_ammo_type!(current_user) | ||||||
|       assert html =~ dgettext("prompts", "%{name} created successfully", name: ammo_type.name) |       assert html =~ "#{ammo_type.name} created successfully" | ||||||
|       assert html =~ "some updated bullet_type" |       assert html =~ "some updated bullet_type" | ||||||
|     end |     end | ||||||
|  |  | ||||||
|     test "deletes ammo_type in listing", %{conn: conn, ammo_type: ammo_type} do |     test "deletes ammo_type in listing", %{conn: conn, ammo_type: ammo_type} do | ||||||
|       {:ok, index_live, _html} = live(conn, Routes.ammo_type_index_path(conn, :index)) |       {:ok, index_live, _html} = live(conn, Routes.ammo_type_index_path(conn, :index)) | ||||||
|  |  | ||||||
|       assert index_live |> element(~s/a[aria-label="Delete #{ammo_type.name}"]/) |> render_click() |       assert index_live |> element(~s/a[aria-label="Delete #{ammo_type.name}"]/) |> render_click() | ||||||
|       refute has_element?(index_live, "#ammo_type-#{ammo_type.id}") |       refute has_element?(index_live, "#ammo_type-#{ammo_type.id}") | ||||||
|     end |     end | ||||||
| @@ -263,27 +255,27 @@ defmodule CanneryWeb.AmmoTypeLiveTest do | |||||||
|          %{conn: conn, ammo_group: ammo_group, current_user: current_user} do |          %{conn: conn, ammo_group: ammo_group, current_user: current_user} do | ||||||
|       {:ok, index_live, html} = live(conn, Routes.ammo_type_index_path(conn, :index)) |       {:ok, index_live, html} = live(conn, Routes.ammo_type_index_path(conn, :index)) | ||||||
|  |  | ||||||
|       assert html =~ dgettext("actions", "Show used") |       assert html =~ "Show used" | ||||||
|       refute html =~ gettext("Used rounds") |       refute html =~ "Used rounds" | ||||||
|       refute html =~ gettext("Total ever rounds") |       refute html =~ "Total ever rounds" | ||||||
|       refute html =~ gettext("Used packs") |       refute html =~ "Used packs" | ||||||
|       refute html =~ gettext("Total ever packs") |       refute html =~ "Total ever packs" | ||||||
|  |  | ||||||
|       html = |       html = | ||||||
|         index_live |         index_live | ||||||
|         |> element(~s/input[type="checkbox"][aria-labelledby="toggle_show_used-label"}]/) |         |> element(~s/input[type="checkbox"][aria-labelledby="toggle_show_used-label"}]/) | ||||||
|         |> render_click() |         |> render_click() | ||||||
|  |  | ||||||
|       assert html =~ gettext("Used rounds") |       assert html =~ "Used rounds" | ||||||
|       assert html =~ gettext("Total ever rounds") |       assert html =~ "Total ever rounds" | ||||||
|       assert html =~ gettext("Used packs") |       assert html =~ "Used packs" | ||||||
|       assert html =~ gettext("Total ever packs") |       assert html =~ "Total ever packs" | ||||||
|  |  | ||||||
|       assert html =~ "\n20\n" |       assert html =~ "\n20\n" | ||||||
|       assert html =~ "\n0\n" |       assert html =~ "\n0\n" | ||||||
|       assert html =~ "\n1\n" |       assert html =~ "\n1\n" | ||||||
|  |  | ||||||
|       shot_group_fixture(%{"count" => 5}, current_user, ammo_group) |       shot_group_fixture(%{count: 5}, current_user, ammo_group) | ||||||
|  |  | ||||||
|       {:ok, index_live, _html} = live(conn, Routes.ammo_type_index_path(conn, :index)) |       {:ok, index_live, _html} = live(conn, Routes.ammo_type_index_path(conn, :index)) | ||||||
|  |  | ||||||
| @@ -315,13 +307,13 @@ defmodule CanneryWeb.AmmoTypeLiveTest do | |||||||
|       {:ok, show_live, _html} = live(conn, Routes.ammo_type_show_path(conn, :show, ammo_type)) |       {:ok, show_live, _html} = live(conn, Routes.ammo_type_show_path(conn, :show, ammo_type)) | ||||||
|  |  | ||||||
|       assert show_live |> element(~s/a[aria-label="Edit #{ammo_type.name}"]/) |> render_click() =~ |       assert show_live |> element(~s/a[aria-label="Edit #{ammo_type.name}"]/) |> render_click() =~ | ||||||
|                gettext("Edit %{ammo_type_name}", ammo_type_name: name) |                "Edit #{name}" | ||||||
|  |  | ||||||
|       assert_patch(show_live, Routes.ammo_type_show_path(conn, :edit, ammo_type)) |       assert_patch(show_live, Routes.ammo_type_show_path(conn, :edit, ammo_type)) | ||||||
|  |  | ||||||
|       # assert show_live |       assert show_live | ||||||
|       #        |> form("#ammo_type-form", ammo_type: @invalid_attrs) |              |> form("#ammo_type-form") | ||||||
|       #        |> render_change() =~ dgettext("errors", "can't be blank") |              |> render_change(ammo_type: @invalid_attrs) =~ "can't be blank" | ||||||
|  |  | ||||||
|       {:ok, _view, html} = |       {:ok, _view, html} = | ||||||
|         show_live |         show_live | ||||||
| @@ -330,7 +322,7 @@ defmodule CanneryWeb.AmmoTypeLiveTest do | |||||||
|         |> follow_redirect(conn, Routes.ammo_type_show_path(conn, :show, ammo_type)) |         |> follow_redirect(conn, Routes.ammo_type_show_path(conn, :show, ammo_type)) | ||||||
|  |  | ||||||
|       ammo_type = ammo_type.id |> Ammo.get_ammo_type!(current_user) |       ammo_type = ammo_type.id |> Ammo.get_ammo_type!(current_user) | ||||||
|       assert html =~ dgettext("prompts", "%{name} updated successfully", name: ammo_type.name) |       assert html =~ "#{ammo_type.name} updated successfully" | ||||||
|       assert html =~ "some updated bullet_type" |       assert html =~ "some updated bullet_type" | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
| @@ -370,8 +362,7 @@ defmodule CanneryWeb.AmmoTypeLiveTest do | |||||||
|     test "displays empty ammo groups on toggle", |     test "displays empty ammo groups on toggle", | ||||||
|          %{conn: conn, ammo_type: ammo_type, container: %{name: container_name}} do |          %{conn: conn, ammo_type: ammo_type, container: %{name: container_name}} do | ||||||
|       {:ok, show_live, html} = live(conn, Routes.ammo_type_show_path(conn, :show, ammo_type)) |       {:ok, show_live, html} = live(conn, Routes.ammo_type_show_path(conn, :show, ammo_type)) | ||||||
|  |       assert html =~ "Show used" | ||||||
|       assert html =~ dgettext("actions", "Show used") |  | ||||||
|       refute html =~ "\n20\n" |       refute html =~ "\n20\n" | ||||||
|  |  | ||||||
|       html = |       html = | ||||||
| @@ -393,7 +384,7 @@ defmodule CanneryWeb.AmmoTypeLiveTest do | |||||||
|         |> element(~s/input[type="checkbox"][aria-labelledby="toggle_table-label"}]/) |         |> element(~s/input[type="checkbox"][aria-labelledby="toggle_table-label"}]/) | ||||||
|         |> render_click() |         |> render_click() | ||||||
|  |  | ||||||
|       assert html =~ dgettext("actions", "Show used") |       assert html =~ "Show used" | ||||||
|       refute html =~ "\n20\n" |       refute html =~ "\n20\n" | ||||||
|  |  | ||||||
|       html = |       html = | ||||||
|   | |||||||
| @@ -5,48 +5,46 @@ defmodule CanneryWeb.ContainerLiveTest do | |||||||
|  |  | ||||||
|   use CanneryWeb.ConnCase |   use CanneryWeb.ConnCase | ||||||
|   import Phoenix.LiveViewTest |   import Phoenix.LiveViewTest | ||||||
|   import CanneryWeb.Gettext |  | ||||||
|   alias Cannery.Containers |   alias Cannery.Containers | ||||||
|  |  | ||||||
|   @moduletag :container_live_test |   @moduletag :container_live_test | ||||||
|  |  | ||||||
|   @create_attrs %{ |   @create_attrs %{ | ||||||
|     "desc" => "some desc", |     desc: "some desc", | ||||||
|     "location" => "some location", |     location: "some location", | ||||||
|     "name" => "some name", |     name: "some name", | ||||||
|     "type" => "some type" |     type: "some type" | ||||||
|   } |   } | ||||||
|   @update_attrs %{ |   @update_attrs %{ | ||||||
|     "desc" => "some updated desc", |     desc: "some updated desc", | ||||||
|     "location" => "some updated location", |     location: "some updated location", | ||||||
|     "name" => "some updated name", |     name: "some updated name", | ||||||
|     "type" => "some updated type" |     type: "some updated type" | ||||||
|   } |   } | ||||||
|  |   @invalid_attrs %{desc: nil, location: nil, name: nil, type: nil} | ||||||
|   @ammo_type_attrs %{ |   @ammo_type_attrs %{ | ||||||
|     "bullet_type" => "some bullet_type", |     bullet_type: "some bullet_type", | ||||||
|     "case_material" => "some case_material", |     case_material: "some case_material", | ||||||
|     "desc" => "some desc", |     desc: "some desc", | ||||||
|     "manufacturer" => "some manufacturer", |     manufacturer: "some manufacturer", | ||||||
|     "name" => "some name", |     name: "some name", | ||||||
|     "grains" => 120 |     grains: 120 | ||||||
|   } |   } | ||||||
|   @ammo_group_attrs %{ |   @ammo_group_attrs %{ | ||||||
|     "notes" => "some ammo group", |     notes: "some ammo group", | ||||||
|     "count" => 20 |     count: 20 | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   # @invalid_attrs %{desc: nil, location: nil, name: nil, type: nil} |  | ||||||
|  |  | ||||||
|   defp create_container(%{current_user: current_user}) do |   defp create_container(%{current_user: current_user}) do | ||||||
|     container = container_fixture(@create_attrs, current_user) |     container = container_fixture(@create_attrs, current_user) | ||||||
|     %{container: container} |     [container: container] | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   defp create_ammo_group(%{container: container, current_user: current_user}) do |   defp create_ammo_group(%{container: container, current_user: current_user}) do | ||||||
|     ammo_type = ammo_type_fixture(@ammo_type_attrs, current_user) |     ammo_type = ammo_type_fixture(@ammo_type_attrs, current_user) | ||||||
|     {1, [ammo_group]} = ammo_group_fixture(@ammo_group_attrs, ammo_type, container, current_user) |     {1, [ammo_group]} = ammo_group_fixture(@ammo_group_attrs, ammo_type, container, current_user) | ||||||
|  |  | ||||||
|     %{ammo_type: ammo_type, ammo_group: ammo_group} |     [ammo_type: ammo_type, ammo_group: ammo_group] | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   describe "Index" do |   describe "Index" do | ||||||
| @@ -55,7 +53,7 @@ defmodule CanneryWeb.ContainerLiveTest do | |||||||
|     test "lists all containers", %{conn: conn, container: container} do |     test "lists all containers", %{conn: conn, container: container} do | ||||||
|       {:ok, _index_live, html} = live(conn, Routes.container_index_path(conn, :index)) |       {:ok, _index_live, html} = live(conn, Routes.container_index_path(conn, :index)) | ||||||
|  |  | ||||||
|       assert html =~ gettext("Containers") |       assert html =~ "Containers" | ||||||
|       assert html =~ container.location |       assert html =~ container.location | ||||||
|     end |     end | ||||||
|  |  | ||||||
| @@ -67,7 +65,7 @@ defmodule CanneryWeb.ContainerLiveTest do | |||||||
|         |> element(~s/input[type="checkbox"][aria-labelledby="toggle_table-label"}]/) |         |> element(~s/input[type="checkbox"][aria-labelledby="toggle_table-label"}]/) | ||||||
|         |> render_click() |         |> render_click() | ||||||
|  |  | ||||||
|       assert html =~ gettext("Containers") |       assert html =~ "Containers" | ||||||
|       assert html =~ container.location |       assert html =~ container.location | ||||||
|     end |     end | ||||||
|  |  | ||||||
| @@ -77,22 +75,20 @@ defmodule CanneryWeb.ContainerLiveTest do | |||||||
|       assert html =~ container.location |       assert html =~ container.location | ||||||
|  |  | ||||||
|       assert index_live |       assert index_live | ||||||
|              |> form(~s/form[phx-change="search"]/, |              |> form(~s/form[phx-change="search"]/) | ||||||
|                search: %{search_term: container.location} |              |> render_change(search: %{search_term: container.location}) =~ container.location | ||||||
|              ) |  | ||||||
|              |> render_change() =~ container.location |  | ||||||
|  |  | ||||||
|       assert_patch(index_live, Routes.container_index_path(conn, :search, container.location)) |       assert_patch(index_live, Routes.container_index_path(conn, :search, container.location)) | ||||||
|  |  | ||||||
|       refute index_live |       refute index_live | ||||||
|              |> form(~s/form[phx-change="search"]/, search: %{search_term: "something_else"}) |              |> form(~s/form[phx-change="search"]/) | ||||||
|              |> render_change() =~ container.location |              |> render_change(search: %{search_term: "something_else"}) =~ container.location | ||||||
|  |  | ||||||
|       assert_patch(index_live, Routes.container_index_path(conn, :search, "something_else")) |       assert_patch(index_live, Routes.container_index_path(conn, :search, "something_else")) | ||||||
|  |  | ||||||
|       assert index_live |       assert index_live | ||||||
|              |> form(~s/form[phx-change="search"]/, search: %{search_term: ""}) |              |> form(~s/form[phx-change="search"]/) | ||||||
|              |> render_change() =~ container.location |              |> render_change(search: %{search_term: ""}) =~ container.location | ||||||
|  |  | ||||||
|       assert_patch(index_live, Routes.container_index_path(conn, :index)) |       assert_patch(index_live, Routes.container_index_path(conn, :index)) | ||||||
|     end |     end | ||||||
| @@ -100,22 +96,20 @@ defmodule CanneryWeb.ContainerLiveTest do | |||||||
|     test "saves new container", %{conn: conn, container: container} do |     test "saves new container", %{conn: conn, container: container} do | ||||||
|       {:ok, index_live, _html} = live(conn, Routes.container_index_path(conn, :index)) |       {:ok, index_live, _html} = live(conn, Routes.container_index_path(conn, :index)) | ||||||
|  |  | ||||||
|       assert index_live |> element("a", dgettext("actions", "New Container")) |> render_click() =~ |       assert index_live |> element("a", "New Container") |> render_click() =~ "New Container" | ||||||
|                gettext("New Container") |  | ||||||
|  |  | ||||||
|       assert_patch(index_live, Routes.container_index_path(conn, :new)) |       assert_patch(index_live, Routes.container_index_path(conn, :new)) | ||||||
|  |  | ||||||
|       # assert index_live |       assert index_live | ||||||
|       #        |> form("#container-form", container: @invalid_attrs) |              |> form("#container-form") | ||||||
|       #        |> render_change() =~ dgettext("errors", "can't be blank") |              |> render_change(container: @invalid_attrs) =~ "can't be blank" | ||||||
|  |  | ||||||
|       {:ok, _view, html} = |       {:ok, _view, html} = | ||||||
|         index_live |         index_live | ||||||
|         |> form("#container-form", container: @create_attrs) |         |> form("#container-form") | ||||||
|         |> render_submit() |         |> render_submit(container: @create_attrs) | ||||||
|         |> follow_redirect(conn, Routes.container_index_path(conn, :index)) |         |> follow_redirect(conn, Routes.container_index_path(conn, :index)) | ||||||
|  |  | ||||||
|       assert html =~ dgettext("prompts", "%{name} created successfully", name: container.name) |       assert html =~ "#{container.name} created successfully" | ||||||
|       assert html =~ "some location" |       assert html =~ "some location" | ||||||
|     end |     end | ||||||
|  |  | ||||||
| @@ -127,22 +121,22 @@ defmodule CanneryWeb.ContainerLiveTest do | |||||||
|       {:ok, index_live, _html} = live(conn, Routes.container_index_path(conn, :index)) |       {:ok, index_live, _html} = live(conn, Routes.container_index_path(conn, :index)) | ||||||
|  |  | ||||||
|       assert index_live |> element(~s/a[aria-label="Edit #{container.name}"]/) |> render_click() =~ |       assert index_live |> element(~s/a[aria-label="Edit #{container.name}"]/) |> render_click() =~ | ||||||
|                gettext("Edit %{name}", name: container.name) |                "Edit #{container.name}" | ||||||
|  |  | ||||||
|       assert_patch(index_live, Routes.container_index_path(conn, :edit, container)) |       assert_patch(index_live, Routes.container_index_path(conn, :edit, container)) | ||||||
|  |  | ||||||
|       # assert index_live |       assert index_live | ||||||
|       #        |> form("#container-form", container: @invalid_attrs) |              |> form("#container-form") | ||||||
|       #        |> render_change() =~ dgettext("errors", "can't be blank") |              |> render_change(container: @invalid_attrs) =~ "can't be blank" | ||||||
|  |  | ||||||
|       {:ok, _view, html} = |       {:ok, _view, html} = | ||||||
|         index_live |         index_live | ||||||
|         |> form("#container-form", container: @update_attrs) |         |> form("#container-form") | ||||||
|         |> render_submit() |         |> render_submit(container: @update_attrs) | ||||||
|         |> follow_redirect(conn, Routes.container_index_path(conn, :index)) |         |> follow_redirect(conn, Routes.container_index_path(conn, :index)) | ||||||
|  |  | ||||||
|       container = container.id |> Containers.get_container!(current_user) |       container = container.id |> Containers.get_container!(current_user) | ||||||
|       assert html =~ dgettext("prompts", "%{name} updated successfully", name: container.name) |       assert html =~ "#{container.name} updated successfully" | ||||||
|       assert html =~ "some updated location" |       assert html =~ "some updated location" | ||||||
|     end |     end | ||||||
|  |  | ||||||
| @@ -154,23 +148,23 @@ defmodule CanneryWeb.ContainerLiveTest do | |||||||
|       {:ok, index_live, _html} = live(conn, Routes.container_index_path(conn, :index)) |       {:ok, index_live, _html} = live(conn, Routes.container_index_path(conn, :index)) | ||||||
|  |  | ||||||
|       html = index_live |> element(~s/a[aria-label="Clone #{container.name}"]/) |> render_click() |       html = index_live |> element(~s/a[aria-label="Clone #{container.name}"]/) |> render_click() | ||||||
|       assert html =~ gettext("New Container") |       assert html =~ "New Container" | ||||||
|       assert html =~ "some location" |       assert html =~ "some location" | ||||||
|  |  | ||||||
|       assert_patch(index_live, Routes.container_index_path(conn, :clone, container)) |       assert_patch(index_live, Routes.container_index_path(conn, :clone, container)) | ||||||
|  |  | ||||||
|       # assert index_live |       assert index_live | ||||||
|       #        |> form("#container-form", container: @invalid_attrs) |              |> form("#container-form") | ||||||
|       #        |> render_change() =~ dgettext("errors", "can't be blank") |              |> render_change(container: @invalid_attrs) =~ "can't be blank" | ||||||
|  |  | ||||||
|       {:ok, _view, html} = |       {:ok, _view, html} = | ||||||
|         index_live |         index_live | ||||||
|         |> form("#container-form", container: @create_attrs) |         |> form("#container-form") | ||||||
|         |> render_submit() |         |> render_submit(container: @create_attrs) | ||||||
|         |> follow_redirect(conn, Routes.container_index_path(conn, :index)) |         |> follow_redirect(conn, Routes.container_index_path(conn, :index)) | ||||||
|  |  | ||||||
|       container = container.id |> Containers.get_container!(current_user) |       container = container.id |> Containers.get_container!(current_user) | ||||||
|       assert html =~ dgettext("prompts", "%{name} created successfully", name: container.name) |       assert html =~ "#{container.name} created successfully" | ||||||
|       assert html =~ "some location" |       assert html =~ "some location" | ||||||
|     end |     end | ||||||
|  |  | ||||||
| @@ -182,30 +176,29 @@ defmodule CanneryWeb.ContainerLiveTest do | |||||||
|       {:ok, index_live, _html} = live(conn, Routes.container_index_path(conn, :index)) |       {:ok, index_live, _html} = live(conn, Routes.container_index_path(conn, :index)) | ||||||
|  |  | ||||||
|       assert index_live |> element(~s/a[aria-label="Clone #{container.name}"]/) |> render_click() =~ |       assert index_live |> element(~s/a[aria-label="Clone #{container.name}"]/) |> render_click() =~ | ||||||
|                gettext("New Container") |                "New Container" | ||||||
|  |  | ||||||
|       assert_patch(index_live, Routes.container_index_path(conn, :clone, container)) |       assert_patch(index_live, Routes.container_index_path(conn, :clone, container)) | ||||||
|  |  | ||||||
|       # assert index_live |       assert index_live | ||||||
|       #        |> form("#container-form", container: @invalid_attrs) |              |> form("#container-form") | ||||||
|       #        |> render_change() =~ dgettext("errors", "can't be blank") |              |> render_change(container: @invalid_attrs) =~ "can't be blank" | ||||||
|  |  | ||||||
|       {:ok, _view, html} = |       {:ok, _view, html} = | ||||||
|         index_live |         index_live | ||||||
|         |> form("#container-form", |         |> form("#container-form") | ||||||
|  |         |> render_submit( | ||||||
|           container: Map.merge(@create_attrs, %{location: "some updated location"}) |           container: Map.merge(@create_attrs, %{location: "some updated location"}) | ||||||
|         ) |         ) | ||||||
|         |> render_submit() |  | ||||||
|         |> follow_redirect(conn, Routes.container_index_path(conn, :index)) |         |> follow_redirect(conn, Routes.container_index_path(conn, :index)) | ||||||
|  |  | ||||||
|       container = container.id |> Containers.get_container!(current_user) |       container = container.id |> Containers.get_container!(current_user) | ||||||
|       assert html =~ dgettext("prompts", "%{name} created successfully", name: container.name) |       assert html =~ "#{container.name} created successfully" | ||||||
|       assert html =~ "some updated location" |       assert html =~ "some updated location" | ||||||
|     end |     end | ||||||
|  |  | ||||||
|     test "deletes container in listing", %{conn: conn, container: container} do |     test "deletes container in listing", %{conn: conn, container: container} do | ||||||
|       {:ok, index_live, _html} = live(conn, Routes.container_index_path(conn, :index)) |       {:ok, index_live, _html} = live(conn, Routes.container_index_path(conn, :index)) | ||||||
|  |  | ||||||
|       assert index_live |> element(~s/a[aria-label="Delete #{container.name}"]/) |> render_click() |       assert index_live |> element(~s/a[aria-label="Delete #{container.name}"]/) |> render_click() | ||||||
|       refute has_element?(index_live, "#container-#{container.id}") |       refute has_element?(index_live, "#container-#{container.id}") | ||||||
|     end |     end | ||||||
| @@ -219,7 +212,6 @@ defmodule CanneryWeb.ContainerLiveTest do | |||||||
|       container: %{name: name, location: location} = container |       container: %{name: name, location: location} = container | ||||||
|     } do |     } do | ||||||
|       {:ok, _show_live, html} = live(conn, Routes.container_show_path(conn, :show, container)) |       {:ok, _show_live, html} = live(conn, Routes.container_show_path(conn, :show, container)) | ||||||
|  |  | ||||||
|       assert html =~ name |       assert html =~ name | ||||||
|       assert html =~ location |       assert html =~ location | ||||||
|     end |     end | ||||||
| @@ -232,32 +224,32 @@ defmodule CanneryWeb.ContainerLiveTest do | |||||||
|       {:ok, show_live, _html} = live(conn, Routes.container_show_path(conn, :show, container)) |       {:ok, show_live, _html} = live(conn, Routes.container_show_path(conn, :show, container)) | ||||||
|  |  | ||||||
|       assert show_live |> element(~s/a[aria-label="Edit #{container.name}"]/) |> render_click() =~ |       assert show_live |> element(~s/a[aria-label="Edit #{container.name}"]/) |> render_click() =~ | ||||||
|                gettext("Edit %{name}", name: container.name) |                "Edit #{container.name}" | ||||||
|  |  | ||||||
|       assert_patch(show_live, Routes.container_show_path(conn, :edit, container)) |       assert_patch(show_live, Routes.container_show_path(conn, :edit, container)) | ||||||
|  |  | ||||||
|       # assert show_live |       assert show_live | ||||||
|       #        |> form("#container-form", container: @invalid_attrs) |              |> form("#container-form") | ||||||
|       #        |> render_change() =~ dgettext("errors", "can't be blank") |              |> render_change(container: @invalid_attrs) =~ "can't be blank" | ||||||
|  |  | ||||||
|       {:ok, _view, html} = |       {:ok, _view, html} = | ||||||
|         show_live |         show_live | ||||||
|         |> form("#container-form", container: @update_attrs) |         |> form("#container-form") | ||||||
|         |> render_submit() |         |> render_submit(container: @update_attrs) | ||||||
|         |> follow_redirect(conn, Routes.container_show_path(conn, :show, container)) |         |> follow_redirect(conn, Routes.container_show_path(conn, :show, container)) | ||||||
|  |  | ||||||
|       container = container.id |> Containers.get_container!(current_user) |       container = container.id |> Containers.get_container!(current_user) | ||||||
|       assert html =~ dgettext("prompts", "%{name} updated successfully", name: container.name) |       assert html =~ "#{container.name} updated successfully" | ||||||
|       assert html =~ "some updated location" |       assert html =~ "some updated location" | ||||||
|     end |     end | ||||||
|  |  | ||||||
|     test "can sort by type", |     test "can sort by type", | ||||||
|          %{conn: conn, container: container, current_user: current_user} do |          %{conn: conn, container: container, current_user: current_user} do | ||||||
|       rifle_type = ammo_type_fixture(%{"type" => "rifle"}, current_user) |       rifle_type = ammo_type_fixture(%{class: :rifle}, current_user) | ||||||
|       {1, [rifle_ammo_group]} = ammo_group_fixture(rifle_type, container, current_user) |       {1, [rifle_ammo_group]} = ammo_group_fixture(rifle_type, container, current_user) | ||||||
|       shotgun_type = ammo_type_fixture(%{"type" => "shotgun"}, current_user) |       shotgun_type = ammo_type_fixture(%{class: :shotgun}, current_user) | ||||||
|       {1, [shotgun_ammo_group]} = ammo_group_fixture(shotgun_type, container, current_user) |       {1, [shotgun_ammo_group]} = ammo_group_fixture(shotgun_type, container, current_user) | ||||||
|       pistol_type = ammo_type_fixture(%{"type" => "pistol"}, current_user) |       pistol_type = ammo_type_fixture(%{class: :pistol}, current_user) | ||||||
|       {1, [pistol_ammo_group]} = ammo_group_fixture(pistol_type, container, current_user) |       {1, [pistol_ammo_group]} = ammo_group_fixture(pistol_type, container, current_user) | ||||||
|  |  | ||||||
|       {:ok, index_live, html} = live(conn, Routes.container_show_path(conn, :show, container)) |       {:ok, index_live, html} = live(conn, Routes.container_show_path(conn, :show, container)) | ||||||
| @@ -270,8 +262,8 @@ defmodule CanneryWeb.ContainerLiveTest do | |||||||
|  |  | ||||||
|       html = |       html = | ||||||
|         index_live |         index_live | ||||||
|         |> form(~s/form[phx-change="change_type"]/) |         |> form(~s/form[phx-change="change_class"]/) | ||||||
|         |> render_change(ammo_type: %{type: :rifle}) |         |> render_change(ammo_type: %{class: :rifle}) | ||||||
|  |  | ||||||
|       assert html =~ rifle_ammo_group.ammo_type.name |       assert html =~ rifle_ammo_group.ammo_type.name | ||||||
|       refute html =~ shotgun_ammo_group.ammo_type.name |       refute html =~ shotgun_ammo_group.ammo_type.name | ||||||
| @@ -279,8 +271,8 @@ defmodule CanneryWeb.ContainerLiveTest do | |||||||
|  |  | ||||||
|       html = |       html = | ||||||
|         index_live |         index_live | ||||||
|         |> form(~s/form[phx-change="change_type"]/) |         |> form(~s/form[phx-change="change_class"]/) | ||||||
|         |> render_change(ammo_type: %{type: :shotgun}) |         |> render_change(ammo_type: %{class: :shotgun}) | ||||||
|  |  | ||||||
|       refute html =~ rifle_ammo_group.ammo_type.name |       refute html =~ rifle_ammo_group.ammo_type.name | ||||||
|       assert html =~ shotgun_ammo_group.ammo_type.name |       assert html =~ shotgun_ammo_group.ammo_type.name | ||||||
| @@ -288,8 +280,8 @@ defmodule CanneryWeb.ContainerLiveTest do | |||||||
|  |  | ||||||
|       html = |       html = | ||||||
|         index_live |         index_live | ||||||
|         |> form(~s/form[phx-change="change_type"]/) |         |> form(~s/form[phx-change="change_class"]/) | ||||||
|         |> render_change(ammo_type: %{type: :pistol}) |         |> render_change(ammo_type: %{class: :pistol}) | ||||||
|  |  | ||||||
|       refute html =~ rifle_ammo_group.ammo_type.name |       refute html =~ rifle_ammo_group.ammo_type.name | ||||||
|       refute html =~ shotgun_ammo_group.ammo_type.name |       refute html =~ shotgun_ammo_group.ammo_type.name | ||||||
| @@ -297,8 +289,8 @@ defmodule CanneryWeb.ContainerLiveTest do | |||||||
|  |  | ||||||
|       html = |       html = | ||||||
|         index_live |         index_live | ||||||
|         |> form(~s/form[phx-change="change_type"]/) |         |> form(~s/form[phx-change="change_class"]/) | ||||||
|         |> render_change(ammo_type: %{type: :all}) |         |> render_change(ammo_type: %{class: :all}) | ||||||
|  |  | ||||||
|       assert html =~ rifle_ammo_group.ammo_type.name |       assert html =~ rifle_ammo_group.ammo_type.name | ||||||
|       assert html =~ shotgun_ammo_group.ammo_type.name |       assert html =~ shotgun_ammo_group.ammo_type.name | ||||||
|   | |||||||
| @@ -5,14 +5,13 @@ defmodule CanneryWeb.HomeLiveTest do | |||||||
|  |  | ||||||
|   use CanneryWeb.ConnCase |   use CanneryWeb.ConnCase | ||||||
|   import Phoenix.LiveViewTest |   import Phoenix.LiveViewTest | ||||||
|   import CanneryWeb.Gettext |  | ||||||
|  |  | ||||||
|   @moduletag :home_live_test |   @moduletag :home_live_test | ||||||
|  |  | ||||||
|   test "disconnected and connected render", %{conn: conn} do |   test "disconnected and connected render", %{conn: conn} do | ||||||
|     {:ok, home_live, disconnected_html} = live(conn, "/") |     {:ok, home_live, disconnected_html} = live(conn, "/") | ||||||
|     assert disconnected_html =~ gettext("Welcome to %{name}", name: "Cannery") |     assert disconnected_html =~ "Welcome to Cannery" | ||||||
|     assert render(home_live) =~ gettext("Welcome to %{name}", name: "Cannery") |     assert render(home_live) =~ "Welcome to Cannery" | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   test "displays version number", %{conn: conn} do |   test "displays version number", %{conn: conn} do | ||||||
|   | |||||||
| @@ -5,13 +5,12 @@ defmodule CanneryWeb.InviteLiveTest do | |||||||
|  |  | ||||||
|   use CanneryWeb.ConnCase |   use CanneryWeb.ConnCase | ||||||
|   import Phoenix.LiveViewTest |   import Phoenix.LiveViewTest | ||||||
|   import CanneryWeb.Gettext |  | ||||||
|   alias Cannery.Accounts.Invites |   alias Cannery.Accounts.Invites | ||||||
|  |  | ||||||
|   @moduletag :invite_live_test |   @moduletag :invite_live_test | ||||||
|   @create_attrs %{"name" => "some name"} |   @create_attrs %{name: "some name"} | ||||||
|   @update_attrs %{"name" => "some updated name"} |   @update_attrs %{name: "some updated name"} | ||||||
|   # @invalid_attrs %{"name" => nil} |   @invalid_attrs %{name: nil} | ||||||
|  |  | ||||||
|   describe "Index" do |   describe "Index" do | ||||||
|     setup [:register_and_log_in_user] |     setup [:register_and_log_in_user] | ||||||
| @@ -24,32 +23,27 @@ defmodule CanneryWeb.InviteLiveTest do | |||||||
|     test "lists all invites", %{conn: conn, invite: invite} do |     test "lists all invites", %{conn: conn, invite: invite} do | ||||||
|       {:ok, _index_live, html} = live(conn, Routes.invite_index_path(conn, :index)) |       {:ok, _index_live, html} = live(conn, Routes.invite_index_path(conn, :index)) | ||||||
|  |  | ||||||
|       assert html =~ gettext("Invites") |       assert html =~ "Invites" | ||||||
|       assert html =~ invite.name |       assert html =~ invite.name | ||||||
|     end |     end | ||||||
|  |  | ||||||
|     test "saves new invite", %{conn: conn} do |     test "saves new invite", %{conn: conn} do | ||||||
|       {:ok, index_live, _html} = live(conn, Routes.invite_index_path(conn, :index)) |       {:ok, index_live, _html} = live(conn, Routes.invite_index_path(conn, :index)) | ||||||
|  |  | ||||||
|       assert index_live |> element("a", dgettext("actions", "Create Invite")) |> render_click() =~ |       assert index_live |> element("a", "Create Invite") |> render_click() =~ "New Invite" | ||||||
|                gettext("New Invite") |  | ||||||
|  |  | ||||||
|       assert_patch(index_live, Routes.invite_index_path(conn, :new)) |       assert_patch(index_live, Routes.invite_index_path(conn, :new)) | ||||||
|  |  | ||||||
|       # assert index_live |       assert index_live | ||||||
|       #        |> form("#invite-form", invite: @invalid_attrs) |              |> form("#invite-form") | ||||||
|       #        |> render_change() =~ dgettext("errors", "can't be blank") |              |> render_change(invite: @invalid_attrs) =~ "can't be blank" | ||||||
|  |  | ||||||
|       {:ok, _live, html} = |       {:ok, _live, html} = | ||||||
|         index_live |         index_live | ||||||
|         |> form("#invite-form", invite: @create_attrs) |         |> form("#invite-form") | ||||||
|         |> render_submit() |         |> render_submit(invite: @create_attrs) | ||||||
|         |> follow_redirect(conn, Routes.invite_index_path(conn, :index)) |         |> follow_redirect(conn, Routes.invite_index_path(conn, :index)) | ||||||
|  |  | ||||||
|       assert html =~ |       assert html =~ "some name created successfully" | ||||||
|                dgettext("prompts", "%{invite_name} created successfully", invite_name: "some name") |  | ||||||
|  |  | ||||||
|       assert html =~ "some name" |  | ||||||
|     end |     end | ||||||
|  |  | ||||||
|     test "updates invite in listing", %{conn: conn, invite: invite} do |     test "updates invite in listing", %{conn: conn, invite: invite} do | ||||||
| @@ -57,27 +51,21 @@ defmodule CanneryWeb.InviteLiveTest do | |||||||
|  |  | ||||||
|       assert index_live |       assert index_live | ||||||
|              |> element(~s/a[aria-label="Edit invite for #{invite.name}"]/) |              |> element(~s/a[aria-label="Edit invite for #{invite.name}"]/) | ||||||
|              |> render_click() =~ |              |> render_click() =~ "Edit Invite" | ||||||
|                gettext("Edit Invite") |  | ||||||
|  |  | ||||||
|       assert_patch(index_live, Routes.invite_index_path(conn, :edit, invite)) |       assert_patch(index_live, Routes.invite_index_path(conn, :edit, invite)) | ||||||
|  |  | ||||||
|       # assert index_live |       assert index_live | ||||||
|       #        |> form("#invite-form", invite: @invalid_attrs) |              |> form("#invite-form") | ||||||
|       #        |> render_change() =~ dgettext("errors", "can't be blank") |              |> render_change(invite: @invalid_attrs) =~ "can't be blank" | ||||||
|  |  | ||||||
|       {:ok, _live, html} = |       {:ok, _live, html} = | ||||||
|         index_live |         index_live | ||||||
|         |> form("#invite-form", invite: @update_attrs) |         |> form("#invite-form") | ||||||
|         |> render_submit() |         |> render_submit(invite: @update_attrs) | ||||||
|         |> follow_redirect(conn, Routes.invite_index_path(conn, :index)) |         |> follow_redirect(conn, Routes.invite_index_path(conn, :index)) | ||||||
|  |  | ||||||
|       assert html =~ |       assert html =~ "some updated name updated successfully" | ||||||
|                dgettext("prompts", "%{invite_name} updated successfully", |  | ||||||
|                  invite_name: "some updated name" |  | ||||||
|                ) |  | ||||||
|  |  | ||||||
|       assert html =~ "some updated name" |  | ||||||
|     end |     end | ||||||
|  |  | ||||||
|     test "deletes invite in listing", %{conn: conn, invite: invite} do |     test "deletes invite in listing", %{conn: conn, invite: invite} do | ||||||
|   | |||||||
| @@ -6,22 +6,20 @@ defmodule CanneryWeb.RangeLiveTest do | |||||||
|   use CanneryWeb.ConnCase |   use CanneryWeb.ConnCase | ||||||
|   import Phoenix.LiveViewTest |   import Phoenix.LiveViewTest | ||||||
|   import Cannery.Fixtures |   import Cannery.Fixtures | ||||||
|   import CanneryWeb.Gettext |  | ||||||
|  |  | ||||||
|   @moduletag :range_live_test |   @moduletag :range_live_test | ||||||
|   @create_attrs %{"ammo_left" => 5, "notes" => "some notes"} |   @create_attrs %{ammo_left: 5, notes: "some notes"} | ||||||
|   @update_attrs %{"count" => 16, "notes" => "some updated notes"} |   @update_attrs %{count: 16, notes: "some updated notes"} | ||||||
|   # @invalid_attrs %{"count" => nil, "notes" => nil} |   @invalid_attrs %{count: nil, notes: nil} | ||||||
|  |  | ||||||
|   defp create_shot_group(%{current_user: current_user}) do |   defp create_shot_group(%{current_user: current_user}) do | ||||||
|     container = container_fixture(%{"staged" => true}, current_user) |     container = container_fixture(%{staged: true}, current_user) | ||||||
|     ammo_type = ammo_type_fixture(current_user) |     ammo_type = ammo_type_fixture(current_user) | ||||||
|  |  | ||||||
|     {1, [ammo_group]} = |     {1, [ammo_group]} = ammo_group_fixture(%{staged: true}, ammo_type, container, current_user) | ||||||
|       ammo_group_fixture(%{"staged" => true}, ammo_type, container, current_user) |  | ||||||
|  |  | ||||||
|     shot_group = |     shot_group = | ||||||
|       %{"count" => 5, "date" => ~N[2022-02-13 03:17:00], "notes" => "some notes"} |       %{count: 5, date: ~N[2022-02-13 03:17:00], notes: "some notes"} | ||||||
|       |> shot_group_fixture(current_user, ammo_group) |       |> shot_group_fixture(current_user, ammo_group) | ||||||
|  |  | ||||||
|     [ |     [ | ||||||
| @@ -38,29 +36,28 @@ defmodule CanneryWeb.RangeLiveTest do | |||||||
|     test "lists all shot_groups", %{conn: conn, shot_group: shot_group} do |     test "lists all shot_groups", %{conn: conn, shot_group: shot_group} do | ||||||
|       {:ok, _index_live, html} = live(conn, Routes.range_index_path(conn, :index)) |       {:ok, _index_live, html} = live(conn, Routes.range_index_path(conn, :index)) | ||||||
|  |  | ||||||
|       assert html =~ gettext("Range day") |       assert html =~ "Range day" | ||||||
|       assert html =~ shot_group.notes |       assert html =~ shot_group.notes | ||||||
|     end |     end | ||||||
|  |  | ||||||
|     test "can sort by type", |     test "can sort by type", | ||||||
|          %{conn: conn, container: container, current_user: current_user} do |          %{conn: conn, container: container, current_user: current_user} do | ||||||
|       rifle_ammo_type = ammo_type_fixture(%{"type" => "rifle"}, current_user) |       rifle_ammo_type = ammo_type_fixture(%{class: :rifle}, current_user) | ||||||
|       {1, [rifle_ammo_group]} = ammo_group_fixture(rifle_ammo_type, container, current_user) |       {1, [rifle_ammo_group]} = ammo_group_fixture(rifle_ammo_type, container, current_user) | ||||||
|  |  | ||||||
|       rifle_shot_group = |       rifle_shot_group = shot_group_fixture(%{notes: "group_one"}, current_user, rifle_ammo_group) | ||||||
|         shot_group_fixture(%{"notes" => "group_one"}, current_user, rifle_ammo_group) |  | ||||||
|  |  | ||||||
|       shotgun_ammo_type = ammo_type_fixture(%{"type" => "shotgun"}, current_user) |       shotgun_ammo_type = ammo_type_fixture(%{class: :shotgun}, current_user) | ||||||
|       {1, [shotgun_ammo_group]} = ammo_group_fixture(shotgun_ammo_type, container, current_user) |       {1, [shotgun_ammo_group]} = ammo_group_fixture(shotgun_ammo_type, container, current_user) | ||||||
|  |  | ||||||
|       shotgun_shot_group = |       shotgun_shot_group = | ||||||
|         shot_group_fixture(%{"notes" => "group_two"}, current_user, shotgun_ammo_group) |         shot_group_fixture(%{notes: "group_two"}, current_user, shotgun_ammo_group) | ||||||
|  |  | ||||||
|       pistol_ammo_type = ammo_type_fixture(%{"type" => "pistol"}, current_user) |       pistol_ammo_type = ammo_type_fixture(%{class: :pistol}, current_user) | ||||||
|       {1, [pistol_ammo_group]} = ammo_group_fixture(pistol_ammo_type, container, current_user) |       {1, [pistol_ammo_group]} = ammo_group_fixture(pistol_ammo_type, container, current_user) | ||||||
|  |  | ||||||
|       pistol_shot_group = |       pistol_shot_group = | ||||||
|         shot_group_fixture(%{"notes" => "group_three"}, current_user, pistol_ammo_group) |         shot_group_fixture(%{notes: "group_three"}, current_user, pistol_ammo_group) | ||||||
|  |  | ||||||
|       {:ok, index_live, html} = live(conn, Routes.range_index_path(conn, :index)) |       {:ok, index_live, html} = live(conn, Routes.range_index_path(conn, :index)) | ||||||
|  |  | ||||||
| @@ -72,8 +69,8 @@ defmodule CanneryWeb.RangeLiveTest do | |||||||
|  |  | ||||||
|       html = |       html = | ||||||
|         index_live |         index_live | ||||||
|         |> form(~s/form[phx-change="change_type"]/) |         |> form(~s/form[phx-change="change_class"]/) | ||||||
|         |> render_change(ammo_type: %{type: :rifle}) |         |> render_change(ammo_type: %{class: :rifle}) | ||||||
|  |  | ||||||
|       assert html =~ rifle_shot_group.notes |       assert html =~ rifle_shot_group.notes | ||||||
|       refute html =~ shotgun_shot_group.notes |       refute html =~ shotgun_shot_group.notes | ||||||
| @@ -81,8 +78,8 @@ defmodule CanneryWeb.RangeLiveTest do | |||||||
|  |  | ||||||
|       html = |       html = | ||||||
|         index_live |         index_live | ||||||
|         |> form(~s/form[phx-change="change_type"]/) |         |> form(~s/form[phx-change="change_class"]/) | ||||||
|         |> render_change(ammo_type: %{type: :shotgun}) |         |> render_change(ammo_type: %{class: :shotgun}) | ||||||
|  |  | ||||||
|       refute html =~ rifle_shot_group.notes |       refute html =~ rifle_shot_group.notes | ||||||
|       assert html =~ shotgun_shot_group.notes |       assert html =~ shotgun_shot_group.notes | ||||||
| @@ -90,8 +87,8 @@ defmodule CanneryWeb.RangeLiveTest do | |||||||
|  |  | ||||||
|       html = |       html = | ||||||
|         index_live |         index_live | ||||||
|         |> form(~s/form[phx-change="change_type"]/) |         |> form(~s/form[phx-change="change_class"]/) | ||||||
|         |> render_change(ammo_type: %{type: :pistol}) |         |> render_change(ammo_type: %{class: :pistol}) | ||||||
|  |  | ||||||
|       refute html =~ rifle_shot_group.notes |       refute html =~ rifle_shot_group.notes | ||||||
|       refute html =~ shotgun_shot_group.notes |       refute html =~ shotgun_shot_group.notes | ||||||
| @@ -99,8 +96,8 @@ defmodule CanneryWeb.RangeLiveTest do | |||||||
|  |  | ||||||
|       html = |       html = | ||||||
|         index_live |         index_live | ||||||
|         |> form(~s/form[phx-change="change_type"]/) |         |> form(~s/form[phx-change="change_class"]/) | ||||||
|         |> render_change(ammo_type: %{type: :all}) |         |> render_change(ammo_type: %{class: :all}) | ||||||
|  |  | ||||||
|       assert html =~ rifle_shot_group.notes |       assert html =~ rifle_shot_group.notes | ||||||
|       assert html =~ shotgun_shot_group.notes |       assert html =~ shotgun_shot_group.notes | ||||||
| @@ -113,22 +110,20 @@ defmodule CanneryWeb.RangeLiveTest do | |||||||
|       assert html =~ shot_group.notes |       assert html =~ shot_group.notes | ||||||
|  |  | ||||||
|       assert index_live |       assert index_live | ||||||
|              |> form(~s/form[phx-change="search"]/, |              |> form(~s/form[phx-change="search"]/) | ||||||
|                search: %{search_term: shot_group.notes} |              |> render_change(search: %{search_term: shot_group.notes}) =~ shot_group.notes | ||||||
|              ) |  | ||||||
|              |> render_change() =~ shot_group.notes |  | ||||||
|  |  | ||||||
|       assert_patch(index_live, Routes.range_index_path(conn, :search, shot_group.notes)) |       assert_patch(index_live, Routes.range_index_path(conn, :search, shot_group.notes)) | ||||||
|  |  | ||||||
|       refute index_live |       refute index_live | ||||||
|              |> form(~s/form[phx-change="search"]/, search: %{search_term: "something_else"}) |              |> form(~s/form[phx-change="search"]/) | ||||||
|              |> render_change() =~ shot_group.notes |              |> render_change(search: %{search_term: "something_else"}) =~ shot_group.notes | ||||||
|  |  | ||||||
|       assert_patch(index_live, Routes.range_index_path(conn, :search, "something_else")) |       assert_patch(index_live, Routes.range_index_path(conn, :search, "something_else")) | ||||||
|  |  | ||||||
|       assert index_live |       assert index_live | ||||||
|              |> form(~s/form[phx-change="search"]/, search: %{search_term: ""}) |              |> form(~s/form[phx-change="search"]/) | ||||||
|              |> render_change() =~ shot_group.notes |              |> render_change(search: %{search_term: ""}) =~ shot_group.notes | ||||||
|  |  | ||||||
|       assert_patch(index_live, Routes.range_index_path(conn, :index)) |       assert_patch(index_live, Routes.range_index_path(conn, :index)) | ||||||
|     end |     end | ||||||
| @@ -136,22 +131,20 @@ defmodule CanneryWeb.RangeLiveTest do | |||||||
|     test "saves new shot_group", %{conn: conn, ammo_group: ammo_group} do |     test "saves new shot_group", %{conn: conn, ammo_group: ammo_group} do | ||||||
|       {:ok, index_live, _html} = live(conn, Routes.range_index_path(conn, :index)) |       {:ok, index_live, _html} = live(conn, Routes.range_index_path(conn, :index)) | ||||||
|  |  | ||||||
|       assert index_live |> element("a", dgettext("actions", "Record shots")) |> render_click() =~ |       assert index_live |> element("a", "Record shots") |> render_click() =~ "Record shots" | ||||||
|                gettext("Record shots") |  | ||||||
|  |  | ||||||
|       assert_patch(index_live, Routes.range_index_path(conn, :add_shot_group, ammo_group)) |       assert_patch(index_live, Routes.range_index_path(conn, :add_shot_group, ammo_group)) | ||||||
|  |  | ||||||
|       # assert index_live |       assert index_live | ||||||
|       #        |> form("#shot_group-form", shot_group: @invalid_attrs) |              |> form("#shot-group-form") | ||||||
|       #        |> render_change() =~ dgettext("errors", "is invalid") |              |> render_change(shot_group: @invalid_attrs) =~ "can't be blank" | ||||||
|  |  | ||||||
|       {:ok, _view, html} = |       {:ok, _view, html} = | ||||||
|         index_live |         index_live | ||||||
|         |> form("#shot-group-form", shot_group: @create_attrs) |         |> form("#shot-group-form") | ||||||
|         |> render_submit() |         |> render_submit(shot_group: @create_attrs) | ||||||
|         |> follow_redirect(conn, Routes.range_index_path(conn, :index)) |         |> follow_redirect(conn, Routes.range_index_path(conn, :index)) | ||||||
|  |  | ||||||
|       assert html =~ dgettext("prompts", "Shots recorded successfully") |       assert html =~ "Shots recorded successfully" | ||||||
|       assert html =~ "some notes" |       assert html =~ "some notes" | ||||||
|     end |     end | ||||||
|  |  | ||||||
| @@ -160,14 +153,13 @@ defmodule CanneryWeb.RangeLiveTest do | |||||||
|  |  | ||||||
|       assert index_live |       assert index_live | ||||||
|              |> element(~s/a[aria-label="Edit shot record of #{shot_group.count} shots"]/) |              |> element(~s/a[aria-label="Edit shot record of #{shot_group.count} shots"]/) | ||||||
|              |> render_click() =~ |              |> render_click() =~ "Edit Shot Records" | ||||||
|                gettext("Edit Shot Records") |  | ||||||
|  |  | ||||||
|       assert_patch(index_live, Routes.range_index_path(conn, :edit, shot_group)) |       assert_patch(index_live, Routes.range_index_path(conn, :edit, shot_group)) | ||||||
|  |  | ||||||
|       # assert index_live |       assert index_live | ||||||
|       #        |> form("#shot_group-form", shot_group: @invalid_attrs) |              |> form("#shot-group-form") | ||||||
|       #        |> render_change() =~ dgettext("errors", "is invalid") |              |> render_change(shot_group: @invalid_attrs) =~ "can't be blank" | ||||||
|  |  | ||||||
|       {:ok, _view, html} = |       {:ok, _view, html} = | ||||||
|         index_live |         index_live | ||||||
| @@ -175,7 +167,7 @@ defmodule CanneryWeb.RangeLiveTest do | |||||||
|         |> render_submit() |         |> render_submit() | ||||||
|         |> follow_redirect(conn, Routes.range_index_path(conn, :index)) |         |> follow_redirect(conn, Routes.range_index_path(conn, :index)) | ||||||
|  |  | ||||||
|       assert html =~ dgettext("actions", "Shot records updated successfully") |       assert html =~ "Shot records updated successfully" | ||||||
|       assert html =~ "some updated notes" |       assert html =~ "some updated notes" | ||||||
|     end |     end | ||||||
|  |  | ||||||
|   | |||||||
| @@ -5,26 +5,24 @@ defmodule CanneryWeb.TagLiveTest do | |||||||
|  |  | ||||||
|   use CanneryWeb.ConnCase |   use CanneryWeb.ConnCase | ||||||
|   import Phoenix.LiveViewTest |   import Phoenix.LiveViewTest | ||||||
|   import CanneryWeb.Gettext |  | ||||||
|  |  | ||||||
|   @moduletag :tag_live_test |   @moduletag :tag_live_test | ||||||
|  |  | ||||||
|   @create_attrs %{ |   @create_attrs %{ | ||||||
|     "bg_color" => "#100000", |     bg_color: "#100000", | ||||||
|     "name" => "some name", |     name: "some name", | ||||||
|     "text_color" => "#000000" |     text_color: "#000000" | ||||||
|   } |   } | ||||||
|   @update_attrs %{ |   @update_attrs %{ | ||||||
|     "bg_color" => "#100001", |     bg_color: "#100001", | ||||||
|     "name" => "some updated name", |     name: "some updated name", | ||||||
|     "text_color" => "#000001" |     text_color: "#000001" | ||||||
|  |   } | ||||||
|  |   @invalid_attrs %{ | ||||||
|  |     bg_color: nil, | ||||||
|  |     name: nil, | ||||||
|  |     text_color: nil | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   # @invalid_attrs %{ |  | ||||||
|   #   "bg_color" => nil, |  | ||||||
|   #   "name" => nil, |  | ||||||
|   #   "text_color" => nil |  | ||||||
|   # } |  | ||||||
|  |  | ||||||
|   def create_tag(%{current_user: current_user}) do |   def create_tag(%{current_user: current_user}) do | ||||||
|     tag = tag_fixture(current_user) |     tag = tag_fixture(current_user) | ||||||
| @@ -37,7 +35,7 @@ defmodule CanneryWeb.TagLiveTest do | |||||||
|     test "lists all tags", %{conn: conn, tag: tag} do |     test "lists all tags", %{conn: conn, tag: tag} do | ||||||
|       {:ok, _index_live, html} = live(conn, Routes.tag_index_path(conn, :index)) |       {:ok, _index_live, html} = live(conn, Routes.tag_index_path(conn, :index)) | ||||||
|  |  | ||||||
|       assert html =~ gettext("Tags") |       assert html =~ "Tags" | ||||||
|       assert html =~ tag.bg_color |       assert html =~ tag.bg_color | ||||||
|     end |     end | ||||||
|  |  | ||||||
| @@ -47,22 +45,20 @@ defmodule CanneryWeb.TagLiveTest do | |||||||
|       assert html =~ tag.name |       assert html =~ tag.name | ||||||
|  |  | ||||||
|       assert index_live |       assert index_live | ||||||
|              |> form(~s/form[phx-change="search"]/, |              |> form(~s/form[phx-change="search"]/) | ||||||
|                search: %{search_term: tag.name} |              |> render_change(search: %{search_term: tag.name}) =~ tag.name | ||||||
|              ) |  | ||||||
|              |> render_change() =~ tag.name |  | ||||||
|  |  | ||||||
|       assert_patch(index_live, Routes.tag_index_path(conn, :search, tag.name)) |       assert_patch(index_live, Routes.tag_index_path(conn, :search, tag.name)) | ||||||
|  |  | ||||||
|       refute index_live |       refute index_live | ||||||
|              |> form(~s/form[phx-change="search"]/, search: %{search_term: "something_else"}) |              |> form(~s/form[phx-change="search"]/) | ||||||
|              |> render_change() =~ tag.name |              |> render_change(search: %{search_term: "something_else"}) =~ tag.name | ||||||
|  |  | ||||||
|       assert_patch(index_live, Routes.tag_index_path(conn, :search, "something_else")) |       assert_patch(index_live, Routes.tag_index_path(conn, :search, "something_else")) | ||||||
|  |  | ||||||
|       assert index_live |       assert index_live | ||||||
|              |> form(~s/form[phx-change="search"]/, search: %{search_term: ""}) |              |> form(~s/form[phx-change="search"]/) | ||||||
|              |> render_change() =~ tag.name |              |> render_change(search: %{search_term: ""}) =~ tag.name | ||||||
|  |  | ||||||
|       assert_patch(index_live, Routes.tag_index_path(conn, :index)) |       assert_patch(index_live, Routes.tag_index_path(conn, :index)) | ||||||
|     end |     end | ||||||
| @@ -70,22 +66,20 @@ defmodule CanneryWeb.TagLiveTest do | |||||||
|     test "saves new tag", %{conn: conn} do |     test "saves new tag", %{conn: conn} do | ||||||
|       {:ok, index_live, _html} = live(conn, Routes.tag_index_path(conn, :index)) |       {:ok, index_live, _html} = live(conn, Routes.tag_index_path(conn, :index)) | ||||||
|  |  | ||||||
|       assert index_live |> element("a", dgettext("actions", "New Tag")) |> render_click() =~ |       assert index_live |> element("a", "New Tag") |> render_click() =~ "New Tag" | ||||||
|                dgettext("actions", "New Tag") |  | ||||||
|  |  | ||||||
|       assert_patch(index_live, Routes.tag_index_path(conn, :new)) |       assert_patch(index_live, Routes.tag_index_path(conn, :new)) | ||||||
|  |  | ||||||
|       # assert index_live |       assert index_live | ||||||
|       #        |> form("#tag-form", tag: @invalid_attrs) |              |> form("#tag-form") | ||||||
|       #        |> render_change() =~ dgettext("errors", "can't be blank") |              |> render_change(tag: @invalid_attrs) =~ "can't be blank" | ||||||
|  |  | ||||||
|       {:ok, _view, html} = |       {:ok, _view, html} = | ||||||
|         index_live |         index_live | ||||||
|         |> form("#tag-form", tag: @create_attrs) |         |> form("#tag-form") | ||||||
|         |> render_submit() |         |> render_submit(tag: @create_attrs) | ||||||
|         |> follow_redirect(conn, Routes.tag_index_path(conn, :index)) |         |> follow_redirect(conn, Routes.tag_index_path(conn, :index)) | ||||||
|  |  | ||||||
|       assert html =~ dgettext("actions", "%{name} created successfully", name: "some name") |       assert html =~ "some name created successfully" | ||||||
|       assert html =~ "#100000" |       assert html =~ "#100000" | ||||||
|     end |     end | ||||||
|  |  | ||||||
| @@ -93,23 +87,21 @@ defmodule CanneryWeb.TagLiveTest do | |||||||
|       {:ok, index_live, _html} = live(conn, Routes.tag_index_path(conn, :index)) |       {:ok, index_live, _html} = live(conn, Routes.tag_index_path(conn, :index)) | ||||||
|  |  | ||||||
|       assert index_live |> element(~s/a[aria-label="Edit #{tag.name}"]/) |> render_click() =~ |       assert index_live |> element(~s/a[aria-label="Edit #{tag.name}"]/) |> render_click() =~ | ||||||
|                dgettext("actions", "Edit Tag") |                "Edit Tag" | ||||||
|  |  | ||||||
|       assert_patch(index_live, Routes.tag_index_path(conn, :edit, tag)) |       assert_patch(index_live, Routes.tag_index_path(conn, :edit, tag)) | ||||||
|  |  | ||||||
|       # assert index_live |       assert index_live | ||||||
|       #        |> form("#tag-form", tag: @invalid_attrs) |              |> form("#tag-form") | ||||||
|       #        |> render_change() =~ dgettext("errors", "can't be blank") |              |> render_change(tag: @invalid_attrs) =~ "can't be blank" | ||||||
|  |  | ||||||
|       {:ok, _view, html} = |       {:ok, _view, html} = | ||||||
|         index_live |         index_live | ||||||
|         |> form("#tag-form", tag: @update_attrs) |         |> form("#tag-form") | ||||||
|         |> render_submit() |         |> render_submit(tag: @update_attrs) | ||||||
|         |> follow_redirect(conn, Routes.tag_index_path(conn, :index)) |         |> follow_redirect(conn, Routes.tag_index_path(conn, :index)) | ||||||
|  |  | ||||||
|       assert html =~ |       assert html =~ "some updated name updated successfully" | ||||||
|                dgettext("prompts", "%{name} updated successfully", name: "some updated name") |  | ||||||
|  |  | ||||||
|       assert html =~ "#100001" |       assert html =~ "#100001" | ||||||
|     end |     end | ||||||
|  |  | ||||||
|   | |||||||
| @@ -4,19 +4,16 @@ defmodule CanneryWeb.ErrorViewTest do | |||||||
|   """ |   """ | ||||||
|  |  | ||||||
|   use CanneryWeb.ConnCase, async: true |   use CanneryWeb.ConnCase, async: true | ||||||
|   import CanneryWeb.Gettext |  | ||||||
|   # Bring render/3 and render_to_string/3 for testing custom views |   # Bring render/3 and render_to_string/3 for testing custom views | ||||||
|   import Phoenix.View |   import Phoenix.View | ||||||
|  |  | ||||||
|   @moduletag :error_view_test |   @moduletag :error_view_test | ||||||
|  |  | ||||||
|   test "renders 404.html" do |   test "renders 404.html" do | ||||||
|     assert render_to_string(CanneryWeb.ErrorView, "404.html", []) =~ |     assert render_to_string(CanneryWeb.ErrorView, "404.html", []) =~ "Not found" | ||||||
|              dgettext("errors", "Not found") |  | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   test "renders 500.html" do |   test "renders 500.html" do | ||||||
|     assert render_to_string(CanneryWeb.ErrorView, "500.html", []) =~ |     assert render_to_string(CanneryWeb.ErrorView, "500.html", []) =~ "Internal Server Error" | ||||||
|              dgettext("errors", "Internal Server Error") |  | ||||||
|   end |   end | ||||||
| end | end | ||||||
|   | |||||||
| @@ -24,8 +24,8 @@ defmodule Cannery.Fixtures do | |||||||
|   def user_fixture(attrs \\ %{}) do |   def user_fixture(attrs \\ %{}) do | ||||||
|     attrs |     attrs | ||||||
|     |> Enum.into(%{ |     |> Enum.into(%{ | ||||||
|       "email" => unique_user_email(), |       email: unique_user_email(), | ||||||
|       "password" => valid_user_password() |       password: valid_user_password() | ||||||
|     }) |     }) | ||||||
|     |> Accounts.register_user() |     |> Accounts.register_user() | ||||||
|     |> unwrap_ok_tuple() |     |> unwrap_ok_tuple() | ||||||
| @@ -36,8 +36,8 @@ defmodule Cannery.Fixtures do | |||||||
|   def admin_fixture(attrs \\ %{}) do |   def admin_fixture(attrs \\ %{}) do | ||||||
|     attrs |     attrs | ||||||
|     |> Enum.into(%{ |     |> Enum.into(%{ | ||||||
|       "email" => unique_user_email(), |       email: unique_user_email(), | ||||||
|       "password" => valid_user_password() |       password: valid_user_password() | ||||||
|     }) |     }) | ||||||
|     |> Accounts.register_user() |     |> Accounts.register_user() | ||||||
|     |> unwrap_ok_tuple() |     |> unwrap_ok_tuple() | ||||||
| @@ -76,9 +76,9 @@ defmodule Cannery.Fixtures do | |||||||
|   def shot_group_fixture(attrs \\ %{}, %User{} = user, %AmmoGroup{} = ammo_group) do |   def shot_group_fixture(attrs \\ %{}, %User{} = user, %AmmoGroup{} = ammo_group) do | ||||||
|     attrs |     attrs | ||||||
|     |> Enum.into(%{ |     |> Enum.into(%{ | ||||||
|       "count" => 20, |       count: 20, | ||||||
|       "date" => ~N[2022-02-13 03:17:00], |       date: ~N[2022-02-13 03:17:00], | ||||||
|       "notes" => random_string() |       notes: random_string() | ||||||
|     }) |     }) | ||||||
|     |> Cannery.ActivityLog.create_shot_group(user, ammo_group) |     |> Cannery.ActivityLog.create_shot_group(user, ammo_group) | ||||||
|     |> unwrap_ok_tuple() |     |> unwrap_ok_tuple() | ||||||
| @@ -91,7 +91,7 @@ defmodule Cannery.Fixtures do | |||||||
|   @spec container_fixture(attrs :: map(), User.t()) :: Container.t() |   @spec container_fixture(attrs :: map(), User.t()) :: Container.t() | ||||||
|   def container_fixture(attrs \\ %{}, %User{} = user) do |   def container_fixture(attrs \\ %{}, %User{} = user) do | ||||||
|     attrs |     attrs | ||||||
|     |> Enum.into(%{"name" => random_string(), "type" => "Ammo can"}) |     |> Enum.into(%{name: random_string(), type: "Ammo can"}) | ||||||
|     |> Containers.create_container(user) |     |> Containers.create_container(user) | ||||||
|     |> unwrap_ok_tuple() |     |> unwrap_ok_tuple() | ||||||
|   end |   end | ||||||
| @@ -103,7 +103,7 @@ defmodule Cannery.Fixtures do | |||||||
|   @spec ammo_type_fixture(attrs :: map(), User.t()) :: AmmoType.t() |   @spec ammo_type_fixture(attrs :: map(), User.t()) :: AmmoType.t() | ||||||
|   def ammo_type_fixture(attrs \\ %{}, %User{} = user) do |   def ammo_type_fixture(attrs \\ %{}, %User{} = user) do | ||||||
|     attrs |     attrs | ||||||
|     |> Enum.into(%{"name" => random_string(), "type" => "rifle"}) |     |> Enum.into(%{name: random_string(), class: :rifle}) | ||||||
|     |> Ammo.create_ammo_type(user) |     |> Ammo.create_ammo_type(user) | ||||||
|     |> unwrap_ok_tuple() |     |> unwrap_ok_tuple() | ||||||
|   end |   end | ||||||
| @@ -131,10 +131,10 @@ defmodule Cannery.Fixtures do | |||||||
|       ) do |       ) do | ||||||
|     attrs |     attrs | ||||||
|     |> Enum.into(%{ |     |> Enum.into(%{ | ||||||
|       "ammo_type_id" => ammo_type_id, |       ammo_type_id: ammo_type_id, | ||||||
|       "container_id" => container_id, |       container_id: container_id, | ||||||
|       "count" => 20, |       count: 20, | ||||||
|       "purchased_on" => Date.utc_today() |       purchased_on: Date.utc_today() | ||||||
|     }) |     }) | ||||||
|     |> Ammo.create_ammo_groups(multiplier, user) |     |> Ammo.create_ammo_groups(multiplier, user) | ||||||
|     |> unwrap_ok_tuple() |     |> unwrap_ok_tuple() | ||||||
| @@ -148,9 +148,9 @@ defmodule Cannery.Fixtures do | |||||||
|   def tag_fixture(attrs \\ %{}, %User{} = user) do |   def tag_fixture(attrs \\ %{}, %User{} = user) do | ||||||
|     attrs |     attrs | ||||||
|     |> Enum.into(%{ |     |> Enum.into(%{ | ||||||
|       "bg_color" => "#100000", |       bg_color: "#100000", | ||||||
|       "name" => random_string(), |       name: random_string(), | ||||||
|       "text_color" => "#000000" |       text_color: "#000000" | ||||||
|     }) |     }) | ||||||
|     |> Containers.create_tag(user) |     |> Containers.create_tag(user) | ||||||
|     |> unwrap_ok_tuple() |     |> unwrap_ok_tuple() | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user