rename ammo type to type

This commit is contained in:
shibao 2023-03-30 21:53:52 -04:00
parent 98775359af
commit c33f15603b
59 changed files with 1616 additions and 1677 deletions

View File

@ -1,6 +1,7 @@
# v0.9.1
- Rename ammo type's "type" to "class" to avoid confusion
- Fixes ammo type search
- Rename "ammo type" to "type" to avoid confusion
- Fixes type search
- Fixes shot records table disappearing after selecting an empty ammo class
- Code quality improvements

View File

@ -4,7 +4,7 @@ defmodule Cannery.ActivityLog do
"""
import Ecto.Query, warn: false
alias Cannery.Ammo.{AmmoType, Pack}
alias Cannery.Ammo.{Pack, Type}
alias Cannery.{Accounts.User, ActivityLog.ShotRecord, Repo}
alias Ecto.{Multi, Queryable}
@ -23,8 +23,8 @@ defmodule Cannery.ActivityLog do
[%ShotRecord{notes: "Shot some rifle rounds"}, ...]
"""
@spec list_shot_records(AmmoType.class() | :all, User.t()) :: [ShotRecord.t()]
@spec list_shot_records(search :: nil | String.t(), AmmoType.class() | :all, User.t()) ::
@spec list_shot_records(Type.class() | :all, User.t()) :: [ShotRecord.t()]
@spec list_shot_records(search :: nil | String.t(), Type.class() | :all, User.t()) ::
[ShotRecord.t()]
def list_shot_records(search \\ nil, type, %{id: user_id}) do
from(sg in ShotRecord,
@ -32,9 +32,9 @@ defmodule Cannery.ActivityLog do
left_join: ag in Pack,
as: :ag,
on: sg.pack_id == ag.id,
left_join: at in AmmoType,
left_join: at in Type,
as: :at,
on: ag.ammo_type_id == at.id,
on: ag.type_id == at.id,
where: sg.user_id == ^user_id,
distinct: sg.id
)
@ -79,7 +79,7 @@ defmodule Cannery.ActivityLog do
})
end
@spec list_shot_records_filter_type(Queryable.t(), AmmoType.class() | :all) ::
@spec list_shot_records_filter_type(Queryable.t(), Type.class() | :all) ::
Queryable.t()
defp list_shot_records_filter_type(query, :rifle),
do: query |> where([at: at], at.class == :rifle)
@ -347,50 +347,50 @@ defmodule Cannery.ActivityLog do
end
@doc """
Gets the total number of rounds shot for an ammo type
Gets the total number of rounds shot for a type
Raises `Ecto.NoResultsError` if the Ammo type does not exist.
Raises `Ecto.NoResultsError` if the type does not exist.
## Examples
iex> get_used_count_for_ammo_type(123, %User{id: 123})
iex> get_used_count_for_type(123, %User{id: 123})
35
iex> get_used_count_for_ammo_type(456, %User{id: 123})
iex> get_used_count_for_type(456, %User{id: 123})
** (Ecto.NoResultsError)
"""
@spec get_used_count_for_ammo_type(AmmoType.t(), User.t()) :: non_neg_integer()
def get_used_count_for_ammo_type(%AmmoType{id: ammo_type_id} = ammo_type, user) do
[ammo_type]
|> get_used_count_for_ammo_types(user)
|> Map.get(ammo_type_id, 0)
@spec get_used_count_for_type(Type.t(), User.t()) :: non_neg_integer()
def get_used_count_for_type(%Type{id: type_id} = type, user) do
[type]
|> get_used_count_for_types(user)
|> Map.get(type_id, 0)
end
@doc """
Gets the total number of rounds shot for multiple ammo types
Gets the total number of rounds shot for multiple types
## Examples
iex> get_used_count_for_ammo_types(123, %User{id: 123})
iex> get_used_count_for_types(123, %User{id: 123})
35
"""
@spec get_used_count_for_ammo_types([AmmoType.t()], User.t()) ::
%{optional(AmmoType.id()) => non_neg_integer()}
def get_used_count_for_ammo_types(ammo_types, %User{id: user_id}) do
ammo_type_ids =
ammo_types
|> Enum.map(fn %AmmoType{id: ammo_type_id, user_id: ^user_id} -> ammo_type_id end)
@spec get_used_count_for_types([Type.t()], User.t()) ::
%{optional(Type.id()) => non_neg_integer()}
def get_used_count_for_types(types, %User{id: user_id}) do
type_ids =
types
|> Enum.map(fn %Type{id: type_id, user_id: ^user_id} -> type_id end)
Repo.all(
from ag in Pack,
left_join: sg in ShotRecord,
on: ag.id == sg.pack_id,
where: ag.ammo_type_id in ^ammo_type_ids,
where: ag.type_id in ^type_ids,
where: not (sg.count |> is_nil()),
group_by: ag.ammo_type_id,
select: {ag.ammo_type_id, sum(sg.count)}
group_by: ag.type_id,
select: {ag.type_id, sum(sg.count)}
)
|> Map.new()
end

View File

@ -8,46 +8,46 @@ defmodule Cannery.Ammo do
alias Cannery.{Accounts.User, Containers, Repo}
alias Cannery.Containers.{Container, ContainerTag, Tag}
alias Cannery.{ActivityLog, ActivityLog.ShotRecord}
alias Cannery.Ammo.{AmmoType, Pack}
alias Cannery.Ammo.{Pack, Type}
alias Ecto.{Changeset, Queryable}
@pack_create_limit 10_000
@pack_preloads [:ammo_type]
@ammo_type_preloads [:packs]
@pack_preloads [:type]
@type_preloads [:packs]
@doc """
Returns the list of ammo_types.
Returns the list of types.
## Examples
iex> list_ammo_types(%User{id: 123}, :all)
[%AmmoType{}, ...]
iex> list_types(%User{id: 123}, :all)
[%Type{}, ...]
iex> list_ammo_types("cool", %User{id: 123}, :shotgun)
[%AmmoType{name: "My cool ammo type", class: :shotgun}, ...]
iex> list_types("cool", %User{id: 123}, :shotgun)
[%Type{name: "My cool type", class: :shotgun}, ...]
"""
@spec list_ammo_types(User.t(), AmmoType.class() | :all) :: [AmmoType.t()]
@spec list_ammo_types(search :: nil | String.t(), User.t(), AmmoType.class() | :all) ::
[AmmoType.t()]
def list_ammo_types(search \\ nil, user, type)
@spec list_types(User.t(), Type.class() | :all) :: [Type.t()]
@spec list_types(search :: nil | String.t(), User.t(), Type.class() | :all) ::
[Type.t()]
def list_types(search \\ nil, user, type)
def list_ammo_types(search, %{id: user_id}, type) do
from(at in AmmoType,
def list_types(search, %{id: user_id}, type) do
from(at in Type,
as: :at,
where: at.user_id == ^user_id,
preload: ^@ammo_type_preloads
preload: ^@type_preloads
)
|> list_ammo_types_filter_type(type)
|> list_ammo_types_filter_search(search)
|> list_types_filter_type(type)
|> list_types_filter_search(search)
|> Repo.all()
end
@spec list_ammo_types_filter_search(Queryable.t(), search :: String.t() | nil) :: Queryable.t()
defp list_ammo_types_filter_search(query, search) when search in ["", nil],
@spec list_types_filter_search(Queryable.t(), search :: String.t() | nil) :: Queryable.t()
defp list_types_filter_search(query, search) when search in ["", nil],
do: query |> order_by([at: at], at.name)
defp list_ammo_types_filter_search(query, search) when search |> is_binary() do
defp list_types_filter_search(query, search) when search |> is_binary() do
trimmed_search = String.trim(search)
query
@ -72,31 +72,31 @@ defmodule Cannery.Ammo do
)
end
@spec list_ammo_types_filter_type(Queryable.t(), AmmoType.class() | :all) :: Queryable.t()
defp list_ammo_types_filter_type(query, :rifle),
@spec list_types_filter_type(Queryable.t(), Type.class() | :all) :: Queryable.t()
defp list_types_filter_type(query, :rifle),
do: query |> where([at: at], at.class == :rifle)
defp list_ammo_types_filter_type(query, :pistol),
defp list_types_filter_type(query, :pistol),
do: query |> where([at: at], at.class == :pistol)
defp list_ammo_types_filter_type(query, :shotgun),
defp list_types_filter_type(query, :shotgun),
do: query |> where([at: at], at.class == :shotgun)
defp list_ammo_types_filter_type(query, _all), do: query
defp list_types_filter_type(query, _all), do: query
@doc """
Returns a count of ammo_types.
Returns a count of types.
## Examples
iex> get_ammo_types_count!(%User{id: 123})
iex> get_types_count!(%User{id: 123})
3
"""
@spec get_ammo_types_count!(User.t()) :: integer()
def get_ammo_types_count!(%User{id: user_id}) do
@spec get_types_count!(User.t()) :: integer()
def get_types_count!(%User{id: user_id}) do
Repo.one(
from at in AmmoType,
from at in Type,
where: at.user_id == ^user_id,
select: count(at.id),
distinct: true
@ -104,67 +104,67 @@ defmodule Cannery.Ammo do
end
@doc """
Gets a single ammo_type.
Gets a single type.
Raises `Ecto.NoResultsError` if the Ammo type does not exist.
Raises `Ecto.NoResultsError` if the type does not exist.
## Examples
iex> get_ammo_type!(123, %User{id: 123})
%AmmoType{}
iex> get_type!(123, %User{id: 123})
%Type{}
iex> get_ammo_type!(456, %User{id: 123})
iex> get_type!(456, %User{id: 123})
** (Ecto.NoResultsError)
"""
@spec get_ammo_type!(AmmoType.id(), User.t()) :: AmmoType.t()
def get_ammo_type!(id, %User{id: user_id}) do
@spec get_type!(Type.id(), User.t()) :: Type.t()
def get_type!(id, %User{id: user_id}) do
Repo.one!(
from at in AmmoType,
from at in Type,
where: at.id == ^id,
where: at.user_id == ^user_id,
preload: ^@ammo_type_preloads
preload: ^@type_preloads
)
end
@doc """
Gets the average cost of an ammo type from packs with price information.
Gets the average cost of a type from packs with price information.
## Examples
iex> get_average_cost_for_ammo_type(
...> %AmmoType{id: 123, user_id: 456},
iex> get_average_cost_for_type(
...> %Type{id: 123, user_id: 456},
...> %User{id: 456}
...> )
1.50
"""
@spec get_average_cost_for_ammo_type(AmmoType.t(), User.t()) :: float() | nil
def get_average_cost_for_ammo_type(%AmmoType{id: ammo_type_id} = ammo_type, user) do
[ammo_type]
|> get_average_cost_for_ammo_types(user)
|> Map.get(ammo_type_id)
@spec get_average_cost_for_type(Type.t(), User.t()) :: float() | nil
def get_average_cost_for_type(%Type{id: type_id} = type, user) do
[type]
|> get_average_cost_for_types(user)
|> Map.get(type_id)
end
@doc """
Gets the average cost of ammo types from packs with price information
for multiple ammo types.
Gets the average cost of types from packs with price information
for multiple types.
## Examples
iex> get_average_cost_for_ammo_types(
...> [%AmmoType{id: 123, user_id: 456}],
iex> get_average_cost_for_types(
...> [%Type{id: 123, user_id: 456}],
...> %User{id: 456}
...> )
1.50
"""
@spec get_average_cost_for_ammo_types([AmmoType.t()], User.t()) ::
%{optional(AmmoType.id()) => float()}
def get_average_cost_for_ammo_types(ammo_types, %User{id: user_id}) do
ammo_type_ids =
ammo_types
|> Enum.map(fn %AmmoType{id: ammo_type_id, user_id: ^user_id} -> ammo_type_id end)
@spec get_average_cost_for_types([Type.t()], User.t()) ::
%{optional(Type.id()) => float()}
def get_average_cost_for_types(types, %User{id: user_id}) do
type_ids =
types
|> Enum.map(fn %Type{id: type_id, user_id: ^user_id} -> type_id end)
sg_total_query =
from sg in ShotRecord,
@ -177,202 +177,200 @@ defmodule Cannery.Ammo do
as: :pack,
left_join: sg_query in subquery(sg_total_query),
on: ag.id == sg_query.pack_id,
where: ag.ammo_type_id in ^ammo_type_ids,
group_by: ag.ammo_type_id,
where: ag.type_id in ^type_ids,
group_by: ag.type_id,
where: not (ag.price_paid |> is_nil()),
select:
{ag.ammo_type_id, sum(ag.price_paid) / sum(ag.count + coalesce(sg_query.total, 0))}
select: {ag.type_id, sum(ag.price_paid) / sum(ag.count + coalesce(sg_query.total, 0))}
)
|> Map.new()
end
@doc """
Gets the total number of rounds for an ammo type
Gets the total number of rounds for a type
## Examples
iex> get_round_count_for_ammo_type(
...> %AmmoType{id: 123, user_id: 456},
iex> get_round_count_for_type(
...> %Type{id: 123, user_id: 456},
...> %User{id: 456}
...> )
35
"""
@spec get_round_count_for_ammo_type(AmmoType.t(), User.t()) :: non_neg_integer()
def get_round_count_for_ammo_type(%AmmoType{id: ammo_type_id} = ammo_type, user) do
[ammo_type]
|> get_round_count_for_ammo_types(user)
|> Map.get(ammo_type_id, 0)
@spec get_round_count_for_type(Type.t(), User.t()) :: non_neg_integer()
def get_round_count_for_type(%Type{id: type_id} = type, user) do
[type]
|> get_round_count_for_types(user)
|> Map.get(type_id, 0)
end
@doc """
Gets the total number of rounds for multiple ammo types
Gets the total number of rounds for multiple types
## Examples
iex> get_round_count_for_ammo_types(
...> [%AmmoType{id: 123, user_id: 456}],
iex> get_round_count_for_types(
...> [%Type{id: 123, user_id: 456}],
...> %User{id: 456}
...> )
%{123 => 35}
"""
@spec get_round_count_for_ammo_types([AmmoType.t()], User.t()) ::
%{optional(AmmoType.id()) => non_neg_integer()}
def get_round_count_for_ammo_types(ammo_types, %User{id: user_id}) do
ammo_type_ids =
ammo_types
|> Enum.map(fn %AmmoType{id: ammo_type_id, user_id: ^user_id} -> ammo_type_id end)
@spec get_round_count_for_types([Type.t()], User.t()) ::
%{optional(Type.id()) => non_neg_integer()}
def get_round_count_for_types(types, %User{id: user_id}) do
type_ids =
types
|> Enum.map(fn %Type{id: type_id, user_id: ^user_id} -> type_id end)
Repo.all(
from ag in Pack,
where: ag.ammo_type_id in ^ammo_type_ids,
where: ag.type_id in ^type_ids,
where: ag.user_id == ^user_id,
group_by: ag.ammo_type_id,
select: {ag.ammo_type_id, sum(ag.count)}
group_by: ag.type_id,
select: {ag.type_id, sum(ag.count)}
)
|> Map.new()
end
@doc """
Gets the total number of ammo ever bought for an ammo type
Gets the total number of ammo ever bought for a type
## Examples
iex> get_historical_count_for_ammo_type(
...> %AmmoType{id: 123, user_id: 456},
iex> get_historical_count_for_type(
...> %Type{id: 123, user_id: 456},
...> %User{id: 456}
...> )
5
"""
@spec get_historical_count_for_ammo_type(AmmoType.t(), User.t()) :: non_neg_integer()
def get_historical_count_for_ammo_type(%AmmoType{id: ammo_type_id} = ammo_type, user) do
[ammo_type]
|> get_historical_count_for_ammo_types(user)
|> Map.get(ammo_type_id, 0)
@spec get_historical_count_for_type(Type.t(), User.t()) :: non_neg_integer()
def get_historical_count_for_type(%Type{id: type_id} = type, user) do
[type]
|> get_historical_count_for_types(user)
|> Map.get(type_id, 0)
end
@doc """
Gets the total number of ammo ever bought for multiple ammo types
Gets the total number of ammo ever bought for multiple types
## Examples
iex> get_historical_count_for_ammo_types(
...> [%AmmoType{id: 123, user_id: 456}],
iex> get_historical_count_for_types(
...> [%Type{id: 123, user_id: 456}],
...> %User{id: 456}
...> )
%{123 => 5}
"""
@spec get_historical_count_for_ammo_types([AmmoType.t()], User.t()) ::
%{optional(AmmoType.id()) => non_neg_integer()}
def get_historical_count_for_ammo_types(ammo_types, %User{id: user_id} = user) do
used_counts = ammo_types |> ActivityLog.get_used_count_for_ammo_types(user)
round_counts = ammo_types |> get_round_count_for_ammo_types(user)
@spec get_historical_count_for_types([Type.t()], User.t()) ::
%{optional(Type.id()) => non_neg_integer()}
def get_historical_count_for_types(types, %User{id: user_id} = user) do
used_counts = types |> ActivityLog.get_used_count_for_types(user)
round_counts = types |> get_round_count_for_types(user)
ammo_types
|> Enum.filter(fn %AmmoType{id: ammo_type_id, user_id: ^user_id} ->
Map.has_key?(used_counts, ammo_type_id) or Map.has_key?(round_counts, ammo_type_id)
types
|> Enum.filter(fn %Type{id: type_id, user_id: ^user_id} ->
Map.has_key?(used_counts, type_id) or Map.has_key?(round_counts, type_id)
end)
|> Map.new(fn %{id: ammo_type_id} ->
historical_count =
Map.get(used_counts, ammo_type_id, 0) + Map.get(round_counts, ammo_type_id, 0)
|> Map.new(fn %{id: type_id} ->
historical_count = Map.get(used_counts, type_id, 0) + Map.get(round_counts, type_id, 0)
{ammo_type_id, historical_count}
{type_id, historical_count}
end)
end
@doc """
Creates a ammo_type.
Creates a type.
## Examples
iex> create_ammo_type(%{field: value}, %User{id: 123})
{:ok, %AmmoType{}}
iex> create_type(%{field: value}, %User{id: 123})
{:ok, %Type{}}
iex> create_ammo_type(%{field: bad_value}, %User{id: 123})
iex> create_type(%{field: bad_value}, %User{id: 123})
{:error, %Changeset{}}
"""
@spec create_ammo_type(attrs :: map(), User.t()) ::
{:ok, AmmoType.t()} | {:error, AmmoType.changeset()}
def create_ammo_type(attrs \\ %{}, %User{} = user) do
%AmmoType{}
|> AmmoType.create_changeset(user, attrs)
@spec create_type(attrs :: map(), User.t()) ::
{:ok, Type.t()} | {:error, Type.changeset()}
def create_type(attrs \\ %{}, %User{} = user) do
%Type{}
|> Type.create_changeset(user, attrs)
|> Repo.insert()
|> case do
{:ok, ammo_type} -> {:ok, ammo_type |> preload_ammo_type()}
{:ok, type} -> {:ok, type |> preload_type()}
{:error, changeset} -> {:error, changeset}
end
end
@spec preload_ammo_type(AmmoType.t()) :: AmmoType.t()
@spec preload_ammo_type([AmmoType.t()]) :: [AmmoType.t()]
defp preload_ammo_type(ammo_type_or_ammo_types) do
ammo_type_or_ammo_types |> Repo.preload(@ammo_type_preloads)
@spec preload_type(Type.t()) :: Type.t()
@spec preload_type([Type.t()]) :: [Type.t()]
defp preload_type(type_or_types) do
type_or_types |> Repo.preload(@type_preloads)
end
@doc """
Updates a ammo_type.
Updates a type.
## Examples
iex> update_ammo_type(ammo_type, %{field: new_value}, %User{id: 123})
{:ok, %AmmoType{}}
iex> update_type(type, %{field: new_value}, %User{id: 123})
{:ok, %Type{}}
iex> update_ammo_type(ammo_type, %{field: bad_value}, %User{id: 123})
iex> update_type(type, %{field: bad_value}, %User{id: 123})
{:error, %Changeset{}}
"""
@spec update_ammo_type(AmmoType.t(), attrs :: map(), User.t()) ::
{:ok, AmmoType.t()} | {:error, AmmoType.changeset()}
def update_ammo_type(%AmmoType{user_id: user_id} = ammo_type, attrs, %User{id: user_id}) do
ammo_type
|> AmmoType.update_changeset(attrs)
@spec update_type(Type.t(), attrs :: map(), User.t()) ::
{:ok, Type.t()} | {:error, Type.changeset()}
def update_type(%Type{user_id: user_id} = type, attrs, %User{id: user_id}) do
type
|> Type.update_changeset(attrs)
|> Repo.update()
|> case do
{:ok, ammo_type} -> {:ok, ammo_type |> preload_ammo_type()}
{:ok, type} -> {:ok, type |> preload_type()}
{:error, changeset} -> {:error, changeset}
end
end
@doc """
Deletes a ammo_type.
Deletes a type.
## Examples
iex> delete_ammo_type(ammo_type, %User{id: 123})
{:ok, %AmmoType{}}
iex> delete_type(type, %User{id: 123})
{:ok, %Type{}}
iex> delete_ammo_type(ammo_type, %User{id: 123})
iex> delete_type(type, %User{id: 123})
{:error, %Changeset{}}
"""
@spec delete_ammo_type(AmmoType.t(), User.t()) ::
{:ok, AmmoType.t()} | {:error, AmmoType.changeset()}
def delete_ammo_type(%AmmoType{user_id: user_id} = ammo_type, %User{id: user_id}) do
ammo_type
@spec delete_type(Type.t(), User.t()) ::
{:ok, Type.t()} | {:error, Type.changeset()}
def delete_type(%Type{user_id: user_id} = type, %User{id: user_id}) do
type
|> Repo.delete()
|> case do
{:ok, ammo_type} -> {:ok, ammo_type |> preload_ammo_type()}
{:ok, type} -> {:ok, type |> preload_type()}
{:error, changeset} -> {:error, changeset}
end
end
@doc """
Deletes a ammo_type.
Deletes a type.
## Examples
iex> delete_ammo_type!(ammo_type, %User{id: 123})
%AmmoType{}
iex> delete_type!(type, %User{id: 123})
%Type{}
"""
@spec delete_ammo_type!(AmmoType.t(), User.t()) :: AmmoType.t()
def delete_ammo_type!(ammo_type, user) do
{:ok, ammo_type} = delete_ammo_type(ammo_type, user)
ammo_type
@spec delete_type!(Type.t(), User.t()) :: Type.t()
def delete_type!(type, user) do
{:ok, type} = delete_type(type, user)
type
end
@doc """
@ -381,32 +379,32 @@ defmodule Cannery.Ammo do
## Examples
iex> list_packs_for_type(
...> %AmmoType{id: 123, user_id: 456},
...> %Type{id: 123, user_id: 456},
...> %User{id: 456}
...> )
[%Pack{}, ...]
iex> list_packs_for_type(
...> %AmmoType{id: 123, user_id: 456},
...> %Type{id: 123, user_id: 456},
...> %User{id: 456},
...> true
...> )
[%Pack{}, %Pack{}, ...]
"""
@spec list_packs_for_type(AmmoType.t(), User.t()) :: [Pack.t()]
@spec list_packs_for_type(AmmoType.t(), User.t(), show_used :: boolean()) ::
@spec list_packs_for_type(Type.t(), User.t()) :: [Pack.t()]
@spec list_packs_for_type(Type.t(), User.t(), show_used :: boolean()) ::
[Pack.t()]
def list_packs_for_type(ammo_type, user, show_used \\ false)
def list_packs_for_type(type, user, show_used \\ false)
def list_packs_for_type(
%AmmoType{id: ammo_type_id, user_id: user_id},
%Type{id: type_id, user_id: user_id},
%User{id: user_id},
show_used
) do
from(ag in Pack,
as: :ag,
where: ag.ammo_type_id == ^ammo_type_id,
where: ag.type_id == ^type_id,
where: ag.user_id == ^user_id,
preload: ^@pack_preloads
)
@ -443,7 +441,7 @@ defmodule Cannery.Ammo do
"""
@spec list_packs_for_container(
Container.t(),
AmmoType.t() | :all,
Type.t() | :all,
User.t()
) :: [Pack.t()]
def list_packs_for_container(
@ -453,7 +451,7 @@ defmodule Cannery.Ammo do
) do
from(ag in Pack,
as: :ag,
join: at in assoc(ag, :ammo_type),
join: at in assoc(ag, :type),
as: :at,
where: ag.container_id == ^container_id,
where: ag.user_id == ^user_id,
@ -464,7 +462,7 @@ defmodule Cannery.Ammo do
|> Repo.all()
end
@spec list_packs_for_container_filter_type(Queryable.t(), AmmoType.class() | :all) ::
@spec list_packs_for_container_filter_type(Queryable.t(), Type.class() | :all) ::
Queryable.t()
defp list_packs_for_container_filter_type(query, :rifle),
do: query |> where([at: at], at.class == :rifle)
@ -509,71 +507,71 @@ defmodule Cannery.Ammo do
defp get_packs_count_show_used(query, _true), do: query
@doc """
Returns the count of packs for an ammo type.
Returns the count of packs for a type.
## Examples
iex> get_packs_count_for_type(
...> %AmmoType{id: 123, user_id: 456},
...> %Type{id: 123, user_id: 456},
...> %User{id: 456}
...> )
3
iex> get_packs_count_for_type(
...> %AmmoType{id: 123, user_id: 456},
...> %Type{id: 123, user_id: 456},
...> %User{id: 456},
...> true
...> )
5
"""
@spec get_packs_count_for_type(AmmoType.t(), User.t()) :: non_neg_integer()
@spec get_packs_count_for_type(AmmoType.t(), User.t(), show_used :: boolean()) ::
@spec get_packs_count_for_type(Type.t(), User.t()) :: non_neg_integer()
@spec get_packs_count_for_type(Type.t(), User.t(), show_used :: boolean()) ::
non_neg_integer()
def get_packs_count_for_type(
%AmmoType{id: ammo_type_id} = ammo_type,
%Type{id: type_id} = type,
user,
show_used \\ false
) do
[ammo_type]
[type]
|> get_packs_count_for_types(user, show_used)
|> Map.get(ammo_type_id, 0)
|> Map.get(type_id, 0)
end
@doc """
Returns the count of packs for multiple ammo types.
Returns the count of packs for multiple types.
## Examples
iex> get_packs_count_for_types(
...> [%AmmoType{id: 123, user_id: 456}],
...> [%Type{id: 123, user_id: 456}],
...> %User{id: 456}
...> )
3
iex> get_packs_count_for_types(
...> [%AmmoType{id: 123, user_id: 456}],
...> [%Type{id: 123, user_id: 456}],
...> %User{id: 456},
...> true
...> )
5
"""
@spec get_packs_count_for_types([AmmoType.t()], User.t()) ::
%{optional(AmmoType.id()) => non_neg_integer()}
@spec get_packs_count_for_types([AmmoType.t()], User.t(), show_used :: boolean()) ::
%{optional(AmmoType.id()) => non_neg_integer()}
def get_packs_count_for_types(ammo_types, %User{id: user_id}, show_used \\ false) do
ammo_type_ids =
ammo_types
|> Enum.map(fn %AmmoType{id: ammo_type_id, user_id: ^user_id} -> ammo_type_id end)
@spec get_packs_count_for_types([Type.t()], User.t()) ::
%{optional(Type.id()) => non_neg_integer()}
@spec get_packs_count_for_types([Type.t()], User.t(), show_used :: boolean()) ::
%{optional(Type.id()) => non_neg_integer()}
def get_packs_count_for_types(types, %User{id: user_id}, show_used \\ false) do
type_ids =
types
|> Enum.map(fn %Type{id: type_id, user_id: ^user_id} -> type_id end)
from(ag in Pack,
as: :ag,
where: ag.user_id == ^user_id,
where: ag.ammo_type_id in ^ammo_type_ids,
group_by: ag.ammo_type_id,
select: {ag.ammo_type_id, count(ag.id)}
where: ag.type_id in ^type_ids,
group_by: ag.type_id,
select: {ag.type_id, count(ag.id)}
)
|> get_packs_count_for_types_maybe_show_used(show_used)
|> Repo.all()
@ -589,50 +587,50 @@ defmodule Cannery.Ammo do
end
@doc """
Returns the count of used packs for an ammo type.
Returns the count of used packs for a type.
## Examples
iex> get_used_packs_count_for_type(
...> %AmmoType{id: 123, user_id: 456},
...> %Type{id: 123, user_id: 456},
...> %User{id: 456}
...> )
3
"""
@spec get_used_packs_count_for_type(AmmoType.t(), User.t()) :: non_neg_integer()
def get_used_packs_count_for_type(%AmmoType{id: ammo_type_id} = ammo_type, user) do
[ammo_type]
@spec get_used_packs_count_for_type(Type.t(), User.t()) :: non_neg_integer()
def get_used_packs_count_for_type(%Type{id: type_id} = type, user) do
[type]
|> get_used_packs_count_for_types(user)
|> Map.get(ammo_type_id, 0)
|> Map.get(type_id, 0)
end
@doc """
Returns the count of used packs for multiple ammo types.
Returns the count of used packs for multiple types.
## Examples
iex> get_used_packs_count_for_types(
...> [%AmmoType{id: 123, user_id: 456}],
...> [%Type{id: 123, user_id: 456}],
...> %User{id: 456}
...> )
%{123 => 3}
"""
@spec get_used_packs_count_for_types([AmmoType.t()], User.t()) ::
%{optional(AmmoType.id()) => non_neg_integer()}
def get_used_packs_count_for_types(ammo_types, %User{id: user_id}) do
ammo_type_ids =
ammo_types
|> Enum.map(fn %AmmoType{id: ammo_type_id, user_id: ^user_id} -> ammo_type_id end)
@spec get_used_packs_count_for_types([Type.t()], User.t()) ::
%{optional(Type.id()) => non_neg_integer()}
def get_used_packs_count_for_types(types, %User{id: user_id}) do
type_ids =
types
|> Enum.map(fn %Type{id: type_id, user_id: ^user_id} -> type_id end)
Repo.all(
from ag in Pack,
where: ag.user_id == ^user_id,
where: ag.ammo_type_id in ^ammo_type_ids,
where: ag.type_id in ^type_ids,
where: ag.count == 0,
group_by: ag.ammo_type_id,
select: {ag.ammo_type_id, count(ag.id)}
group_by: ag.type_id,
select: {ag.type_id, count(ag.id)}
)
|> Map.new()
end
@ -748,18 +746,18 @@ defmodule Cannery.Ammo do
[%Pack{notes: "My cool pack"}, ...]
"""
@spec list_packs(search :: String.t() | nil, AmmoType.class() | :all, User.t()) ::
@spec list_packs(search :: String.t() | nil, Type.class() | :all, User.t()) ::
[Pack.t()]
@spec list_packs(
search :: nil | String.t(),
AmmoType.class() | :all,
Type.class() | :all,
User.t(),
show_used :: boolean()
) :: [Pack.t()]
def list_packs(search, type, %{id: user_id}, show_used \\ false) do
from(ag in Pack,
as: :ag,
join: at in assoc(ag, :ammo_type),
join: at in assoc(ag, :type),
as: :at,
join: c in Container,
on: ag.container_id == c.id,
@ -781,7 +779,7 @@ defmodule Cannery.Ammo do
|> Repo.all()
end
@spec list_packs_filter_on_type(Queryable.t(), AmmoType.class() | :all) :: Queryable.t()
@spec list_packs_filter_on_type(Queryable.t(), Type.class() | :all) :: Queryable.t()
defp list_packs_filter_on_type(query, :rifle),
do: query |> where([at: at], at.class == :rifle)
@ -1063,13 +1061,13 @@ defmodule Cannery.Ammo do
end
defp do_create_packs(
%{"ammo_type_id" => ammo_type_id, "container_id" => container_id} = attrs,
%{"type_id" => type_id, "container_id" => container_id} = attrs,
multiplier,
user
)
when multiplier >= 1 and
multiplier <= @pack_create_limit and
ammo_type_id |> is_binary() and
type_id |> is_binary() and
container_id |> is_binary() do
now = NaiveDateTime.utc_now() |> NaiveDateTime.truncate(:second)
@ -1077,7 +1075,7 @@ defmodule Cannery.Ammo do
Enum.map(1..multiplier, fn _count ->
%Pack{}
|> Pack.create_changeset(
get_ammo_type!(ammo_type_id, user),
get_type!(type_id, user),
Containers.get_container!(container_id, user),
user,
attrs
@ -1107,15 +1105,15 @@ defmodule Cannery.Ammo do
end
defp do_create_packs(
%{"ammo_type_id" => ammo_type_id, "container_id" => container_id} = attrs,
%{"type_id" => type_id, "container_id" => container_id} = attrs,
_multiplier,
user
)
when is_binary(ammo_type_id) and is_binary(container_id) do
when is_binary(type_id) and is_binary(container_id) do
changeset =
%Pack{}
|> Pack.create_changeset(
get_ammo_type!(ammo_type_id, user),
get_type!(type_id, user),
Containers.get_container!(container_id, user),
user,
attrs

View File

@ -1,4 +1,4 @@
defmodule Cannery.Ammo.AmmoType do
defmodule Cannery.Ammo.Type do
@moduledoc """
An ammunition type.
@ -38,7 +38,7 @@ defmodule Cannery.Ammo.AmmoType do
]}
@primary_key {:id, :binary_id, autogenerate: true}
@foreign_key_type :binary_id
schema "ammo_types" do
schema "types" do
field :name, :string
field :desc, :string
@ -127,9 +127,9 @@ defmodule Cannery.Ammo.AmmoType do
inserted_at: NaiveDateTime.t(),
updated_at: NaiveDateTime.t()
}
@type new_ammo_type :: %__MODULE__{}
@type new_type :: %__MODULE__{}
@type id :: UUID.t()
@type changeset :: Changeset.t(t() | new_ammo_type())
@type changeset :: Changeset.t(t() | new_type())
@type class :: :rifle | :shotgun | :pistol | nil
@spec changeset_fields() :: [atom()]
@ -197,10 +197,10 @@ defmodule Cannery.Ammo.AmmoType do
]
@doc false
@spec create_changeset(new_ammo_type(), User.t(), attrs :: map()) :: changeset()
def create_changeset(ammo_type, %User{id: user_id}, attrs) do
@spec create_changeset(new_type(), User.t(), attrs :: map()) :: changeset()
def create_changeset(type, %User{id: user_id}, attrs) do
changeset =
ammo_type
type
|> change(user_id: user_id)
|> cast(attrs, changeset_fields())
@ -210,10 +210,10 @@ defmodule Cannery.Ammo.AmmoType do
end
@doc false
@spec update_changeset(t() | new_ammo_type(), attrs :: map()) :: changeset()
def update_changeset(ammo_type, attrs) do
@spec update_changeset(t() | new_type(), attrs :: map()) :: changeset()
def update_changeset(type, attrs) do
changeset =
ammo_type
type
|> cast(attrs, changeset_fields())
string_fields()

View File

@ -9,7 +9,7 @@ defmodule Cannery.Ammo.Pack do
use Ecto.Schema
import CanneryWeb.Gettext
import Ecto.Changeset
alias Cannery.Ammo.AmmoType
alias Cannery.Ammo.Type
alias Cannery.{Accounts.User, Containers, Containers.Container}
alias Ecto.{Changeset, UUID}
@ -20,7 +20,7 @@ defmodule Cannery.Ammo.Pack do
:notes,
:price_paid,
:staged,
:ammo_type_id,
:type_id,
:container_id
]}
@primary_key {:id, :binary_id, autogenerate: true}
@ -32,7 +32,7 @@ defmodule Cannery.Ammo.Pack do
field :staged, :boolean, default: false
field :purchased_on, :date
belongs_to :ammo_type, AmmoType
belongs_to :type, Type
field :container_id, :binary_id
field :user_id, :binary_id
@ -46,8 +46,8 @@ defmodule Cannery.Ammo.Pack do
price_paid: float() | nil,
staged: boolean(),
purchased_on: Date.t(),
ammo_type: AmmoType.t() | nil,
ammo_type_id: AmmoType.id(),
type: Type.t() | nil,
type_id: Type.id(),
container_id: Container.id(),
user_id: User.id(),
inserted_at: NaiveDateTime.t(),
@ -60,36 +60,36 @@ defmodule Cannery.Ammo.Pack do
@doc false
@spec create_changeset(
new_pack(),
AmmoType.t() | nil,
Type.t() | nil,
Container.t() | nil,
User.t(),
attrs :: map()
) :: changeset()
def create_changeset(
pack,
%AmmoType{id: ammo_type_id},
%Type{id: type_id},
%Container{id: container_id, user_id: user_id},
%User{id: user_id},
attrs
)
when is_binary(ammo_type_id) and is_binary(container_id) and is_binary(user_id) do
when is_binary(type_id) and is_binary(container_id) and is_binary(user_id) do
pack
|> change(ammo_type_id: ammo_type_id)
|> change(type_id: type_id)
|> change(user_id: user_id)
|> change(container_id: container_id)
|> cast(attrs, [:count, :price_paid, :notes, :staged, :purchased_on])
|> validate_number(:count, greater_than: 0)
|> validate_required([:count, :staged, :purchased_on, :ammo_type_id, :container_id, :user_id])
|> validate_required([:count, :staged, :purchased_on, :type_id, :container_id, :user_id])
end
@doc """
Invalid changeset, used to prompt user to select ammo type and container
Invalid changeset, used to prompt user to select type and container
"""
def create_changeset(pack, _invalid_ammo_type, _invalid_container, _invalid_user, attrs) do
def create_changeset(pack, _invalid_type, _invalid_container, _invalid_user, attrs) do
pack
|> cast(attrs, [:ammo_type_id, :container_id])
|> validate_required([:ammo_type_id, :container_id])
|> add_error(:invalid, dgettext("errors", "Please select an ammo type and container"))
|> cast(attrs, [:type_id, :container_id])
|> validate_required([:type_id, :container_id])
|> add_error(:invalid, dgettext("errors", "Please select a type and container"))
end
@doc false

View File

@ -1,9 +1,9 @@
defmodule CanneryWeb.Components.AmmoTypeTableComponent do
defmodule CanneryWeb.Components.TypeTableComponent do
@moduledoc """
A component that displays a list of ammo type
A component that displays a list of types
"""
use CanneryWeb, :live_component
alias Cannery.{Accounts.User, ActivityLog, Ammo, Ammo.AmmoType}
alias Cannery.{Accounts.User, ActivityLog, Ammo, Ammo.Type}
alias CanneryWeb.Components.TableComponent
alias Ecto.UUID
alias Phoenix.LiveView.{Rendered, Socket}
@ -13,30 +13,30 @@ defmodule CanneryWeb.Components.AmmoTypeTableComponent do
%{
required(:id) => UUID.t(),
required(:current_user) => User.t(),
optional(:class) => AmmoType.class() | nil,
optional(:class) => Type.class() | nil,
optional(:show_used) => boolean(),
optional(:ammo_types) => [AmmoType.t()],
optional(:types) => [Type.t()],
optional(:actions) => Rendered.t(),
optional(any()) => any()
},
Socket.t()
) :: {:ok, Socket.t()}
def update(%{id: _id, ammo_types: _ammo_types, current_user: _current_user} = assigns, socket) do
def update(%{id: _id, types: _types, current_user: _current_user} = assigns, socket) do
socket =
socket
|> assign(assigns)
|> assign_new(:show_used, fn -> false end)
|> assign_new(:class, fn -> :all end)
|> assign_new(:actions, fn -> [] end)
|> display_ammo_types()
|> display_types()
{:ok, socket}
end
defp display_ammo_types(
defp display_types(
%{
assigns: %{
ammo_types: ammo_types,
types: types,
current_user: current_user,
show_used: show_used,
class: class,
@ -92,8 +92,8 @@ defmodule CanneryWeb.Components.AmmoTypeTableComponent do
# remove columns if all values match defaults
default_value = if type == :atom, do: false, else: nil
ammo_types
|> Enum.any?(fn ammo_type -> Map.get(ammo_type, key, default_value) != default_value end)
types
|> Enum.any?(fn type -> Map.get(type, key, default_value) != default_value end)
end)
columns =
@ -152,17 +152,17 @@ defmodule CanneryWeb.Components.AmmoTypeTableComponent do
)
|> TableComponent.maybe_compose_columns(%{label: gettext("Name"), key: :name, type: :name})
round_counts = ammo_types |> Ammo.get_round_count_for_ammo_types(current_user)
packs_count = ammo_types |> Ammo.get_packs_count_for_types(current_user)
average_costs = ammo_types |> Ammo.get_average_cost_for_ammo_types(current_user)
round_counts = types |> Ammo.get_round_count_for_types(current_user)
packs_count = types |> Ammo.get_packs_count_for_types(current_user)
average_costs = types |> Ammo.get_average_cost_for_types(current_user)
[used_counts, historical_round_counts, historical_pack_counts, used_pack_counts] =
if show_used do
[
ammo_types |> ActivityLog.get_used_count_for_ammo_types(current_user),
ammo_types |> Ammo.get_historical_count_for_ammo_types(current_user),
ammo_types |> Ammo.get_packs_count_for_types(current_user, true),
ammo_types |> Ammo.get_used_packs_count_for_types(current_user)
types |> ActivityLog.get_used_count_for_types(current_user),
types |> Ammo.get_historical_count_for_types(current_user),
types |> Ammo.get_packs_count_for_types(current_user, true),
types |> Ammo.get_used_packs_count_for_types(current_user)
]
else
[nil, nil, nil, nil]
@ -181,9 +181,9 @@ defmodule CanneryWeb.Components.AmmoTypeTableComponent do
}
rows =
ammo_types
|> Enum.map(fn ammo_type ->
ammo_type |> get_ammo_type_values(columns, extra_data)
types
|> Enum.map(fn type ->
type |> get_type_values(columns, extra_data)
end)
socket |> assign(columns: columns, rows: rows)
@ -198,92 +198,92 @@ defmodule CanneryWeb.Components.AmmoTypeTableComponent do
"""
end
defp get_ammo_type_values(ammo_type, columns, extra_data) do
defp get_type_values(type, columns, extra_data) do
columns
|> Map.new(fn %{key: key, type: type} ->
{key, get_ammo_type_value(type, key, ammo_type, extra_data)}
|> Map.new(fn %{key: key, type: column_type} ->
{key, get_type_value(column_type, key, type, extra_data)}
end)
end
defp get_ammo_type_value(:atom, key, ammo_type, _other_data),
do: ammo_type |> Map.get(key) |> humanize()
defp get_type_value(:atom, key, type, _other_data),
do: type |> Map.get(key) |> humanize()
defp get_ammo_type_value(:round_count, _key, %{id: ammo_type_id}, %{round_counts: round_counts}),
do: Map.get(round_counts, ammo_type_id, 0)
defp get_type_value(:round_count, _key, %{id: type_id}, %{round_counts: round_counts}),
do: Map.get(round_counts, type_id, 0)
defp get_ammo_type_value(
defp get_type_value(
:historical_round_count,
_key,
%{id: ammo_type_id},
%{id: type_id},
%{historical_round_counts: historical_round_counts}
) do
Map.get(historical_round_counts, ammo_type_id, 0)
Map.get(historical_round_counts, type_id, 0)
end
defp get_ammo_type_value(
defp get_type_value(
:used_round_count,
_key,
%{id: ammo_type_id},
%{id: type_id},
%{used_counts: used_counts}
) do
Map.get(used_counts, ammo_type_id, 0)
Map.get(used_counts, type_id, 0)
end
defp get_ammo_type_value(
defp get_type_value(
:historical_pack_count,
_key,
%{id: ammo_type_id},
%{id: type_id},
%{historical_pack_counts: historical_pack_counts}
) do
Map.get(historical_pack_counts, ammo_type_id, 0)
Map.get(historical_pack_counts, type_id, 0)
end
defp get_ammo_type_value(
defp get_type_value(
:used_pack_count,
_key,
%{id: ammo_type_id},
%{id: type_id},
%{used_pack_counts: used_pack_counts}
) do
Map.get(used_pack_counts, ammo_type_id, 0)
Map.get(used_pack_counts, type_id, 0)
end
defp get_ammo_type_value(:ammo_count, _key, %{id: ammo_type_id}, %{packs_count: packs_count}),
do: Map.get(packs_count, ammo_type_id)
defp get_type_value(:ammo_count, _key, %{id: type_id}, %{packs_count: packs_count}),
do: Map.get(packs_count, type_id)
defp get_ammo_type_value(
defp get_type_value(
:avg_price_paid,
_key,
%{id: ammo_type_id},
%{id: type_id},
%{average_costs: average_costs}
) do
case Map.get(average_costs, ammo_type_id) do
case Map.get(average_costs, type_id) do
nil -> {0, gettext("No cost information")}
count -> {count, gettext("$%{amount}", amount: display_currency(count))}
end
end
defp get_ammo_type_value(:name, _key, %{name: ammo_type_name} = ammo_type, _other_data) do
assigns = %{ammo_type: ammo_type}
defp get_type_value(:name, _key, %{name: type_name} = type, _other_data) do
assigns = %{type: type}
{ammo_type_name,
{type_name,
~H"""
<.link navigate={Routes.ammo_type_show_path(Endpoint, :show, @ammo_type)} class="link">
<%= @ammo_type.name %>
<.link navigate={Routes.type_show_path(Endpoint, :show, @type)} class="link">
<%= @type.name %>
</.link>
"""}
end
defp get_ammo_type_value(:actions, _key, ammo_type, %{actions: actions}) do
assigns = %{actions: actions, ammo_type: ammo_type}
defp get_type_value(:actions, _key, type, %{actions: actions}) do
assigns = %{actions: actions, type: type}
~H"""
<%= render_slot(@actions, @ammo_type) %>
<%= render_slot(@actions, @type) %>
"""
end
defp get_ammo_type_value(nil, _key, _ammo_type, _other_data), do: nil
defp get_type_value(nil, _key, _type, _other_data), do: nil
defp get_ammo_type_value(_other, key, ammo_type, _other_data), do: ammo_type |> Map.get(key)
defp get_type_value(_other, key, type, _other_data), do: type |> Map.get(key)
@spec display_currency(float()) :: String.t()
defp display_currency(float), do: :erlang.float_to_binary(float, decimals: 2)

View File

@ -7,7 +7,7 @@
>
<.link navigate={Routes.pack_show_path(Endpoint, :show, @pack)} class="mb-2 link">
<h1 class="title text-xl title-primary-500">
<%= @pack.ammo_type.name %>
<%= @pack.type.name %>
</h1>
</.link>

View File

@ -44,7 +44,7 @@
</li>
<li class="mx-2 my-1">
<.link
navigate={Routes.ammo_type_index_path(Endpoint, :index)}
navigate={Routes.type_index_path(Endpoint, :index)}
class="text-white hover:underline"
>
<%= gettext("Catalog") %>

View File

@ -16,7 +16,7 @@ defmodule CanneryWeb.Components.PackTableComponent do
required(:current_user) => User.t(),
required(:packs) => [Pack.t()],
required(:show_used) => boolean(),
optional(:ammo_type) => Rendered.t(),
optional(:type) => Rendered.t(),
optional(:range) => Rendered.t(),
optional(:container) => Rendered.t(),
optional(:actions) => Rendered.t(),
@ -31,7 +31,7 @@ defmodule CanneryWeb.Components.PackTableComponent do
socket =
socket
|> assign(assigns)
|> assign_new(:ammo_type, fn -> [] end)
|> assign_new(:type, fn -> [] end)
|> assign_new(:range, fn -> [] end)
|> assign_new(:container, fn -> [] end)
|> assign_new(:actions, fn -> [] end)
@ -45,7 +45,7 @@ defmodule CanneryWeb.Components.PackTableComponent do
assigns: %{
packs: packs,
current_user: current_user,
ammo_type: ammo_type,
type: type,
range: range,
container: container,
actions: actions,
@ -92,8 +92,8 @@ defmodule CanneryWeb.Components.PackTableComponent do
key: :count
})
|> TableComponent.maybe_compose_columns(
%{label: gettext("Ammo type"), key: :ammo_type},
ammo_type != []
%{label: gettext("Type"), key: :type},
type != []
)
containers =
@ -103,7 +103,7 @@ defmodule CanneryWeb.Components.PackTableComponent do
extra_data = %{
current_user: current_user,
ammo_type: ammo_type,
type: type,
columns: columns,
container: container,
containers: containers,
@ -144,15 +144,15 @@ defmodule CanneryWeb.Components.PackTableComponent do
@spec get_value_for_key(atom(), Pack.t(), additional_data :: map()) ::
any() | {any(), Rendered.t()}
defp get_value_for_key(
:ammo_type,
%{ammo_type: %{name: ammo_type_name} = ammo_type},
%{ammo_type: ammo_type_block}
:type,
%{type: %{name: type_name} = type},
%{type: type_block}
) do
assigns = %{ammo_type: ammo_type, ammo_type_block: ammo_type_block}
assigns = %{type: type, type_block: type_block}
{ammo_type_name,
{type_name,
~H"""
<%= render_slot(@ammo_type_block, @ammo_type) %>
<%= render_slot(@type_block, @type) %>
"""}
end

View File

@ -96,10 +96,10 @@ defmodule CanneryWeb.Components.ShotRecordTableComponent do
defp get_row_value(:name, %{pack_id: pack_id}, %{packs: packs}) do
assigns = %{pack: pack = Map.fetch!(packs, pack_id)}
{pack.ammo_type.name,
{pack.type.name,
~H"""
<.link navigate={Routes.pack_show_path(Endpoint, :show, @pack)} class="link">
<%= @pack.ammo_type.name %>
<%= @pack.type.name %>
</.link>
"""}
end

View File

@ -3,27 +3,27 @@ defmodule CanneryWeb.ExportController do
alias Cannery.{ActivityLog, Ammo, Containers}
def export(%{assigns: %{current_user: current_user}} = conn, %{"mode" => "json"}) do
ammo_types = Ammo.list_ammo_types(current_user, :all)
used_counts = ammo_types |> ActivityLog.get_used_count_for_ammo_types(current_user)
round_counts = ammo_types |> Ammo.get_round_count_for_ammo_types(current_user)
pack_counts = ammo_types |> Ammo.get_packs_count_for_types(current_user)
types = Ammo.list_types(current_user, :all)
used_counts = types |> ActivityLog.get_used_count_for_types(current_user)
round_counts = types |> Ammo.get_round_count_for_types(current_user)
pack_counts = types |> Ammo.get_packs_count_for_types(current_user)
total_pack_counts = ammo_types |> Ammo.get_packs_count_for_types(current_user, true)
total_pack_counts = types |> Ammo.get_packs_count_for_types(current_user, true)
average_costs = ammo_types |> Ammo.get_average_cost_for_ammo_types(current_user)
average_costs = types |> Ammo.get_average_cost_for_types(current_user)
ammo_types =
ammo_types
|> Enum.map(fn %{id: ammo_type_id} = ammo_type ->
ammo_type
types =
types
|> Enum.map(fn %{id: type_id} = type ->
type
|> Jason.encode!()
|> Jason.decode!()
|> Map.merge(%{
"average_cost" => Map.get(average_costs, ammo_type_id),
"round_count" => Map.get(round_counts, ammo_type_id, 0),
"used_count" => Map.get(used_counts, ammo_type_id, 0),
"pack_count" => Map.get(pack_counts, ammo_type_id, 0),
"total_pack_count" => Map.get(total_pack_counts, ammo_type_id, 0)
"average_cost" => Map.get(average_costs, type_id),
"round_count" => Map.get(round_counts, type_id, 0),
"used_count" => Map.get(used_counts, type_id, 0),
"pack_count" => Map.get(pack_counts, type_id, 0),
"total_pack_count" => Map.get(total_pack_counts, type_id, 0)
})
end)
@ -66,7 +66,7 @@ defmodule CanneryWeb.ExportController do
json(conn, %{
user: current_user,
ammo_types: ammo_types,
types: types,
packs: packs,
shot_records: shot_records,
containers: containers

View File

@ -1,16 +1,16 @@
defmodule CanneryWeb.AmmoTypeLive.FormComponent do
defmodule CanneryWeb.TypeLive.FormComponent do
@moduledoc """
Livecomponent that can update or create an Cannery.Ammo.AmmoType
Livecomponent that can update or create an Cannery.Ammo.Type
"""
use CanneryWeb, :live_component
alias Cannery.{Accounts.User, Ammo, Ammo.AmmoType}
alias Cannery.{Accounts.User, Ammo, Ammo.Type}
alias Ecto.Changeset
alias Phoenix.LiveView.Socket
@impl true
@spec update(
%{:ammo_type => AmmoType.t(), :current_user => User.t(), optional(any) => any},
%{:type => Type.t(), :current_user => User.t(), optional(any) => any},
Socket.t()
) :: {:ok, Socket.t()}
def update(%{current_user: _current_user} = assigns, socket) do
@ -18,21 +18,21 @@ defmodule CanneryWeb.AmmoTypeLive.FormComponent do
end
@impl true
def handle_event("validate", %{"ammo_type" => ammo_type_params}, socket) do
{:noreply, socket |> assign_changeset(ammo_type_params)}
def handle_event("validate", %{"type" => type_params}, socket) do
{:noreply, socket |> assign_changeset(type_params)}
end
def handle_event(
"save",
%{"ammo_type" => ammo_type_params},
%{"type" => type_params},
%{assigns: %{action: action}} = socket
) do
save_ammo_type(socket, action, ammo_type_params)
save_type(socket, action, type_params)
end
defp assign_changeset(
%{assigns: %{action: action, ammo_type: ammo_type, current_user: user}} = socket,
ammo_type_params
%{assigns: %{action: action, type: type, current_user: user}} = socket,
type_params
) do
changeset_action =
case action do
@ -43,10 +43,10 @@ defmodule CanneryWeb.AmmoTypeLive.FormComponent do
changeset =
case action do
create when create in [:new, :clone] ->
ammo_type |> AmmoType.create_changeset(user, ammo_type_params)
type |> Type.create_changeset(user, type_params)
:edit ->
ammo_type |> AmmoType.update_changeset(ammo_type_params)
type |> Type.update_changeset(type_params)
end
changeset =
@ -58,16 +58,15 @@ defmodule CanneryWeb.AmmoTypeLive.FormComponent do
socket |> assign(changeset: changeset)
end
defp save_ammo_type(
%{assigns: %{ammo_type: ammo_type, current_user: current_user, return_to: return_to}} =
socket,
defp save_type(
%{assigns: %{type: type, current_user: current_user, return_to: return_to}} = socket,
:edit,
ammo_type_params
type_params
) do
socket =
case Ammo.update_ammo_type(ammo_type, ammo_type_params, current_user) do
{:ok, %{name: ammo_type_name}} ->
prompt = dgettext("prompts", "%{name} updated successfully", name: ammo_type_name)
case Ammo.update_type(type, type_params, current_user) do
{:ok, %{name: type_name}} ->
prompt = dgettext("prompts", "%{name} updated successfully", name: type_name)
socket |> put_flash(:info, prompt) |> push_navigate(to: return_to)
{:error, %Changeset{} = changeset} ->
@ -77,16 +76,16 @@ defmodule CanneryWeb.AmmoTypeLive.FormComponent do
{:noreply, socket}
end
defp save_ammo_type(
defp save_type(
%{assigns: %{current_user: current_user, return_to: return_to}} = socket,
action,
ammo_type_params
type_params
)
when action in [:new, :clone] do
socket =
case Ammo.create_ammo_type(ammo_type_params, current_user) do
{:ok, %{name: ammo_type_name}} ->
prompt = dgettext("prompts", "%{name} created successfully", name: ammo_type_name)
case Ammo.create_type(type_params, current_user) do
{:ok, %{name: type_name}} ->
prompt = dgettext("prompts", "%{name} created successfully", name: type_name)
socket |> put_flash(:info, prompt) |> push_navigate(to: return_to)
{:error, %Changeset{} = changeset} ->

View File

@ -5,7 +5,7 @@
<.form
:let={f}
for={@changeset}
id="ammo_type-form"
id="type-form"
phx-target={@myself}
phx-change="validate"
phx-submit="save"
@ -37,7 +37,7 @@
<%= label(f, :desc, gettext("Description"), class: "title text-lg text-primary-600") %>
<%= textarea(f, :desc,
id: "ammo-type-form-desc",
id: "type-form-desc",
class: "text-center col-span-2 input input-primary",
phx_hook: "MaintainAttrs",
phx_update: "ignore"

View File

@ -1,18 +1,18 @@
defmodule CanneryWeb.AmmoTypeLive.Index do
defmodule CanneryWeb.TypeLive.Index do
@moduledoc """
Liveview for showing a Cannery.Ammo.AmmoType index
Liveview for showing a Cannery.Ammo.Type index
"""
use CanneryWeb, :live_view
alias Cannery.{Ammo, Ammo.AmmoType}
alias Cannery.{Ammo, Ammo.Type}
@impl true
def mount(%{"search" => search}, _session, socket) do
{:ok, socket |> assign(class: :all, show_used: false, search: search) |> list_ammo_types()}
{:ok, socket |> assign(class: :all, show_used: false, search: search) |> list_types()}
end
def mount(_params, _session, socket) do
{:ok, socket |> assign(class: :all, show_used: false, search: nil) |> list_ammo_types()}
{:ok, socket |> assign(class: :all, show_used: false, search: nil) |> list_types()}
end
@impl true
@ -21,28 +21,28 @@ defmodule CanneryWeb.AmmoTypeLive.Index do
end
defp apply_action(%{assigns: %{current_user: current_user}} = socket, :edit, %{"id" => id}) do
%{name: ammo_type_name} = ammo_type = Ammo.get_ammo_type!(id, current_user)
%{name: type_name} = type = Ammo.get_type!(id, current_user)
socket
|> assign(
page_title: gettext("Edit %{ammo_type_name}", ammo_type_name: ammo_type_name),
ammo_type: ammo_type
page_title: gettext("Edit %{type_name}", type_name: type_name),
type: type
)
end
defp apply_action(%{assigns: %{current_user: current_user}} = socket, :clone, %{"id" => id}) do
socket
|> assign(
page_title: gettext("New Ammo type"),
ammo_type: %{Ammo.get_ammo_type!(id, current_user) | id: nil}
page_title: gettext("New Type"),
type: %{Ammo.get_type!(id, current_user) | id: nil}
)
end
defp apply_action(socket, :new, _params) do
socket
|> assign(
page_title: gettext("New Ammo type"),
ammo_type: %AmmoType{}
page_title: gettext("New Type"),
type: %Type{}
)
end
@ -51,9 +51,9 @@ defmodule CanneryWeb.AmmoTypeLive.Index do
|> assign(
page_title: gettext("Catalog"),
search: nil,
ammo_type: nil
type: nil
)
|> list_ammo_types()
|> list_types()
end
defp apply_action(socket, :search, %{"search" => search}) do
@ -61,54 +61,54 @@ defmodule CanneryWeb.AmmoTypeLive.Index do
|> assign(
page_title: gettext("Catalog"),
search: search,
ammo_type: nil
type: nil
)
|> list_ammo_types()
|> list_types()
end
@impl true
def handle_event("delete", %{"id" => id}, %{assigns: %{current_user: current_user}} = socket) do
%{name: name} = Ammo.get_ammo_type!(id, current_user) |> Ammo.delete_ammo_type!(current_user)
%{name: name} = Ammo.get_type!(id, current_user) |> Ammo.delete_type!(current_user)
prompt = dgettext("prompts", "%{name} deleted succesfully", name: name)
{:noreply, socket |> put_flash(:info, prompt) |> list_ammo_types()}
{:noreply, socket |> put_flash(:info, prompt) |> list_types()}
end
def handle_event("toggle_show_used", _params, %{assigns: %{show_used: show_used}} = socket) do
{:noreply, socket |> assign(:show_used, !show_used) |> list_ammo_types()}
{:noreply, socket |> assign(:show_used, !show_used) |> list_types()}
end
def handle_event("search", %{"search" => %{"search_term" => ""}}, socket) do
{:noreply, socket |> push_patch(to: Routes.ammo_type_index_path(Endpoint, :index))}
{:noreply, socket |> push_patch(to: Routes.type_index_path(Endpoint, :index))}
end
def handle_event("search", %{"search" => %{"search_term" => search_term}}, socket) do
search_path = Routes.ammo_type_index_path(Endpoint, :search, search_term)
search_path = Routes.type_index_path(Endpoint, :search, search_term)
{:noreply, socket |> push_patch(to: search_path)}
end
def handle_event("change_class", %{"ammo_type" => %{"class" => "rifle"}}, socket) do
{:noreply, socket |> assign(:class, :rifle) |> list_ammo_types()}
def handle_event("change_class", %{"type" => %{"class" => "rifle"}}, socket) do
{:noreply, socket |> assign(:class, :rifle) |> list_types()}
end
def handle_event("change_class", %{"ammo_type" => %{"class" => "shotgun"}}, socket) do
{:noreply, socket |> assign(:class, :shotgun) |> list_ammo_types()}
def handle_event("change_class", %{"type" => %{"class" => "shotgun"}}, socket) do
{:noreply, socket |> assign(:class, :shotgun) |> list_types()}
end
def handle_event("change_class", %{"ammo_type" => %{"class" => "pistol"}}, socket) do
{:noreply, socket |> assign(:class, :pistol) |> list_ammo_types()}
def handle_event("change_class", %{"type" => %{"class" => "pistol"}}, socket) do
{:noreply, socket |> assign(:class, :pistol) |> list_types()}
end
def handle_event("change_class", %{"ammo_type" => %{"class" => _all}}, socket) do
{:noreply, socket |> assign(:class, :all) |> list_ammo_types()}
def handle_event("change_class", %{"type" => %{"class" => _all}}, socket) do
{:noreply, socket |> assign(:class, :all) |> list_types()}
end
defp list_ammo_types(
defp list_types(
%{assigns: %{class: class, search: search, current_user: current_user}} = socket
) do
socket
|> assign(
ammo_types: Ammo.list_ammo_types(search, current_user, class),
ammo_types_count: Ammo.get_ammo_types_count!(current_user)
types: Ammo.list_types(search, current_user, class),
types_count: Ammo.get_types_count!(current_user)
)
end
end

View File

@ -3,25 +3,25 @@
<%= gettext("Catalog") %>
</h1>
<%= if @ammo_types_count == 0 do %>
<%= if @types_count == 0 do %>
<h2 class="title text-xl text-primary-600">
<%= gettext("No Ammo types") %>
<%= gettext("No Types") %>
<%= display_emoji("😔") %>
</h2>
<.link patch={Routes.ammo_type_index_path(Endpoint, :new)} class="btn btn-primary">
<.link patch={Routes.type_index_path(Endpoint, :new)} class="btn btn-primary">
<%= dgettext("actions", "Add your first type!") %>
</.link>
<% else %>
<.link patch={Routes.ammo_type_index_path(Endpoint, :new)} class="btn btn-primary">
<%= dgettext("actions", "New Ammo type") %>
<.link patch={Routes.type_index_path(Endpoint, :new)} class="btn btn-primary">
<%= dgettext("actions", "New Type") %>
</.link>
<div class="w-full flex flex-col sm:flex-row justify-center items-center space-y-4 sm:space-y-0 sm:space-x-4 max-w-2xl">
<.form
:let={f}
for={%{}}
as={:ammo_type}
as={:type}
phx-change="change_class"
phx-submit="change_class"
class="flex items-center"
@ -66,49 +66,43 @@
</.toggle_button>
</div>
<%= if @ammo_types |> Enum.empty?() do %>
<%= if @types |> Enum.empty?() do %>
<h2 class="title text-xl text-primary-600">
<%= gettext("No Ammo types") %>
<%= gettext("No Types") %>
<%= display_emoji("😔") %>
</h2>
<% else %>
<.live_component
module={CanneryWeb.Components.AmmoTypeTableComponent}
id="ammo_types_index_table"
module={CanneryWeb.Components.TypeTableComponent}
id="types_index_table"
action={@live_action}
ammo_types={@ammo_types}
types={@types}
current_user={@current_user}
show_used={@show_used}
class={@class}
>
<:actions :let={ammo_type}>
<:actions :let={type}>
<div class="px-4 py-2 space-x-4 flex justify-center items-center">
<.link
navigate={Routes.ammo_type_show_path(Endpoint, :show, ammo_type)}
navigate={Routes.type_show_path(Endpoint, :show, type)}
class="text-primary-600 link"
aria-label={
dgettext("actions", "View %{ammo_type_name}", ammo_type_name: ammo_type.name)
}
aria-label={dgettext("actions", "View %{type_name}", type_name: type.name)}
>
<i class="fa-fw fa-lg fas fa-eye"></i>
</.link>
<.link
patch={Routes.ammo_type_index_path(Endpoint, :edit, ammo_type)}
patch={Routes.type_index_path(Endpoint, :edit, type)}
class="text-primary-600 link"
aria-label={
dgettext("actions", "Edit %{ammo_type_name}", ammo_type_name: ammo_type.name)
}
aria-label={dgettext("actions", "Edit %{type_name}", type_name: type.name)}
>
<i class="fa-fw fa-lg fas fa-edit"></i>
</.link>
<.link
patch={Routes.ammo_type_index_path(Endpoint, :clone, ammo_type)}
patch={Routes.type_index_path(Endpoint, :clone, type)}
class="text-primary-600 link"
aria-label={
dgettext("actions", "Clone %{ammo_type_name}", ammo_type_name: ammo_type.name)
}
aria-label={dgettext("actions", "Clone %{type_name}", type_name: type.name)}
>
<i class="fa-fw fa-lg fas fa-copy"></i>
</.link>
@ -117,17 +111,15 @@
href="#"
class="text-primary-600 link"
phx-click="delete"
phx-value-id={ammo_type.id}
phx-value-id={type.id}
data-confirm={
dgettext(
"prompts",
"Are you sure you want to delete %{name}? This will delete all %{name} type ammo as well!",
name: ammo_type.name
name: type.name
)
}
aria-label={
dgettext("actions", "Delete %{ammo_type_name}", ammo_type_name: ammo_type.name)
}
aria-label={dgettext("actions", "Delete %{type_name}", type_name: type.name)}
>
<i class="fa-lg fas fa-trash"></i>
</.link>
@ -140,15 +132,15 @@
<.modal
:if={@live_action in [:new, :edit, :clone]}
return_to={Routes.ammo_type_index_path(Endpoint, :index)}
return_to={Routes.type_index_path(Endpoint, :index)}
>
<.live_component
module={CanneryWeb.AmmoTypeLive.FormComponent}
id={@ammo_type.id || :new}
module={CanneryWeb.TypeLive.FormComponent}
id={@type.id || :new}
title={@page_title}
action={@live_action}
ammo_type={@ammo_type}
return_to={Routes.ammo_type_index_path(Endpoint, :index)}
type={@type}
return_to={Routes.type_index_path(Endpoint, :index)}
current_user={@current_user}
}
/>

View File

@ -1,10 +1,10 @@
defmodule CanneryWeb.AmmoTypeLive.Show do
defmodule CanneryWeb.TypeLive.Show do
@moduledoc """
Liveview for showing and editing an Cannery.Ammo.AmmoType
Liveview for showing and editing an Cannery.Ammo.Type
"""
use CanneryWeb, :live_view
alias Cannery.{ActivityLog, Ammo, Ammo.AmmoType, Containers}
alias Cannery.{ActivityLog, Ammo, Ammo.Type, Containers}
alias CanneryWeb.Endpoint
@impl true
@ -13,38 +13,38 @@ defmodule CanneryWeb.AmmoTypeLive.Show do
@impl true
def handle_params(%{"id" => id}, _params, socket) do
{:noreply, socket |> display_ammo_type(id)}
{:noreply, socket |> display_type(id)}
end
@impl true
def handle_event(
"delete",
_params,
%{assigns: %{ammo_type: ammo_type, current_user: current_user}} = socket
%{assigns: %{type: type, current_user: current_user}} = socket
) do
%{name: ammo_type_name} = ammo_type |> Ammo.delete_ammo_type!(current_user)
%{name: type_name} = type |> Ammo.delete_type!(current_user)
prompt = dgettext("prompts", "%{name} deleted succesfully", name: ammo_type_name)
redirect_to = Routes.ammo_type_index_path(socket, :index)
prompt = dgettext("prompts", "%{name} deleted succesfully", name: type_name)
redirect_to = Routes.type_index_path(socket, :index)
{:noreply, socket |> put_flash(:info, prompt) |> push_navigate(to: redirect_to)}
end
def handle_event("toggle_show_used", _params, %{assigns: %{show_used: show_used}} = socket) do
{:noreply, socket |> assign(:show_used, !show_used) |> display_ammo_type()}
{:noreply, socket |> assign(:show_used, !show_used) |> display_type()}
end
def handle_event("toggle_table", _params, %{assigns: %{view_table: view_table}} = socket) do
{:noreply, socket |> assign(:view_table, !view_table)}
end
defp display_ammo_type(
defp display_type(
%{assigns: %{live_action: live_action, current_user: current_user, show_used: show_used}} =
socket,
%AmmoType{name: ammo_type_name} = ammo_type
%Type{name: type_name} = type
) do
custom_fields? =
fields_to_display(ammo_type)
fields_to_display(type)
|> Enum.any?(fn %{key: field, type: type} ->
default_value =
case type do
@ -52,10 +52,10 @@ defmodule CanneryWeb.AmmoTypeLive.Show do
_other_type -> nil
end
ammo_type |> Map.get(field) != default_value
type |> Map.get(field) != default_value
end)
packs = ammo_type |> Ammo.list_packs_for_type(current_user, show_used)
packs = type |> Ammo.list_packs_for_type(current_user, show_used)
[
original_counts,
@ -67,10 +67,10 @@ defmodule CanneryWeb.AmmoTypeLive.Show do
if show_used do
[
packs |> Ammo.get_original_counts(current_user),
ammo_type |> Ammo.get_used_packs_count_for_type(current_user),
ammo_type |> Ammo.get_packs_count_for_type(current_user, true),
ammo_type |> ActivityLog.get_used_count_for_ammo_type(current_user),
ammo_type |> Ammo.get_historical_count_for_ammo_type(current_user)
type |> Ammo.get_used_packs_count_for_type(current_user),
type |> Ammo.get_packs_count_for_type(current_user, true),
type |> ActivityLog.get_used_count_for_type(current_user),
type |> Ammo.get_historical_count_for_type(current_user)
]
else
[nil, nil, nil, nil, nil]
@ -78,8 +78,8 @@ defmodule CanneryWeb.AmmoTypeLive.Show do
page_title =
case live_action do
:show -> ammo_type_name
:edit -> gettext("Edit %{ammo_type_name}", ammo_type_name: ammo_type_name)
:show -> type_name
:edit -> gettext("Edit %{type_name}", type_name: type_name)
end
containers =
@ -90,33 +90,33 @@ defmodule CanneryWeb.AmmoTypeLive.Show do
socket
|> assign(
page_title: page_title,
ammo_type: ammo_type,
type: type,
packs: packs,
containers: containers,
cprs: packs |> Ammo.get_cprs(current_user),
last_used_dates: packs |> ActivityLog.get_last_used_dates(current_user),
avg_cost_per_round: ammo_type |> Ammo.get_average_cost_for_ammo_type(current_user),
rounds: ammo_type |> Ammo.get_round_count_for_ammo_type(current_user),
avg_cost_per_round: type |> Ammo.get_average_cost_for_type(current_user),
rounds: type |> Ammo.get_round_count_for_type(current_user),
original_counts: original_counts,
used_rounds: used_rounds,
historical_round_count: historical_round_count,
packs_count: ammo_type |> Ammo.get_packs_count_for_type(current_user),
packs_count: type |> Ammo.get_packs_count_for_type(current_user),
used_packs_count: used_packs_count,
historical_packs_count: historical_packs_count,
fields_to_display: fields_to_display(ammo_type),
fields_to_display: fields_to_display(type),
custom_fields?: custom_fields?
)
end
defp display_ammo_type(%{assigns: %{current_user: current_user}} = socket, ammo_type_id) do
socket |> display_ammo_type(Ammo.get_ammo_type!(ammo_type_id, current_user))
defp display_type(%{assigns: %{current_user: current_user}} = socket, type_id) do
socket |> display_type(Ammo.get_type!(type_id, current_user))
end
defp display_ammo_type(%{assigns: %{ammo_type: ammo_type}} = socket) do
socket |> display_ammo_type(ammo_type)
defp display_type(%{assigns: %{type: type}} = socket) do
socket |> display_type(type)
end
defp fields_to_display(%AmmoType{class: class}) do
defp fields_to_display(%Type{class: class}) do
[
%{label: gettext("Cartridge:"), key: :cartridge, type: :string},
%{

View File

@ -1,22 +1,22 @@
<div class="space-y-4 flex flex-col justify-center items-center">
<h1 class="title text-2xl title-primary-500">
<%= @ammo_type.name %>
<%= @type.name %>
</h1>
<span
:if={@ammo_type.desc}
:if={@type.desc}
class="max-w-2xl w-full px-8 py-4 rounded-lg
text-center title text-lg
border border-primary-600"
>
<%= @ammo_type.desc %>
<%= @type.desc %>
</span>
<div class="flex space-x-4 justify-center items-center text-primary-600">
<.link
patch={Routes.ammo_type_show_path(Endpoint, :edit, @ammo_type)}
patch={Routes.type_show_path(Endpoint, :edit, @type)}
class="text-primary-600 link"
aria-label={dgettext("actions", "Edit %{ammo_type_name}", ammo_type_name: @ammo_type.name)}
aria-label={dgettext("actions", "Edit %{type_name}", type_name: @type.name)}
>
<i class="fa-fw fa-lg fas fa-edit"></i>
</.link>
@ -29,12 +29,10 @@
dgettext(
"prompts",
"Are you sure you want to delete %{name}? This will delete all %{name} type ammo as well!",
name: @ammo_type.name
name: @type.name
)
}
aria-label={
dgettext("actions", "Delete %{ammo_type_name}", ammo_type_name: @ammo_type.name)
}
aria-label={dgettext("actions", "Delete %{type_name}", type_name: @type.name)}
>
<i class="fa-fw fa-lg fas fa-trash"></i>
</.link>
@ -42,14 +40,14 @@
<hr class="hr" />
<%= if @ammo_type.class || @custom_fields? do %>
<%= if @type.class || @custom_fields? do %>
<div class="grid sm:grid-cols-2 gap-4 text-center justify-center items-center">
<h3 class="title text-lg">
<%= gettext("Class") %>
</h3>
<span class="text-primary-600">
<%= case @ammo_type.class do %>
<%= case @type.class do %>
<% :shotgun -> %>
<%= gettext("Shotgun") %>
<% :rifle -> %>
@ -62,7 +60,7 @@
</span>
<%= for %{label: label, key: key, type: type} <- @fields_to_display do %>
<%= if @ammo_type |> Map.get(key) do %>
<%= if @type |> Map.get(key) do %>
<h3 class="title text-lg">
<%= label %>
</h3>
@ -70,9 +68,9 @@
<span class="text-primary-600">
<%= case type do %>
<% :boolean -> %>
<%= @ammo_type |> Map.get(key) |> humanize() %>
<%= @type |> Map.get(key) |> humanize() %>
<% _ -> %>
<%= @ammo_type |> Map.get(key) %>
<%= @type |> Map.get(key) %>
<% end %>
</span>
<% end %>
@ -140,7 +138,7 @@
</h3>
<span class="text-primary-600">
<.datetime id={"#{@ammo_type.id}-inserted-at"} datetime={@ammo_type.inserted_at} />
<.datetime id={"#{@type.id}-inserted-at"} datetime={@type.inserted_at} />
</span>
<%= if @avg_cost_per_round do %>
@ -184,7 +182,7 @@
<%= if @view_table do %>
<.live_component
module={CanneryWeb.Components.PackTableComponent}
id="ammo-type-show-table"
id="type-show-table"
packs={@packs}
current_user={@current_user}
show_used={@show_used}
@ -228,17 +226,14 @@
</div>
</div>
<.modal
:if={@live_action == :edit}
return_to={Routes.ammo_type_show_path(Endpoint, :show, @ammo_type)}
>
<.modal :if={@live_action == :edit} return_to={Routes.type_show_path(Endpoint, :show, @type)}>
<.live_component
module={CanneryWeb.AmmoTypeLive.FormComponent}
id={@ammo_type.id}
module={CanneryWeb.TypeLive.FormComponent}
id={@type.id}
title={@page_title}
action={@live_action}
ammo_type={@ammo_type}
return_to={Routes.ammo_type_show_path(Endpoint, :show, @ammo_type)}
type={@type}
return_to={Routes.type_show_path(Endpoint, :show, @type)}
current_user={@current_user}
/>
</.modal>

View File

@ -86,19 +86,19 @@ defmodule CanneryWeb.ContainerLive.Show do
{:noreply, socket |> assign(:view_table, !view_table) |> render_container()}
end
def handle_event("change_class", %{"ammo_type" => %{"class" => "rifle"}}, socket) do
def handle_event("change_class", %{"type" => %{"class" => "rifle"}}, socket) do
{:noreply, socket |> assign(:class, :rifle) |> render_container()}
end
def handle_event("change_class", %{"ammo_type" => %{"class" => "shotgun"}}, socket) do
def handle_event("change_class", %{"type" => %{"class" => "shotgun"}}, socket) do
{:noreply, socket |> assign(:class, :shotgun) |> render_container()}
end
def handle_event("change_class", %{"ammo_type" => %{"class" => "pistol"}}, socket) do
def handle_event("change_class", %{"type" => %{"class" => "pistol"}}, socket) do
{:noreply, socket |> assign(:class, :pistol) |> render_container()}
end
def handle_event("change_class", %{"ammo_type" => %{"class" => _all}}, socket) do
def handle_event("change_class", %{"type" => %{"class" => _all}}, socket) do
{:noreply, socket |> assign(:class, :all) |> render_container()}
end

View File

@ -89,7 +89,7 @@
<.form
:let={f}
for={%{}}
as={:ammo_type}
as={:type}
phx-change="change_class"
phx-submit="change_class"
class="flex items-center"
@ -126,16 +126,16 @@
<%= if @view_table do %>
<.live_component
module={CanneryWeb.Components.PackTableComponent}
id="ammo-type-show-table"
id="type-show-table"
packs={@packs}
current_user={@current_user}
show_used={false}
>
<:ammo_type :let={%{name: ammo_type_name} = ammo_type}>
<.link navigate={Routes.ammo_type_show_path(Endpoint, :show, ammo_type)} class="link">
<%= ammo_type_name %>
<:type :let={%{name: type_name} = type}>
<.link navigate={Routes.type_show_path(Endpoint, :show, type)} class="link">
<%= type_name %>
</.link>
</:ammo_type>
</:type>
</.live_component>
<% else %>
<div class="flex flex-wrap justify-center items-stretch">

View File

@ -4,7 +4,7 @@ defmodule CanneryWeb.PackLive.FormComponent do
"""
use CanneryWeb, :live_component
alias Cannery.Ammo.{AmmoType, Pack}
alias Cannery.Ammo.{Pack, Type}
alias Cannery.{Accounts.User, Ammo, Containers, Containers.Container}
alias Ecto.Changeset
alias Phoenix.LiveView.Socket
@ -22,17 +22,17 @@ defmodule CanneryWeb.PackLive.FormComponent do
@spec update(Socket.t()) :: {:ok, Socket.t()}
def update(%{assigns: %{current_user: current_user}} = socket) do
%{assigns: %{ammo_types: ammo_types, containers: containers}} =
%{assigns: %{types: types, containers: containers}} =
socket =
socket
|> assign(:pack_create_limit, @pack_create_limit)
|> assign(:ammo_types, Ammo.list_ammo_types(current_user, :all))
|> assign(:types, Ammo.list_types(current_user, :all))
|> assign_new(:containers, fn -> Containers.list_containers(current_user) end)
params =
if ammo_types |> List.first() |> is_nil(),
if types |> List.first() |> is_nil(),
do: %{},
else: %{} |> Map.put("ammo_type_id", ammo_types |> List.first() |> Map.get(:id))
else: %{} |> Map.put("type_id", types |> List.first() |> Map.get(:id))
params =
if containers |> List.first() |> is_nil(),
@ -62,9 +62,9 @@ defmodule CanneryWeb.PackLive.FormComponent do
containers |> Enum.map(fn %{id: id, name: name} -> {name, id} end)
end
@spec ammo_type_options([AmmoType.t()]) :: [{String.t(), AmmoType.id()}]
defp ammo_type_options(ammo_types) do
ammo_types |> Enum.map(fn %{id: id, name: name} -> {name, id} end)
@spec type_options([Type.t()]) :: [{String.t(), Type.id()}]
defp type_options(types) do
types |> Enum.map(fn %{id: id, name: name} -> {name, id} end)
end
# Save Helpers
@ -83,9 +83,9 @@ defmodule CanneryWeb.PackLive.FormComponent do
changeset =
case default_action do
:insert ->
ammo_type = maybe_get_ammo_type(pack_params, user)
type = maybe_get_type(pack_params, user)
container = maybe_get_container(pack_params, user)
pack |> Pack.create_changeset(ammo_type, container, user, pack_params)
pack |> Pack.create_changeset(type, container, user, pack_params)
:update ->
pack |> Pack.update_changeset(pack_params, user)
@ -107,12 +107,12 @@ defmodule CanneryWeb.PackLive.FormComponent do
defp maybe_get_container(_params_not_found, _user), do: nil
defp maybe_get_ammo_type(%{"ammo_type_id" => ammo_type_id}, user)
when is_binary(ammo_type_id) do
ammo_type_id |> Ammo.get_ammo_type!(user)
defp maybe_get_type(%{"type_id" => type_id}, user)
when is_binary(type_id) do
type_id |> Ammo.get_type!(user)
end
defp maybe_get_ammo_type(_params_not_found, _user), do: nil
defp maybe_get_type(_params_not_found, _user), do: nil
defp save_pack(
%{assigns: %{pack: pack, current_user: current_user, return_to: return_to}} = socket,

View File

@ -19,11 +19,11 @@
<%= changeset_errors(@changeset) %>
</div>
<%= label(f, :ammo_type_id, gettext("Ammo type"), class: "title text-lg text-primary-600") %>
<%= select(f, :ammo_type_id, ammo_type_options(@ammo_types),
<%= label(f, :type_id, gettext("Type"), class: "title text-lg text-primary-600") %>
<%= select(f, :type_id, type_options(@types),
class: "text-center col-span-2 input input-primary"
) %>
<%= error_tag(f, :ammo_type_id, "col-span-3 text-center") %>
<%= error_tag(f, :type_id, "col-span-3 text-center") %>
<%= label(f, :count, gettext("Count"), class: "title text-lg text-primary-600") %>
<%= number_input(f, :count,

View File

@ -122,19 +122,19 @@ defmodule CanneryWeb.PackLive.Index do
{:noreply, socket}
end
def handle_event("change_class", %{"ammo_type" => %{"class" => "rifle"}}, socket) do
def handle_event("change_class", %{"type" => %{"class" => "rifle"}}, socket) do
{:noreply, socket |> assign(:class, :rifle) |> display_packs()}
end
def handle_event("change_class", %{"ammo_type" => %{"class" => "shotgun"}}, socket) do
def handle_event("change_class", %{"type" => %{"class" => "shotgun"}}, socket) do
{:noreply, socket |> assign(:class, :shotgun) |> display_packs()}
end
def handle_event("change_class", %{"ammo_type" => %{"class" => "pistol"}}, socket) do
def handle_event("change_class", %{"type" => %{"class" => "pistol"}}, socket) do
{:noreply, socket |> assign(:class, :pistol) |> display_packs()}
end
def handle_event("change_class", %{"ammo_type" => %{"class" => _all}}, socket) do
def handle_event("change_class", %{"type" => %{"class" => _all}}, socket) do
{:noreply, socket |> assign(:class, :all) |> display_packs()}
end
@ -152,13 +152,13 @@ defmodule CanneryWeb.PackLive.Index do
# prompts
packs_count = Ammo.get_packs_count!(current_user, true)
packs = Ammo.list_packs(search, class, current_user, show_used)
ammo_types_count = Ammo.get_ammo_types_count!(current_user)
types_count = Ammo.get_types_count!(current_user)
containers_count = Containers.get_containers_count!(current_user)
socket
|> assign(
packs: packs,
ammo_types_count: ammo_types_count,
types_count: types_count,
containers_count: containers_count,
packs_count: packs_count
)

View File

@ -14,14 +14,14 @@
<%= dgettext("actions", "add a container first") %>
</.link>
</div>
<% @ammo_types_count == 0 -> %>
<% @types_count == 0 -> %>
<div class="flex justify-center items-center">
<h2 class="m-2 title text-md text-primary-600">
<%= dgettext("prompts", "You'll need to") %>
</h2>
<.link navigate={Routes.ammo_type_index_path(Endpoint, :new)} class="btn btn-primary">
<%= dgettext("actions", "add an ammo type first") %>
<.link navigate={Routes.type_index_path(Endpoint, :new)} class="btn btn-primary">
<%= dgettext("actions", "add a type first") %>
</.link>
</div>
<% @packs_count == 0 -> %>
@ -42,7 +42,7 @@
<.form
:let={f}
for={%{}}
as={:ammo_type}
as={:type}
phx-change="change_class"
phx-submit="change_class"
class="flex items-center"
@ -102,11 +102,11 @@
current_user={@current_user}
show_used={@show_used}
>
<:ammo_type :let={%{name: ammo_type_name} = ammo_type}>
<.link navigate={Routes.ammo_type_show_path(Endpoint, :show, ammo_type)} class="link">
<%= ammo_type_name %>
<:type :let={%{name: type_name} = type}>
<.link navigate={Routes.type_show_path(Endpoint, :show, type)} class="link">
<%= type_name %>
</.link>
</:ammo_type>
</:type>
<:range :let={pack}>
<div class="min-w-20 py-2 px-4 h-full flex flew-wrap justify-center items-center">
<button

View File

@ -1,6 +1,6 @@
<div class="mx-auto space-y-4 max-w-3xl flex flex-col justify-center items-center">
<h1 class="title text-2xl title-primary-500">
<%= @pack.ammo_type.name %>
<%= @pack.type.name %>
</h1>
<div class="space-y-2 flex flex-col justify-center items-center">
@ -49,7 +49,7 @@
<div class="flex flex-col justify-center items-center">
<div class="flex flex-wrap justify-center items-center text-primary-600">
<.link
navigate={Routes.ammo_type_show_path(Endpoint, :show, @pack.ammo_type)}
navigate={Routes.type_show_path(Endpoint, :show, @pack.type)}
class="mx-4 my-2 btn btn-primary"
>
<%= dgettext("actions", "View in Catalog") %>

View File

@ -101,19 +101,19 @@ defmodule CanneryWeb.RangeLive.Index do
{:noreply, socket |> push_patch(to: Routes.range_index_path(Endpoint, :search, search_term))}
end
def handle_event("change_class", %{"ammo_type" => %{"class" => "rifle"}}, socket) do
def handle_event("change_class", %{"type" => %{"class" => "rifle"}}, socket) do
{:noreply, socket |> assign(:class, :rifle) |> display_shot_records()}
end
def handle_event("change_class", %{"ammo_type" => %{"class" => "shotgun"}}, socket) do
def handle_event("change_class", %{"type" => %{"class" => "shotgun"}}, socket) do
{:noreply, socket |> assign(:class, :shotgun) |> display_shot_records()}
end
def handle_event("change_class", %{"ammo_type" => %{"class" => "pistol"}}, socket) do
def handle_event("change_class", %{"type" => %{"class" => "pistol"}}, socket) do
{:noreply, socket |> assign(:class, :pistol) |> display_shot_records()}
end
def handle_event("change_class", %{"ammo_type" => %{"class" => _all}}, socket) do
def handle_event("change_class", %{"type" => %{"class" => _all}}, socket) do
{:noreply, socket |> assign(:class, :all) |> display_shot_records()}
end

View File

@ -78,7 +78,7 @@
<.form
:let={f}
for={%{}}
as={:ammo_type}
as={:type}
phx-change="change_class"
phx-submit="change_class"
class="flex items-center"

View File

@ -69,14 +69,14 @@ defmodule CanneryWeb.Router do
live "/tags/edit/:id", TagLive.Index, :edit
live "/tags/search/:search", TagLive.Index, :search
live "/catalog", AmmoTypeLive.Index, :index
live "/catalog/new", AmmoTypeLive.Index, :new
live "/catalog/clone/:id", AmmoTypeLive.Index, :clone
live "/catalog/edit/:id", AmmoTypeLive.Index, :edit
live "/catalog/search/:search", AmmoTypeLive.Index, :search
live "/catalog", TypeLive.Index, :index
live "/catalog/new", TypeLive.Index, :new
live "/catalog/clone/:id", TypeLive.Index, :clone
live "/catalog/edit/:id", TypeLive.Index, :edit
live "/catalog/search/:search", TypeLive.Index, :search
live "/type/:id", AmmoTypeLive.Show, :show
live "/type/:id/edit", AmmoTypeLive.Show, :edit
live "/type/:id", TypeLive.Show, :show
live "/type/:id/edit", TypeLive.Show, :edit
live "/containers", ContainerLive.Index, :index
live "/containers/new", ContainerLive.Index, :new

View File

@ -82,11 +82,6 @@ msgstr ""
msgid "Make your first tag!"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:17
#, elixir-autogen, elixir-format
msgid "New Ammo type"
msgstr ""
#: lib/cannery_web/live/container_live/index.html.heex:17
#, elixir-autogen, elixir-format
msgid "New Container"
@ -203,11 +198,6 @@ msgstr ""
msgid "View in Catalog"
msgstr ""
#: lib/cannery_web/live/pack_live/index.html.heex:24
#, elixir-autogen, elixir-format
msgid "add an ammo type first"
msgstr ""
#: lib/cannery_web/components/move_pack_component.ex:78
#: lib/cannery_web/live/pack_live/index.html.heex:144
#: lib/cannery_web/live/pack_live/show.html.heex:89
@ -237,11 +227,6 @@ msgstr ""
msgid "Export Data as JSON"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:110
#, elixir-autogen, elixir-format
msgid "Clone %{ammo_type_name}"
msgstr ""
#: lib/cannery_web/live/container_live/index.html.heex:87
#: lib/cannery_web/live/container_live/index.html.heex:145
#, elixir-autogen, elixir-format
@ -253,12 +238,6 @@ msgstr ""
msgid "Copy invite link for %{invite_name}"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:129
#: lib/cannery_web/live/ammo_type_live/show.html.heex:36
#, elixir-autogen, elixir-format
msgid "Delete %{ammo_type_name}"
msgstr ""
#: lib/cannery_web/live/container_live/index.html.heex:104
#: lib/cannery_web/live/container_live/index.html.heex:162
#: lib/cannery_web/live/container_live/show.html.heex:48
@ -276,12 +255,6 @@ msgstr ""
msgid "Delete invite for %{invite_name}"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:100
#: lib/cannery_web/live/ammo_type_live/show.html.heex:19
#, elixir-autogen, elixir-format
msgid "Edit %{ammo_type_name}"
msgstr ""
#: lib/cannery_web/live/container_live/index.html.heex:77
#: lib/cannery_web/live/container_live/index.html.heex:135
#: lib/cannery_web/live/container_live/show.html.heex:35
@ -315,11 +288,6 @@ msgstr ""
msgid "Unstage"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:90
#, elixir-autogen, elixir-format
msgid "View %{ammo_type_name}"
msgstr ""
#: lib/cannery_web/live/pack_live/index.html.heex:174
#, elixir-autogen, elixir-format
msgid "Clone pack of %{pack_count} bullets"
@ -337,7 +305,7 @@ msgstr ""
msgid "Edit pack of %{pack_count} bullets"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/show.html.heex:206
#: lib/cannery_web/live/ammo_type_live/show.html.heex:204
#: lib/cannery_web/live/pack_live/index.html.heex:154
#, elixir-autogen, elixir-format
msgid "View pack of %{pack_count} bullets"
@ -354,3 +322,35 @@ msgstr ""
#, elixir-autogen, elixir-format
msgid "Edit shot record of %{shot_record_count} shots"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:105
#, elixir-autogen, elixir-format
msgid "Clone %{type_name}"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:122
#: lib/cannery_web/live/ammo_type_live/show.html.heex:35
#, elixir-autogen, elixir-format
msgid "Delete %{type_name}"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:97
#: lib/cannery_web/live/ammo_type_live/show.html.heex:19
#, elixir-autogen, elixir-format
msgid "Edit %{type_name}"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:17
#, elixir-autogen, elixir-format
msgid "New Type"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:89
#, elixir-autogen, elixir-format
msgid "View %{type_name}"
msgstr ""
#: lib/cannery_web/live/pack_live/index.html.heex:24
#, elixir-autogen, elixir-format
msgid "add a type first"
msgstr ""

View File

@ -95,11 +95,6 @@ msgstr "Einloggen"
msgid "Make your first tag!"
msgstr "Erstellen Sie ihren ersten Tag!"
#: lib/cannery_web/live/ammo_type_live/index.html.heex:17
#, elixir-autogen, elixir-format
msgid "New Ammo type"
msgstr "Neue Munitionsart"
#: lib/cannery_web/live/container_live/index.html.heex:17
#, elixir-autogen, elixir-format
msgid "New Container"
@ -216,11 +211,6 @@ msgstr "Sprache wechseln"
msgid "View in Catalog"
msgstr ""
#: lib/cannery_web/live/pack_live/index.html.heex:24
#, elixir-autogen, elixir-format
msgid "add an ammo type first"
msgstr ""
#: lib/cannery_web/components/move_pack_component.ex:78
#: lib/cannery_web/live/pack_live/index.html.heex:144
#: lib/cannery_web/live/pack_live/show.html.heex:89
@ -250,11 +240,6 @@ msgstr ""
msgid "Export Data as JSON"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:110
#, elixir-autogen, elixir-format
msgid "Clone %{ammo_type_name}"
msgstr ""
#: lib/cannery_web/live/container_live/index.html.heex:87
#: lib/cannery_web/live/container_live/index.html.heex:145
#, elixir-autogen, elixir-format
@ -266,12 +251,6 @@ msgstr ""
msgid "Copy invite link for %{invite_name}"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:129
#: lib/cannery_web/live/ammo_type_live/show.html.heex:36
#, elixir-autogen, elixir-format
msgid "Delete %{ammo_type_name}"
msgstr ""
#: lib/cannery_web/live/container_live/index.html.heex:104
#: lib/cannery_web/live/container_live/index.html.heex:162
#: lib/cannery_web/live/container_live/show.html.heex:48
@ -289,12 +268,6 @@ msgstr ""
msgid "Delete invite for %{invite_name}"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:100
#: lib/cannery_web/live/ammo_type_live/show.html.heex:19
#, elixir-autogen, elixir-format
msgid "Edit %{ammo_type_name}"
msgstr ""
#: lib/cannery_web/live/container_live/index.html.heex:77
#: lib/cannery_web/live/container_live/index.html.heex:135
#: lib/cannery_web/live/container_live/show.html.heex:35
@ -328,11 +301,6 @@ msgstr ""
msgid "Unstage"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:90
#, elixir-autogen, elixir-format
msgid "View %{ammo_type_name}"
msgstr ""
#: lib/cannery_web/live/pack_live/index.html.heex:174
#, elixir-autogen, elixir-format, fuzzy
msgid "Clone pack of %{pack_count} bullets"
@ -350,7 +318,7 @@ msgstr ""
msgid "Edit pack of %{pack_count} bullets"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/show.html.heex:206
#: lib/cannery_web/live/ammo_type_live/show.html.heex:204
#: lib/cannery_web/live/pack_live/index.html.heex:154
#, elixir-autogen, elixir-format, fuzzy
msgid "View pack of %{pack_count} bullets"
@ -367,3 +335,35 @@ msgstr ""
#, elixir-autogen, elixir-format, fuzzy
msgid "Edit shot record of %{shot_record_count} shots"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:105
#, elixir-autogen, elixir-format, fuzzy
msgid "Clone %{type_name}"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:122
#: lib/cannery_web/live/ammo_type_live/show.html.heex:35
#, elixir-autogen, elixir-format, fuzzy
msgid "Delete %{type_name}"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:97
#: lib/cannery_web/live/ammo_type_live/show.html.heex:19
#, elixir-autogen, elixir-format, fuzzy
msgid "Edit %{type_name}"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:17
#, elixir-autogen, elixir-format, fuzzy
msgid "New Type"
msgstr "Neue Munitionsart"
#: lib/cannery_web/live/ammo_type_live/index.html.heex:89
#, elixir-autogen, elixir-format, fuzzy
msgid "View %{type_name}"
msgstr ""
#: lib/cannery_web/live/pack_live/index.html.heex:24
#, elixir-autogen, elixir-format, fuzzy
msgid "add a type first"
msgstr ""

View File

@ -38,12 +38,6 @@ msgstr "Admins:"
msgid "Ammo"
msgstr "Munition"
#: lib/cannery_web/components/pack_table_component.ex:95
#: lib/cannery_web/live/pack_live/form_component.html.heex:22
#, elixir-autogen, elixir-format
msgid "Ammo type"
msgstr "Munitionsarten"
#: lib/cannery_web/live/tag_live/form_component.html.heex:25
#, elixir-autogen, elixir-format
msgid "Background color"
@ -240,12 +234,6 @@ msgstr "Meine coole Munitionskiste"
msgid "Name"
msgstr "Name"
#: lib/cannery_web/live/ammo_type_live/index.ex:36
#: lib/cannery_web/live/ammo_type_live/index.ex:44
#, elixir-autogen, elixir-format
msgid "New Ammo type"
msgstr "Neuer Munitionstyp"
#: lib/cannery_web/live/container_live/index.ex:32
#: lib/cannery_web/live/container_live/index.ex:39
#, elixir-autogen, elixir-format
@ -267,7 +255,7 @@ msgstr "Neuer Tag"
msgid "No Ammo"
msgstr "Keine Munition"
#: lib/cannery_web/live/ammo_type_live/show.html.heex:180
#: lib/cannery_web/live/ammo_type_live/show.html.heex:178
#, elixir-autogen, elixir-format
msgid "No ammo for this type"
msgstr "Keine Munition dieser Art"
@ -403,7 +391,9 @@ msgstr "Leuchtspur"
#: lib/cannery_web/components/container_table_component.ex:48
#: lib/cannery_web/components/move_pack_component.ex:66
#: lib/cannery_web/components/pack_table_component.ex:95
#: lib/cannery_web/live/container_live/form_component.html.heex:39
#: lib/cannery_web/live/pack_live/form_component.html.heex:22
#, elixir-autogen, elixir-format
msgid "Type"
msgstr "Art"
@ -513,7 +503,7 @@ msgstr "Schießkladde"
#: lib/cannery_web/components/core_components/pack_card.html.heex:47
#: lib/cannery_web/components/pack_table_component.ex:163
#: lib/cannery_web/components/pack_table_component.ex:246
#: lib/cannery_web/live/ammo_type_live/show.html.heex:152
#: lib/cannery_web/live/ammo_type_live/show.html.heex:150
#: lib/cannery_web/live/pack_live/show.html.heex:37
#: lib/cannery_web/live/pack_live/show.html.heex:42
#, elixir-autogen, elixir-format
@ -596,7 +586,7 @@ msgid "Edit %{name} tags"
msgstr "Editiere %{name} Tags"
#: lib/cannery_web/components/core_components/container_card.html.heex:37
#: lib/cannery_web/live/ammo_type_live/show.html.heex:87
#: lib/cannery_web/live/ammo_type_live/show.html.heex:85
#: lib/cannery_web/live/container_live/show.html.heex:27
#, elixir-autogen, elixir-format
msgid "Rounds:"
@ -605,7 +595,7 @@ msgstr "Patronen:"
#: lib/cannery_web/components/ammo_type_table_component.ex:260
#: lib/cannery_web/components/pack_table_component.ex:160
#: lib/cannery_web/components/pack_table_component.ex:242
#: lib/cannery_web/live/ammo_type_live/show.html.heex:156
#: lib/cannery_web/live/ammo_type_live/show.html.heex:154
#, elixir-autogen, elixir-format
msgid "No cost information"
msgstr "Keine Preisinformationen"
@ -676,7 +666,7 @@ msgstr "Schüsse dokumentieren"
msgid "Copies"
msgstr "Kopien"
#: lib/cannery_web/live/ammo_type_live/show.html.heex:139
#: lib/cannery_web/live/ammo_type_live/show.html.heex:137
#, elixir-autogen, elixir-format
msgid "Added on:"
msgstr "Hinzugefügt am:"
@ -756,7 +746,7 @@ msgid "This ammo is not in a container"
msgstr "Diese Munitionsgruppe ist nicht in einem Behälter"
#: lib/cannery_web/components/core_components/container_card.html.heex:32
#: lib/cannery_web/live/ammo_type_live/show.html.heex:113
#: lib/cannery_web/live/ammo_type_live/show.html.heex:111
#: lib/cannery_web/live/container_live/show.html.heex:22
#, elixir-autogen, elixir-format
msgid "Packs:"
@ -784,7 +774,7 @@ msgid "Container:"
msgstr "Behälter"
#: 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:164
#: lib/cannery_web/live/pack_live/index.html.heex:87
#, elixir-autogen, elixir-format
msgid "Show used"
@ -813,7 +803,7 @@ msgstr ""
msgid "Rounds"
msgstr "Patronen:"
#: lib/cannery_web/live/ammo_type_live/show.html.heex:172
#: lib/cannery_web/live/ammo_type_live/show.html.heex:170
#: lib/cannery_web/live/container_live/index.html.heex:40
#: lib/cannery_web/live/container_live/show.html.heex:115
#, elixir-autogen, elixir-format
@ -825,7 +815,7 @@ msgstr ""
msgid "Total ever packs"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/show.html.heex:130
#: lib/cannery_web/live/ammo_type_live/show.html.heex:128
#, elixir-autogen, elixir-format
msgid "Total ever packs:"
msgstr ""
@ -835,7 +825,7 @@ msgstr ""
msgid "Total ever rounds"
msgstr "Summe aller Patronen"
#: lib/cannery_web/live/ammo_type_live/show.html.heex:104
#: lib/cannery_web/live/ammo_type_live/show.html.heex:102
#, elixir-autogen, elixir-format, fuzzy
msgid "Total ever rounds:"
msgstr "Summe abgegebener Schüsse:"
@ -845,7 +835,7 @@ msgstr "Summe abgegebener Schüsse:"
msgid "Used packs"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/show.html.heex:122
#: lib/cannery_web/live/ammo_type_live/show.html.heex:120
#, elixir-autogen, elixir-format
msgid "Used packs:"
msgstr ""
@ -855,7 +845,7 @@ msgstr ""
msgid "Used rounds"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/show.html.heex:96
#: lib/cannery_web/live/ammo_type_live/show.html.heex:94
#, elixir-autogen, elixir-format, fuzzy
msgid "Used rounds:"
msgstr ""
@ -961,17 +951,11 @@ msgid "UPC:"
msgstr "UPC"
#: lib/cannery_web/components/ammo_type_table_component.ex:102
#: lib/cannery_web/live/ammo_type_live/show.html.heex:148
#: lib/cannery_web/live/ammo_type_live/show.html.heex:146
#, elixir-autogen, elixir-format
msgid "Average CPR"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.ex:28
#: lib/cannery_web/live/ammo_type_live/show.ex:82
#, elixir-autogen, elixir-format, fuzzy
msgid "Edit %{ammo_type_name}"
msgstr "%{name} bearbeiten"
#: lib/cannery_web/components/core_components/pack_card.html.heex:17
#: lib/cannery_web/components/pack_table_component.ex:250
#, elixir-autogen, elixir-format
@ -1035,12 +1019,6 @@ msgstr ""
msgid "Edit ammo"
msgstr "Munitionstyp bearbeiten"
#: lib/cannery_web/live/ammo_type_live/index.html.heex:8
#: lib/cannery_web/live/ammo_type_live/index.html.heex:71
#, elixir-autogen, elixir-format, fuzzy
msgid "No Ammo types"
msgstr "Keine Munitionsarten"
#: lib/cannery_web/live/ammo_type_live/index.html.heex:58
#, elixir-autogen, elixir-format
msgid "Search catalog"
@ -1311,14 +1289,14 @@ msgstr ""
msgid "No ammo"
msgstr "Keine Munition"
#: lib/cannery_web/live/ammo_type_live/show.html.heex:60
#: lib/cannery_web/live/ammo_type_live/show.html.heex:58
#, elixir-autogen, elixir-format
msgid "None specified"
msgstr ""
#: 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/show.html.heex:58
#: lib/cannery_web/live/ammo_type_live/show.html.heex:56
#: lib/cannery_web/live/container_live/show.html.heex:106
#: lib/cannery_web/live/pack_live/index.html.heex:61
#: lib/cannery_web/live/range_live/index.html.heex:95
@ -1343,7 +1321,7 @@ msgstr ""
#: 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/show.html.heex:56
#: lib/cannery_web/live/ammo_type_live/show.html.heex:54
#: lib/cannery_web/live/container_live/show.html.heex:104
#: lib/cannery_web/live/pack_live/index.html.heex:59
#: lib/cannery_web/live/range_live/index.html.heex:93
@ -1397,7 +1375,7 @@ msgstr ""
#: 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/show.html.heex:54
#: lib/cannery_web/live/ammo_type_live/show.html.heex:52
#: lib/cannery_web/live/container_live/show.html.heex:105
#: lib/cannery_web/live/pack_live/index.html.heex:60
#: lib/cannery_web/live/range_live/index.html.heex:94
@ -1441,7 +1419,7 @@ msgstr ""
#: lib/cannery_web/components/ammo_type_table_component.ex:150
#: 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/ammo_type_live/show.html.heex:46
#: lib/cannery_web/live/container_live/show.html.heex:97
#: lib/cannery_web/live/pack_live/index.html.heex:50
#: lib/cannery_web/live/range_live/index.html.heex:86
@ -1465,3 +1443,21 @@ msgstr ""
#, elixir-autogen, elixir-format, fuzzy
msgid "Edit Shot Record"
msgstr "Schießkladde editieren"
#: lib/cannery_web/live/ammo_type_live/index.ex:28
#: lib/cannery_web/live/ammo_type_live/show.ex:82
#, elixir-autogen, elixir-format, fuzzy
msgid "Edit %{type_name}"
msgstr "%{name} bearbeiten"
#: lib/cannery_web/live/ammo_type_live/index.ex:36
#: lib/cannery_web/live/ammo_type_live/index.ex:44
#, elixir-autogen, elixir-format, fuzzy
msgid "New Type"
msgstr "Neuer Munitionstyp"
#: lib/cannery_web/live/ammo_type_live/index.html.heex:8
#: lib/cannery_web/live/ammo_type_live/index.html.heex:71
#, elixir-autogen, elixir-format, fuzzy
msgid "No Types"
msgstr "Art"

View File

@ -173,16 +173,11 @@ msgstr ""
"Ungültige Nummer an Kopien. Muss zwischen 1 and %{max} liegen. War "
"%{multiplier}"
#: lib/cannery/ammo.ex:1123
#: lib/cannery/ammo.ex:1121
#, elixir-autogen, elixir-format
msgid "Invalid multiplier"
msgstr ""
#: lib/cannery/ammo/pack.ex:92
#, elixir-autogen, elixir-format
msgid "Please select an ammo type and container"
msgstr ""
#: lib/cannery_web/live/range_live/index.html.heex:74
#, elixir-autogen, elixir-format
msgid "Your browser does not support the canvas element."
@ -212,3 +207,8 @@ msgstr "Anzahl muss weniger als %{count} betragen"
#, elixir-autogen, elixir-format
msgid "can't be blank"
msgstr ""
#: lib/cannery/ammo/pack.ex:92
#, elixir-autogen, elixir-format, fuzzy
msgid "Please select a type and container"
msgstr ""

View File

@ -23,7 +23,7 @@ msgstr ""
## Run "mix gettext.extract" to bring this file up to
## date. Leave "msgstr"s empty as changing them here has no
## effect: edit them in PO (.po) files instead.
#: lib/cannery_web/live/ammo_type_live/form_component.ex:89
#: lib/cannery_web/live/ammo_type_live/form_component.ex:88
#: lib/cannery_web/live/container_live/form_component.ex:89
#: lib/cannery_web/live/invite_live/form_component.ex:80
#: lib/cannery_web/live/tag_live/form_component.ex:78
@ -44,7 +44,7 @@ msgstr "%{name} erfolgreich gelöscht"
msgid "%{name} has been deleted"
msgstr "%{name} wurde gelöscht"
#: lib/cannery_web/live/ammo_type_live/form_component.ex:70
#: lib/cannery_web/live/ammo_type_live/form_component.ex:69
#: lib/cannery_web/live/container_live/form_component.ex:70
#: lib/cannery_web/live/invite_live/form_component.ex:62
#: lib/cannery_web/live/tag_live/form_component.ex:60
@ -257,7 +257,7 @@ msgid_plural "Ammo added successfully"
msgstr[0] "Munitionsgruppe erfolgreich aktualisiert"
msgstr[1] "Munitionsgruppe erfolgreich aktualisiert"
#: lib/cannery_web/live/ammo_type_live/index.html.heex:122
#: lib/cannery_web/live/ammo_type_live/index.html.heex:116
#: lib/cannery_web/live/ammo_type_live/show.html.heex:29
#, elixir-autogen, elixir-format, fuzzy
msgid "Are you sure you want to delete %{name}? This will delete all %{name} type ammo as well!"

View File

@ -34,12 +34,6 @@ msgstr ""
msgid "Ammo"
msgstr ""
#: lib/cannery_web/components/pack_table_component.ex:95
#: lib/cannery_web/live/pack_live/form_component.html.heex:22
#, elixir-autogen, elixir-format
msgid "Ammo type"
msgstr ""
#: lib/cannery_web/live/tag_live/form_component.html.heex:25
#, elixir-autogen, elixir-format
msgid "Background color"
@ -236,12 +230,6 @@ msgstr ""
msgid "Name"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.ex:36
#: lib/cannery_web/live/ammo_type_live/index.ex:44
#, elixir-autogen, elixir-format
msgid "New Ammo type"
msgstr ""
#: lib/cannery_web/live/container_live/index.ex:32
#: lib/cannery_web/live/container_live/index.ex:39
#, elixir-autogen, elixir-format
@ -263,7 +251,7 @@ msgstr ""
msgid "No Ammo"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/show.html.heex:180
#: lib/cannery_web/live/ammo_type_live/show.html.heex:178
#, elixir-autogen, elixir-format
msgid "No ammo for this type"
msgstr ""
@ -397,7 +385,9 @@ msgstr ""
#: lib/cannery_web/components/container_table_component.ex:48
#: lib/cannery_web/components/move_pack_component.ex:66
#: lib/cannery_web/components/pack_table_component.ex:95
#: lib/cannery_web/live/container_live/form_component.html.heex:39
#: lib/cannery_web/live/pack_live/form_component.html.heex:22
#, elixir-autogen, elixir-format
msgid "Type"
msgstr ""
@ -507,7 +497,7 @@ msgstr ""
#: lib/cannery_web/components/core_components/pack_card.html.heex:47
#: lib/cannery_web/components/pack_table_component.ex:163
#: lib/cannery_web/components/pack_table_component.ex:246
#: lib/cannery_web/live/ammo_type_live/show.html.heex:152
#: lib/cannery_web/live/ammo_type_live/show.html.heex:150
#: lib/cannery_web/live/pack_live/show.html.heex:37
#: lib/cannery_web/live/pack_live/show.html.heex:42
#, elixir-autogen, elixir-format
@ -590,7 +580,7 @@ msgid "Edit %{name} tags"
msgstr ""
#: lib/cannery_web/components/core_components/container_card.html.heex:37
#: lib/cannery_web/live/ammo_type_live/show.html.heex:87
#: lib/cannery_web/live/ammo_type_live/show.html.heex:85
#: lib/cannery_web/live/container_live/show.html.heex:27
#, elixir-autogen, elixir-format
msgid "Rounds:"
@ -599,7 +589,7 @@ msgstr ""
#: lib/cannery_web/components/ammo_type_table_component.ex:260
#: lib/cannery_web/components/pack_table_component.ex:160
#: lib/cannery_web/components/pack_table_component.ex:242
#: lib/cannery_web/live/ammo_type_live/show.html.heex:156
#: lib/cannery_web/live/ammo_type_live/show.html.heex:154
#, elixir-autogen, elixir-format
msgid "No cost information"
msgstr ""
@ -670,7 +660,7 @@ msgstr ""
msgid "Copies"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/show.html.heex:139
#: lib/cannery_web/live/ammo_type_live/show.html.heex:137
#, elixir-autogen, elixir-format
msgid "Added on:"
msgstr ""
@ -750,7 +740,7 @@ msgid "This ammo is not in a container"
msgstr ""
#: lib/cannery_web/components/core_components/container_card.html.heex:32
#: lib/cannery_web/live/ammo_type_live/show.html.heex:113
#: lib/cannery_web/live/ammo_type_live/show.html.heex:111
#: lib/cannery_web/live/container_live/show.html.heex:22
#, elixir-autogen, elixir-format
msgid "Packs:"
@ -778,7 +768,7 @@ msgid "Container:"
msgstr ""
#: 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:164
#: lib/cannery_web/live/pack_live/index.html.heex:87
#, elixir-autogen, elixir-format
msgid "Show used"
@ -807,7 +797,7 @@ msgstr ""
msgid "Rounds"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/show.html.heex:172
#: lib/cannery_web/live/ammo_type_live/show.html.heex:170
#: lib/cannery_web/live/container_live/index.html.heex:40
#: lib/cannery_web/live/container_live/show.html.heex:115
#, elixir-autogen, elixir-format
@ -819,7 +809,7 @@ msgstr ""
msgid "Total ever packs"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/show.html.heex:130
#: lib/cannery_web/live/ammo_type_live/show.html.heex:128
#, elixir-autogen, elixir-format
msgid "Total ever packs:"
msgstr ""
@ -829,7 +819,7 @@ msgstr ""
msgid "Total ever rounds"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/show.html.heex:104
#: lib/cannery_web/live/ammo_type_live/show.html.heex:102
#, elixir-autogen, elixir-format
msgid "Total ever rounds:"
msgstr ""
@ -839,7 +829,7 @@ msgstr ""
msgid "Used packs"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/show.html.heex:122
#: lib/cannery_web/live/ammo_type_live/show.html.heex:120
#, elixir-autogen, elixir-format
msgid "Used packs:"
msgstr ""
@ -849,7 +839,7 @@ msgstr ""
msgid "Used rounds"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/show.html.heex:96
#: lib/cannery_web/live/ammo_type_live/show.html.heex:94
#, elixir-autogen, elixir-format
msgid "Used rounds:"
msgstr ""
@ -955,17 +945,11 @@ msgid "UPC:"
msgstr ""
#: lib/cannery_web/components/ammo_type_table_component.ex:102
#: lib/cannery_web/live/ammo_type_live/show.html.heex:148
#: lib/cannery_web/live/ammo_type_live/show.html.heex:146
#, elixir-autogen, elixir-format
msgid "Average CPR"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.ex:28
#: lib/cannery_web/live/ammo_type_live/show.ex:82
#, elixir-autogen, elixir-format
msgid "Edit %{ammo_type_name}"
msgstr ""
#: lib/cannery_web/components/core_components/pack_card.html.heex:17
#: lib/cannery_web/components/pack_table_component.ex:250
#, elixir-autogen, elixir-format
@ -1029,12 +1013,6 @@ msgstr ""
msgid "Edit ammo"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:8
#: lib/cannery_web/live/ammo_type_live/index.html.heex:71
#, elixir-autogen, elixir-format
msgid "No Ammo types"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:58
#, elixir-autogen, elixir-format
msgid "Search catalog"
@ -1294,14 +1272,14 @@ msgstr ""
msgid "No ammo"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/show.html.heex:60
#: lib/cannery_web/live/ammo_type_live/show.html.heex:58
#, elixir-autogen, elixir-format
msgid "None specified"
msgstr ""
#: 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/show.html.heex:58
#: lib/cannery_web/live/ammo_type_live/show.html.heex:56
#: lib/cannery_web/live/container_live/show.html.heex:106
#: lib/cannery_web/live/pack_live/index.html.heex:61
#: lib/cannery_web/live/range_live/index.html.heex:95
@ -1326,7 +1304,7 @@ msgstr ""
#: 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/show.html.heex:56
#: lib/cannery_web/live/ammo_type_live/show.html.heex:54
#: lib/cannery_web/live/container_live/show.html.heex:104
#: lib/cannery_web/live/pack_live/index.html.heex:59
#: lib/cannery_web/live/range_live/index.html.heex:93
@ -1380,7 +1358,7 @@ msgstr ""
#: 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/show.html.heex:54
#: lib/cannery_web/live/ammo_type_live/show.html.heex:52
#: lib/cannery_web/live/container_live/show.html.heex:105
#: lib/cannery_web/live/pack_live/index.html.heex:60
#: lib/cannery_web/live/range_live/index.html.heex:94
@ -1424,7 +1402,7 @@ msgstr ""
#: lib/cannery_web/components/ammo_type_table_component.ex:150
#: 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/ammo_type_live/show.html.heex:46
#: lib/cannery_web/live/container_live/show.html.heex:97
#: lib/cannery_web/live/pack_live/index.html.heex:50
#: lib/cannery_web/live/range_live/index.html.heex:86
@ -1448,3 +1426,21 @@ msgstr ""
#, elixir-autogen, elixir-format
msgid "Edit Shot Record"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.ex:28
#: lib/cannery_web/live/ammo_type_live/show.ex:82
#, elixir-autogen, elixir-format
msgid "Edit %{type_name}"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.ex:36
#: lib/cannery_web/live/ammo_type_live/index.ex:44
#, elixir-autogen, elixir-format
msgid "New Type"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:8
#: lib/cannery_web/live/ammo_type_live/index.html.heex:71
#, elixir-autogen, elixir-format
msgid "No Types"
msgstr ""

View File

@ -82,11 +82,6 @@ msgstr ""
msgid "Make your first tag!"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:17
#, elixir-autogen, elixir-format
msgid "New Ammo type"
msgstr ""
#: lib/cannery_web/live/container_live/index.html.heex:17
#, elixir-autogen, elixir-format
msgid "New Container"
@ -203,11 +198,6 @@ msgstr ""
msgid "View in Catalog"
msgstr ""
#: lib/cannery_web/live/pack_live/index.html.heex:24
#, elixir-autogen, elixir-format
msgid "add an ammo type first"
msgstr ""
#: lib/cannery_web/components/move_pack_component.ex:78
#: lib/cannery_web/live/pack_live/index.html.heex:144
#: lib/cannery_web/live/pack_live/show.html.heex:89
@ -237,11 +227,6 @@ msgstr ""
msgid "Export Data as JSON"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:110
#, elixir-autogen, elixir-format
msgid "Clone %{ammo_type_name}"
msgstr ""
#: lib/cannery_web/live/container_live/index.html.heex:87
#: lib/cannery_web/live/container_live/index.html.heex:145
#, elixir-autogen, elixir-format
@ -253,12 +238,6 @@ msgstr ""
msgid "Copy invite link for %{invite_name}"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:129
#: lib/cannery_web/live/ammo_type_live/show.html.heex:36
#, elixir-autogen, elixir-format
msgid "Delete %{ammo_type_name}"
msgstr ""
#: lib/cannery_web/live/container_live/index.html.heex:104
#: lib/cannery_web/live/container_live/index.html.heex:162
#: lib/cannery_web/live/container_live/show.html.heex:48
@ -276,12 +255,6 @@ msgstr ""
msgid "Delete invite for %{invite_name}"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:100
#: lib/cannery_web/live/ammo_type_live/show.html.heex:19
#, elixir-autogen, elixir-format
msgid "Edit %{ammo_type_name}"
msgstr ""
#: lib/cannery_web/live/container_live/index.html.heex:77
#: lib/cannery_web/live/container_live/index.html.heex:135
#: lib/cannery_web/live/container_live/show.html.heex:35
@ -315,11 +288,6 @@ msgstr ""
msgid "Unstage"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:90
#, elixir-autogen, elixir-format
msgid "View %{ammo_type_name}"
msgstr ""
#: lib/cannery_web/live/pack_live/index.html.heex:174
#, elixir-autogen, elixir-format, fuzzy
msgid "Clone pack of %{pack_count} bullets"
@ -337,7 +305,7 @@ msgstr ""
msgid "Edit pack of %{pack_count} bullets"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/show.html.heex:206
#: lib/cannery_web/live/ammo_type_live/show.html.heex:204
#: lib/cannery_web/live/pack_live/index.html.heex:154
#, elixir-autogen, elixir-format, fuzzy
msgid "View pack of %{pack_count} bullets"
@ -354,3 +322,35 @@ msgstr ""
#, elixir-autogen, elixir-format, fuzzy
msgid "Edit shot record of %{shot_record_count} shots"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:105
#, elixir-autogen, elixir-format, fuzzy
msgid "Clone %{type_name}"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:122
#: lib/cannery_web/live/ammo_type_live/show.html.heex:35
#, elixir-autogen, elixir-format, fuzzy
msgid "Delete %{type_name}"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:97
#: lib/cannery_web/live/ammo_type_live/show.html.heex:19
#, elixir-autogen, elixir-format, fuzzy
msgid "Edit %{type_name}"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:17
#, elixir-autogen, elixir-format, fuzzy
msgid "New Type"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:89
#, elixir-autogen, elixir-format, fuzzy
msgid "View %{type_name}"
msgstr ""
#: lib/cannery_web/live/pack_live/index.html.heex:24
#, elixir-autogen, elixir-format, fuzzy
msgid "add a type first"
msgstr ""

View File

@ -34,12 +34,6 @@ msgstr ""
msgid "Ammo"
msgstr ""
#: lib/cannery_web/components/pack_table_component.ex:95
#: lib/cannery_web/live/pack_live/form_component.html.heex:22
#, elixir-autogen, elixir-format
msgid "Ammo type"
msgstr ""
#: lib/cannery_web/live/tag_live/form_component.html.heex:25
#, elixir-autogen, elixir-format
msgid "Background color"
@ -236,12 +230,6 @@ msgstr ""
msgid "Name"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.ex:36
#: lib/cannery_web/live/ammo_type_live/index.ex:44
#, elixir-autogen, elixir-format
msgid "New Ammo type"
msgstr ""
#: lib/cannery_web/live/container_live/index.ex:32
#: lib/cannery_web/live/container_live/index.ex:39
#, elixir-autogen, elixir-format
@ -263,7 +251,7 @@ msgstr ""
msgid "No Ammo"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/show.html.heex:180
#: lib/cannery_web/live/ammo_type_live/show.html.heex:178
#, elixir-autogen, elixir-format
msgid "No ammo for this type"
msgstr ""
@ -397,7 +385,9 @@ msgstr ""
#: lib/cannery_web/components/container_table_component.ex:48
#: lib/cannery_web/components/move_pack_component.ex:66
#: lib/cannery_web/components/pack_table_component.ex:95
#: lib/cannery_web/live/container_live/form_component.html.heex:39
#: lib/cannery_web/live/pack_live/form_component.html.heex:22
#, elixir-autogen, elixir-format
msgid "Type"
msgstr ""
@ -507,7 +497,7 @@ msgstr ""
#: lib/cannery_web/components/core_components/pack_card.html.heex:47
#: lib/cannery_web/components/pack_table_component.ex:163
#: lib/cannery_web/components/pack_table_component.ex:246
#: lib/cannery_web/live/ammo_type_live/show.html.heex:152
#: lib/cannery_web/live/ammo_type_live/show.html.heex:150
#: lib/cannery_web/live/pack_live/show.html.heex:37
#: lib/cannery_web/live/pack_live/show.html.heex:42
#, elixir-autogen, elixir-format
@ -590,7 +580,7 @@ msgid "Edit %{name} tags"
msgstr ""
#: lib/cannery_web/components/core_components/container_card.html.heex:37
#: lib/cannery_web/live/ammo_type_live/show.html.heex:87
#: lib/cannery_web/live/ammo_type_live/show.html.heex:85
#: lib/cannery_web/live/container_live/show.html.heex:27
#, elixir-autogen, elixir-format, fuzzy
msgid "Rounds:"
@ -599,7 +589,7 @@ msgstr ""
#: lib/cannery_web/components/ammo_type_table_component.ex:260
#: lib/cannery_web/components/pack_table_component.ex:160
#: lib/cannery_web/components/pack_table_component.ex:242
#: lib/cannery_web/live/ammo_type_live/show.html.heex:156
#: lib/cannery_web/live/ammo_type_live/show.html.heex:154
#, elixir-autogen, elixir-format
msgid "No cost information"
msgstr ""
@ -670,7 +660,7 @@ msgstr ""
msgid "Copies"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/show.html.heex:139
#: lib/cannery_web/live/ammo_type_live/show.html.heex:137
#, elixir-autogen, elixir-format
msgid "Added on:"
msgstr ""
@ -750,7 +740,7 @@ msgid "This ammo is not in a container"
msgstr ""
#: lib/cannery_web/components/core_components/container_card.html.heex:32
#: lib/cannery_web/live/ammo_type_live/show.html.heex:113
#: lib/cannery_web/live/ammo_type_live/show.html.heex:111
#: lib/cannery_web/live/container_live/show.html.heex:22
#, elixir-autogen, elixir-format
msgid "Packs:"
@ -778,7 +768,7 @@ msgid "Container:"
msgstr ""
#: 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:164
#: lib/cannery_web/live/pack_live/index.html.heex:87
#, elixir-autogen, elixir-format
msgid "Show used"
@ -807,7 +797,7 @@ msgstr ""
msgid "Rounds"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/show.html.heex:172
#: lib/cannery_web/live/ammo_type_live/show.html.heex:170
#: lib/cannery_web/live/container_live/index.html.heex:40
#: lib/cannery_web/live/container_live/show.html.heex:115
#, elixir-autogen, elixir-format
@ -819,7 +809,7 @@ msgstr ""
msgid "Total ever packs"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/show.html.heex:130
#: lib/cannery_web/live/ammo_type_live/show.html.heex:128
#, elixir-autogen, elixir-format
msgid "Total ever packs:"
msgstr ""
@ -829,7 +819,7 @@ msgstr ""
msgid "Total ever rounds"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/show.html.heex:104
#: lib/cannery_web/live/ammo_type_live/show.html.heex:102
#, elixir-autogen, elixir-format, fuzzy
msgid "Total ever rounds:"
msgstr ""
@ -839,7 +829,7 @@ msgstr ""
msgid "Used packs"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/show.html.heex:122
#: lib/cannery_web/live/ammo_type_live/show.html.heex:120
#, elixir-autogen, elixir-format
msgid "Used packs:"
msgstr ""
@ -849,7 +839,7 @@ msgstr ""
msgid "Used rounds"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/show.html.heex:96
#: lib/cannery_web/live/ammo_type_live/show.html.heex:94
#, elixir-autogen, elixir-format, fuzzy
msgid "Used rounds:"
msgstr ""
@ -955,17 +945,11 @@ msgid "UPC:"
msgstr ""
#: lib/cannery_web/components/ammo_type_table_component.ex:102
#: lib/cannery_web/live/ammo_type_live/show.html.heex:148
#: lib/cannery_web/live/ammo_type_live/show.html.heex:146
#, elixir-autogen, elixir-format
msgid "Average CPR"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.ex:28
#: lib/cannery_web/live/ammo_type_live/show.ex:82
#, elixir-autogen, elixir-format, fuzzy
msgid "Edit %{ammo_type_name}"
msgstr ""
#: lib/cannery_web/components/core_components/pack_card.html.heex:17
#: lib/cannery_web/components/pack_table_component.ex:250
#, elixir-autogen, elixir-format
@ -1029,12 +1013,6 @@ msgstr ""
msgid "Edit ammo"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:8
#: lib/cannery_web/live/ammo_type_live/index.html.heex:71
#, elixir-autogen, elixir-format, fuzzy
msgid "No Ammo types"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:58
#, elixir-autogen, elixir-format
msgid "Search catalog"
@ -1294,14 +1272,14 @@ msgstr ""
msgid "No ammo"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/show.html.heex:60
#: lib/cannery_web/live/ammo_type_live/show.html.heex:58
#, elixir-autogen, elixir-format
msgid "None specified"
msgstr ""
#: 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/show.html.heex:58
#: lib/cannery_web/live/ammo_type_live/show.html.heex:56
#: lib/cannery_web/live/container_live/show.html.heex:106
#: lib/cannery_web/live/pack_live/index.html.heex:61
#: lib/cannery_web/live/range_live/index.html.heex:95
@ -1326,7 +1304,7 @@ msgstr ""
#: 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/show.html.heex:56
#: lib/cannery_web/live/ammo_type_live/show.html.heex:54
#: lib/cannery_web/live/container_live/show.html.heex:104
#: lib/cannery_web/live/pack_live/index.html.heex:59
#: lib/cannery_web/live/range_live/index.html.heex:93
@ -1380,7 +1358,7 @@ msgstr ""
#: 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/show.html.heex:54
#: lib/cannery_web/live/ammo_type_live/show.html.heex:52
#: lib/cannery_web/live/container_live/show.html.heex:105
#: lib/cannery_web/live/pack_live/index.html.heex:60
#: lib/cannery_web/live/range_live/index.html.heex:94
@ -1424,7 +1402,7 @@ msgstr ""
#: lib/cannery_web/components/ammo_type_table_component.ex:150
#: 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/ammo_type_live/show.html.heex:46
#: lib/cannery_web/live/container_live/show.html.heex:97
#: lib/cannery_web/live/pack_live/index.html.heex:50
#: lib/cannery_web/live/range_live/index.html.heex:86
@ -1448,3 +1426,21 @@ msgstr ""
#, elixir-autogen, elixir-format, fuzzy
msgid "Edit Shot Record"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.ex:28
#: lib/cannery_web/live/ammo_type_live/show.ex:82
#, elixir-autogen, elixir-format, fuzzy
msgid "Edit %{type_name}"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.ex:36
#: lib/cannery_web/live/ammo_type_live/index.ex:44
#, elixir-autogen, elixir-format, fuzzy
msgid "New Type"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:8
#: lib/cannery_web/live/ammo_type_live/index.html.heex:71
#, elixir-autogen, elixir-format, fuzzy
msgid "No Types"
msgstr ""

View File

@ -156,16 +156,11 @@ msgstr ""
msgid "Invalid number of copies, must be between 1 and %{max}. Was %{multiplier}"
msgstr ""
#: lib/cannery/ammo.ex:1123
#: lib/cannery/ammo.ex:1121
#, elixir-autogen, elixir-format
msgid "Invalid multiplier"
msgstr ""
#: lib/cannery/ammo/pack.ex:92
#, elixir-autogen, elixir-format
msgid "Please select an ammo type and container"
msgstr ""
#: lib/cannery_web/live/range_live/index.html.heex:74
#, elixir-autogen, elixir-format
msgid "Your browser does not support the canvas element."
@ -195,3 +190,8 @@ msgstr ""
#, elixir-autogen, elixir-format
msgid "can't be blank"
msgstr ""
#: lib/cannery/ammo/pack.ex:92
#, elixir-autogen, elixir-format, fuzzy
msgid "Please select a type and container"
msgstr ""

View File

@ -10,7 +10,7 @@ msgid ""
msgstr ""
"Language: en\n"
#: lib/cannery_web/live/ammo_type_live/form_component.ex:89
#: lib/cannery_web/live/ammo_type_live/form_component.ex:88
#: lib/cannery_web/live/container_live/form_component.ex:89
#: lib/cannery_web/live/invite_live/form_component.ex:80
#: lib/cannery_web/live/tag_live/form_component.ex:78
@ -31,7 +31,7 @@ msgstr ""
msgid "%{name} has been deleted"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/form_component.ex:70
#: lib/cannery_web/live/ammo_type_live/form_component.ex:69
#: lib/cannery_web/live/container_live/form_component.ex:70
#: lib/cannery_web/live/invite_live/form_component.ex:62
#: lib/cannery_web/live/tag_live/form_component.ex:60
@ -236,7 +236,7 @@ msgid_plural "Ammo added successfully"
msgstr[0] ""
msgstr[1] ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:122
#: lib/cannery_web/live/ammo_type_live/index.html.heex:116
#: lib/cannery_web/live/ammo_type_live/show.html.heex:29
#, elixir-autogen, elixir-format, fuzzy
msgid "Are you sure you want to delete %{name}? This will delete all %{name} type ammo as well!"

View File

@ -155,16 +155,11 @@ msgstr ""
msgid "Invalid number of copies, must be between 1 and %{max}. Was %{multiplier}"
msgstr ""
#: lib/cannery/ammo.ex:1123
#: lib/cannery/ammo.ex:1121
#, elixir-autogen, elixir-format
msgid "Invalid multiplier"
msgstr ""
#: lib/cannery/ammo/pack.ex:92
#, elixir-autogen, elixir-format
msgid "Please select an ammo type and container"
msgstr ""
#: lib/cannery_web/live/range_live/index.html.heex:74
#, elixir-autogen, elixir-format
msgid "Your browser does not support the canvas element."
@ -194,3 +189,8 @@ msgstr ""
#, elixir-autogen, elixir-format
msgid "can't be blank"
msgstr ""
#: lib/cannery/ammo/pack.ex:92
#, elixir-autogen, elixir-format
msgid "Please select a type and container"
msgstr ""

View File

@ -95,11 +95,6 @@ msgstr "Entrar"
msgid "Make your first tag!"
msgstr "¡Aplica tu primera etiqueta!"
#: lib/cannery_web/live/ammo_type_live/index.html.heex:17
#, elixir-autogen, elixir-format
msgid "New Ammo type"
msgstr "Nuevo tipo de Munición"
#: lib/cannery_web/live/container_live/index.html.heex:17
#, elixir-autogen, elixir-format
msgid "New Container"
@ -216,11 +211,6 @@ msgstr "Cambiar lenguaje"
msgid "View in Catalog"
msgstr "Ver en Catalogo"
#: lib/cannery_web/live/pack_live/index.html.heex:24
#, elixir-autogen, elixir-format
msgid "add an ammo type first"
msgstr "añade primero un tipo de munición"
#: lib/cannery_web/components/move_pack_component.ex:78
#: lib/cannery_web/live/pack_live/index.html.heex:144
#: lib/cannery_web/live/pack_live/show.html.heex:89
@ -250,11 +240,6 @@ msgstr "Desmontar del campo de tiro"
msgid "Export Data as JSON"
msgstr "Exportar datos como JSON"
#: lib/cannery_web/live/ammo_type_live/index.html.heex:110
#, elixir-autogen, elixir-format
msgid "Clone %{ammo_type_name}"
msgstr ""
#: lib/cannery_web/live/container_live/index.html.heex:87
#: lib/cannery_web/live/container_live/index.html.heex:145
#, elixir-autogen, elixir-format
@ -266,12 +251,6 @@ msgstr ""
msgid "Copy invite link for %{invite_name}"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:129
#: lib/cannery_web/live/ammo_type_live/show.html.heex:36
#, elixir-autogen, elixir-format
msgid "Delete %{ammo_type_name}"
msgstr ""
#: lib/cannery_web/live/container_live/index.html.heex:104
#: lib/cannery_web/live/container_live/index.html.heex:162
#: lib/cannery_web/live/container_live/show.html.heex:48
@ -289,12 +268,6 @@ msgstr ""
msgid "Delete invite for %{invite_name}"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:100
#: lib/cannery_web/live/ammo_type_live/show.html.heex:19
#, elixir-autogen, elixir-format
msgid "Edit %{ammo_type_name}"
msgstr ""
#: lib/cannery_web/live/container_live/index.html.heex:77
#: lib/cannery_web/live/container_live/index.html.heex:135
#: lib/cannery_web/live/container_live/show.html.heex:35
@ -328,11 +301,6 @@ msgstr ""
msgid "Unstage"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:90
#, elixir-autogen, elixir-format
msgid "View %{ammo_type_name}"
msgstr ""
#: lib/cannery_web/live/pack_live/index.html.heex:174
#, elixir-autogen, elixir-format, fuzzy
msgid "Clone pack of %{pack_count} bullets"
@ -350,7 +318,7 @@ msgstr ""
msgid "Edit pack of %{pack_count} bullets"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/show.html.heex:206
#: lib/cannery_web/live/ammo_type_live/show.html.heex:204
#: lib/cannery_web/live/pack_live/index.html.heex:154
#, elixir-autogen, elixir-format, fuzzy
msgid "View pack of %{pack_count} bullets"
@ -367,3 +335,35 @@ msgstr ""
#, elixir-autogen, elixir-format, fuzzy
msgid "Edit shot record of %{shot_record_count} shots"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:105
#, elixir-autogen, elixir-format, fuzzy
msgid "Clone %{type_name}"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:122
#: lib/cannery_web/live/ammo_type_live/show.html.heex:35
#, elixir-autogen, elixir-format, fuzzy
msgid "Delete %{type_name}"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:97
#: lib/cannery_web/live/ammo_type_live/show.html.heex:19
#, elixir-autogen, elixir-format, fuzzy
msgid "Edit %{type_name}"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:17
#, elixir-autogen, elixir-format, fuzzy
msgid "New Type"
msgstr "Nuevo tipo de Munición"
#: lib/cannery_web/live/ammo_type_live/index.html.heex:89
#, elixir-autogen, elixir-format, fuzzy
msgid "View %{type_name}"
msgstr ""
#: lib/cannery_web/live/pack_live/index.html.heex:24
#, elixir-autogen, elixir-format, fuzzy
msgid "add a type first"
msgstr "añade primero un tipo de munición"

View File

@ -38,12 +38,6 @@ msgstr "Aministradores:"
msgid "Ammo"
msgstr "Munición"
#: lib/cannery_web/components/pack_table_component.ex:95
#: lib/cannery_web/live/pack_live/form_component.html.heex:22
#, elixir-autogen, elixir-format
msgid "Ammo type"
msgstr "Tipo de munición"
#: lib/cannery_web/live/tag_live/form_component.html.heex:25
#, elixir-autogen, elixir-format
msgid "Background color"
@ -240,12 +234,6 @@ msgstr "Mi lata de munición guapa"
msgid "Name"
msgstr "Nombre"
#: lib/cannery_web/live/ammo_type_live/index.ex:36
#: lib/cannery_web/live/ammo_type_live/index.ex:44
#, elixir-autogen, elixir-format
msgid "New Ammo type"
msgstr "Nuevo tipo de Munición"
#: lib/cannery_web/live/container_live/index.ex:32
#: lib/cannery_web/live/container_live/index.ex:39
#, elixir-autogen, elixir-format
@ -267,7 +255,7 @@ msgstr "Nueva Etiqueta"
msgid "No Ammo"
msgstr "Sin Munición"
#: lib/cannery_web/live/ammo_type_live/show.html.heex:180
#: lib/cannery_web/live/ammo_type_live/show.html.heex:178
#, elixir-autogen, elixir-format
msgid "No ammo for this type"
msgstr "Sin munición para este tipo"
@ -404,7 +392,9 @@ msgstr "Trazadora"
#: lib/cannery_web/components/container_table_component.ex:48
#: lib/cannery_web/components/move_pack_component.ex:66
#: lib/cannery_web/components/pack_table_component.ex:95
#: lib/cannery_web/live/container_live/form_component.html.heex:39
#: lib/cannery_web/live/pack_live/form_component.html.heex:22
#, elixir-autogen, elixir-format
msgid "Type"
msgstr "Tipo"
@ -514,7 +504,7 @@ msgstr "Registro de tiros"
#: lib/cannery_web/components/core_components/pack_card.html.heex:47
#: lib/cannery_web/components/pack_table_component.ex:163
#: lib/cannery_web/components/pack_table_component.ex:246
#: lib/cannery_web/live/ammo_type_live/show.html.heex:152
#: lib/cannery_web/live/ammo_type_live/show.html.heex:150
#: lib/cannery_web/live/pack_live/show.html.heex:37
#: lib/cannery_web/live/pack_live/show.html.heex:42
#, elixir-autogen, elixir-format
@ -597,7 +587,7 @@ msgid "Edit %{name} tags"
msgstr "Editar etiquetas de %{name}"
#: lib/cannery_web/components/core_components/container_card.html.heex:37
#: lib/cannery_web/live/ammo_type_live/show.html.heex:87
#: lib/cannery_web/live/ammo_type_live/show.html.heex:85
#: lib/cannery_web/live/container_live/show.html.heex:27
#, elixir-autogen, elixir-format
msgid "Rounds:"
@ -606,7 +596,7 @@ msgstr "Balas:"
#: lib/cannery_web/components/ammo_type_table_component.ex:260
#: lib/cannery_web/components/pack_table_component.ex:160
#: lib/cannery_web/components/pack_table_component.ex:242
#: lib/cannery_web/live/ammo_type_live/show.html.heex:156
#: lib/cannery_web/live/ammo_type_live/show.html.heex:154
#, elixir-autogen, elixir-format
msgid "No cost information"
msgstr "No hay información de coste"
@ -677,7 +667,7 @@ msgstr "Tiros Récord"
msgid "Copies"
msgstr "Copias"
#: lib/cannery_web/live/ammo_type_live/show.html.heex:139
#: lib/cannery_web/live/ammo_type_live/show.html.heex:137
#, elixir-autogen, elixir-format
msgid "Added on:"
msgstr "Añadido en:"
@ -757,7 +747,7 @@ msgid "This ammo is not in a container"
msgstr "Esta munición no está en un contenedor"
#: lib/cannery_web/components/core_components/container_card.html.heex:32
#: lib/cannery_web/live/ammo_type_live/show.html.heex:113
#: lib/cannery_web/live/ammo_type_live/show.html.heex:111
#: lib/cannery_web/live/container_live/show.html.heex:22
#, elixir-autogen, elixir-format
msgid "Packs:"
@ -786,7 +776,7 @@ msgid "Container:"
msgstr "Contenedor:"
#: 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:164
#: lib/cannery_web/live/pack_live/index.html.heex:87
#, elixir-autogen, elixir-format
msgid "Show used"
@ -815,7 +805,7 @@ msgstr "Paquetes"
msgid "Rounds"
msgstr "Balas"
#: lib/cannery_web/live/ammo_type_live/show.html.heex:172
#: lib/cannery_web/live/ammo_type_live/show.html.heex:170
#: lib/cannery_web/live/container_live/index.html.heex:40
#: lib/cannery_web/live/container_live/show.html.heex:115
#, elixir-autogen, elixir-format
@ -827,7 +817,7 @@ msgstr "Ver como tabla"
msgid "Total ever packs"
msgstr "Paquetes totales"
#: lib/cannery_web/live/ammo_type_live/show.html.heex:130
#: lib/cannery_web/live/ammo_type_live/show.html.heex:128
#, elixir-autogen, elixir-format
msgid "Total ever packs:"
msgstr "Paquetes totales:"
@ -837,7 +827,7 @@ msgstr "Paquetes totales:"
msgid "Total ever rounds"
msgstr "Balas totales"
#: lib/cannery_web/live/ammo_type_live/show.html.heex:104
#: lib/cannery_web/live/ammo_type_live/show.html.heex:102
#, elixir-autogen, elixir-format
msgid "Total ever rounds:"
msgstr "Balas totales:"
@ -847,7 +837,7 @@ msgstr "Balas totales:"
msgid "Used packs"
msgstr "Paquetes usados"
#: lib/cannery_web/live/ammo_type_live/show.html.heex:122
#: lib/cannery_web/live/ammo_type_live/show.html.heex:120
#, elixir-autogen, elixir-format
msgid "Used packs:"
msgstr "Paquetes usados:"
@ -857,7 +847,7 @@ msgstr "Paquetes usados:"
msgid "Used rounds"
msgstr "Balas usadas"
#: lib/cannery_web/live/ammo_type_live/show.html.heex:96
#: lib/cannery_web/live/ammo_type_live/show.html.heex:94
#, elixir-autogen, elixir-format
msgid "Used rounds:"
msgstr "Balas usadas:"
@ -963,17 +953,11 @@ msgid "UPC:"
msgstr ""
#: lib/cannery_web/components/ammo_type_table_component.ex:102
#: lib/cannery_web/live/ammo_type_live/show.html.heex:148
#: lib/cannery_web/live/ammo_type_live/show.html.heex:146
#, elixir-autogen, elixir-format
msgid "Average CPR"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.ex:28
#: lib/cannery_web/live/ammo_type_live/show.ex:82
#, elixir-autogen, elixir-format
msgid "Edit %{ammo_type_name}"
msgstr "Editar %{ammo_type_name}"
#: lib/cannery_web/components/core_components/pack_card.html.heex:17
#: lib/cannery_web/components/pack_table_component.ex:250
#, elixir-autogen, elixir-format
@ -1037,12 +1021,6 @@ msgstr "Comprada en:"
msgid "Edit ammo"
msgstr "Editar munición"
#: lib/cannery_web/live/ammo_type_live/index.html.heex:8
#: lib/cannery_web/live/ammo_type_live/index.html.heex:71
#, elixir-autogen, elixir-format, fuzzy
msgid "No Ammo types"
msgstr "Sin tipo de Munición"
#: lib/cannery_web/live/ammo_type_live/index.html.heex:58
#, elixir-autogen, elixir-format
msgid "Search catalog"
@ -1313,14 +1291,14 @@ msgstr ""
msgid "No ammo"
msgstr "Sin Munición"
#: lib/cannery_web/live/ammo_type_live/show.html.heex:60
#: lib/cannery_web/live/ammo_type_live/show.html.heex:58
#, elixir-autogen, elixir-format
msgid "None specified"
msgstr ""
#: 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/show.html.heex:58
#: lib/cannery_web/live/ammo_type_live/show.html.heex:56
#: lib/cannery_web/live/container_live/show.html.heex:106
#: lib/cannery_web/live/pack_live/index.html.heex:61
#: lib/cannery_web/live/range_live/index.html.heex:95
@ -1345,7 +1323,7 @@ msgstr ""
#: 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/show.html.heex:56
#: lib/cannery_web/live/ammo_type_live/show.html.heex:54
#: lib/cannery_web/live/container_live/show.html.heex:104
#: lib/cannery_web/live/pack_live/index.html.heex:59
#: lib/cannery_web/live/range_live/index.html.heex:93
@ -1399,7 +1377,7 @@ msgstr ""
#: 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/show.html.heex:54
#: lib/cannery_web/live/ammo_type_live/show.html.heex:52
#: lib/cannery_web/live/container_live/show.html.heex:105
#: lib/cannery_web/live/pack_live/index.html.heex:60
#: lib/cannery_web/live/range_live/index.html.heex:94
@ -1443,7 +1421,7 @@ msgstr ""
#: lib/cannery_web/components/ammo_type_table_component.ex:150
#: 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/ammo_type_live/show.html.heex:46
#: lib/cannery_web/live/container_live/show.html.heex:97
#: lib/cannery_web/live/pack_live/index.html.heex:50
#: lib/cannery_web/live/range_live/index.html.heex:86
@ -1467,3 +1445,21 @@ msgstr ""
#, elixir-autogen, elixir-format, fuzzy
msgid "Edit Shot Record"
msgstr "Editar Tiros Récord"
#: lib/cannery_web/live/ammo_type_live/index.ex:28
#: lib/cannery_web/live/ammo_type_live/show.ex:82
#, elixir-autogen, elixir-format, fuzzy
msgid "Edit %{type_name}"
msgstr "Editar %{ammo_type_name}"
#: lib/cannery_web/live/ammo_type_live/index.ex:36
#: lib/cannery_web/live/ammo_type_live/index.ex:44
#, elixir-autogen, elixir-format, fuzzy
msgid "New Type"
msgstr "Nuevo tipo de Munición"
#: lib/cannery_web/live/ammo_type_live/index.html.heex:8
#: lib/cannery_web/live/ammo_type_live/index.html.heex:71
#, elixir-autogen, elixir-format, fuzzy
msgid "No Types"
msgstr "Tipo"

View File

@ -171,16 +171,11 @@ msgstr "No se ha podido procesar el número de copias"
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"
#: lib/cannery/ammo.ex:1123
#: lib/cannery/ammo.ex:1121
#, elixir-autogen, elixir-format
msgid "Invalid multiplier"
msgstr "Multiplicador inválido"
#: lib/cannery/ammo/pack.ex:92
#, elixir-autogen, elixir-format
msgid "Please select an ammo type and container"
msgstr "Por favor escoja un tipo de munición y un contenedor"
#: lib/cannery_web/live/range_live/index.html.heex:74
#, elixir-autogen, elixir-format
msgid "Your browser does not support the canvas element."
@ -210,3 +205,8 @@ msgstr "El recuento debe ser menos de %{count}"
#, elixir-autogen, elixir-format
msgid "can't be blank"
msgstr ""
#: lib/cannery/ammo/pack.ex:92
#, elixir-autogen, elixir-format, fuzzy
msgid "Please select a type and container"
msgstr "Por favor escoja un tipo de munición y un contenedor"

View File

@ -23,7 +23,7 @@ msgstr ""
## Run "mix gettext.extract" to bring this file up to
## date. Leave "msgstr"s empty as changing them here has no
## effect: edit them in PO (.po) files instead.
#: lib/cannery_web/live/ammo_type_live/form_component.ex:89
#: lib/cannery_web/live/ammo_type_live/form_component.ex:88
#: lib/cannery_web/live/container_live/form_component.ex:89
#: lib/cannery_web/live/invite_live/form_component.ex:80
#: lib/cannery_web/live/tag_live/form_component.ex:78
@ -44,7 +44,7 @@ msgstr "%{name} borrado exitosamente"
msgid "%{name} has been deleted"
msgstr "%{name} ha sido borrado"
#: lib/cannery_web/live/ammo_type_live/form_component.ex:70
#: lib/cannery_web/live/ammo_type_live/form_component.ex:69
#: lib/cannery_web/live/container_live/form_component.ex:70
#: lib/cannery_web/live/invite_live/form_component.ex:62
#: lib/cannery_web/live/tag_live/form_component.ex:60
@ -256,7 +256,7 @@ msgid_plural "Ammo added successfully"
msgstr[0] "Munición añadida exitosamente"
msgstr[1] "Municiones añadidas exitosamente"
#: lib/cannery_web/live/ammo_type_live/index.html.heex:122
#: lib/cannery_web/live/ammo_type_live/index.html.heex:116
#: lib/cannery_web/live/ammo_type_live/show.html.heex:29
#, elixir-autogen, elixir-format
msgid "Are you sure you want to delete %{name}? This will delete all %{name} type ammo as well!"

View File

@ -95,11 +95,6 @@ msgstr "Se connecter"
msgid "Make your first tag!"
msgstr "Faîtes votre premier tag!"
#: lib/cannery_web/live/ammo_type_live/index.html.heex:17
#, elixir-autogen, elixir-format
msgid "New Ammo type"
msgstr "Nouveau type de munition"
#: lib/cannery_web/live/container_live/index.html.heex:17
#, elixir-autogen, elixir-format
msgid "New Container"
@ -216,11 +211,6 @@ msgstr "Changer la langue"
msgid "View in Catalog"
msgstr "Voir en catalogue"
#: lib/cannery_web/live/pack_live/index.html.heex:24
#, elixir-autogen, elixir-format
msgid "add an ammo type first"
msgstr "Ajoutez d'abord un type de munitions"
#: lib/cannery_web/components/move_pack_component.ex:78
#: lib/cannery_web/live/pack_live/index.html.heex:144
#: lib/cannery_web/live/pack_live/show.html.heex:89
@ -250,11 +240,6 @@ msgstr ""
msgid "Export Data as JSON"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:110
#, elixir-autogen, elixir-format
msgid "Clone %{ammo_type_name}"
msgstr ""
#: lib/cannery_web/live/container_live/index.html.heex:87
#: lib/cannery_web/live/container_live/index.html.heex:145
#, elixir-autogen, elixir-format
@ -266,12 +251,6 @@ msgstr ""
msgid "Copy invite link for %{invite_name}"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:129
#: lib/cannery_web/live/ammo_type_live/show.html.heex:36
#, elixir-autogen, elixir-format
msgid "Delete %{ammo_type_name}"
msgstr ""
#: lib/cannery_web/live/container_live/index.html.heex:104
#: lib/cannery_web/live/container_live/index.html.heex:162
#: lib/cannery_web/live/container_live/show.html.heex:48
@ -289,12 +268,6 @@ msgstr ""
msgid "Delete invite for %{invite_name}"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:100
#: lib/cannery_web/live/ammo_type_live/show.html.heex:19
#, elixir-autogen, elixir-format
msgid "Edit %{ammo_type_name}"
msgstr ""
#: lib/cannery_web/live/container_live/index.html.heex:77
#: lib/cannery_web/live/container_live/index.html.heex:135
#: lib/cannery_web/live/container_live/show.html.heex:35
@ -328,11 +301,6 @@ msgstr ""
msgid "Unstage"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:90
#, elixir-autogen, elixir-format
msgid "View %{ammo_type_name}"
msgstr ""
#: lib/cannery_web/live/pack_live/index.html.heex:174
#, elixir-autogen, elixir-format, fuzzy
msgid "Clone pack of %{pack_count} bullets"
@ -350,7 +318,7 @@ msgstr ""
msgid "Edit pack of %{pack_count} bullets"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/show.html.heex:206
#: lib/cannery_web/live/ammo_type_live/show.html.heex:204
#: lib/cannery_web/live/pack_live/index.html.heex:154
#, elixir-autogen, elixir-format, fuzzy
msgid "View pack of %{pack_count} bullets"
@ -367,3 +335,35 @@ msgstr ""
#, elixir-autogen, elixir-format, fuzzy
msgid "Edit shot record of %{shot_record_count} shots"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:105
#, elixir-autogen, elixir-format, fuzzy
msgid "Clone %{type_name}"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:122
#: lib/cannery_web/live/ammo_type_live/show.html.heex:35
#, elixir-autogen, elixir-format, fuzzy
msgid "Delete %{type_name}"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:97
#: lib/cannery_web/live/ammo_type_live/show.html.heex:19
#, elixir-autogen, elixir-format, fuzzy
msgid "Edit %{type_name}"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:17
#, elixir-autogen, elixir-format, fuzzy
msgid "New Type"
msgstr "Nouveau type de munition"
#: lib/cannery_web/live/ammo_type_live/index.html.heex:89
#, elixir-autogen, elixir-format, fuzzy
msgid "View %{type_name}"
msgstr ""
#: lib/cannery_web/live/pack_live/index.html.heex:24
#, elixir-autogen, elixir-format, fuzzy
msgid "add a type first"
msgstr "Ajoutez d'abord un type de munitions"

View File

@ -38,12 +38,6 @@ msgstr "Administrateur·ices:"
msgid "Ammo"
msgstr "Munition"
#: lib/cannery_web/components/pack_table_component.ex:95
#: lib/cannery_web/live/pack_live/form_component.html.heex:22
#, elixir-autogen, elixir-format
msgid "Ammo type"
msgstr "Type de munition"
#: lib/cannery_web/live/tag_live/form_component.html.heex:25
#, elixir-autogen, elixir-format
msgid "Background color"
@ -240,12 +234,6 @@ msgstr "Ma superbe boite de munition"
msgid "Name"
msgstr "Nom"
#: lib/cannery_web/live/ammo_type_live/index.ex:36
#: lib/cannery_web/live/ammo_type_live/index.ex:44
#, elixir-autogen, elixir-format
msgid "New Ammo type"
msgstr "Nouveau type de munition"
#: lib/cannery_web/live/container_live/index.ex:32
#: lib/cannery_web/live/container_live/index.ex:39
#, elixir-autogen, elixir-format
@ -267,7 +255,7 @@ msgstr "Nouveau tag"
msgid "No Ammo"
msgstr "Aucune munition"
#: lib/cannery_web/live/ammo_type_live/show.html.heex:180
#: lib/cannery_web/live/ammo_type_live/show.html.heex:178
#, elixir-autogen, elixir-format
msgid "No ammo for this type"
msgstr "Aucune munition pour ce type"
@ -405,7 +393,9 @@ msgstr "Traceuse"
#: lib/cannery_web/components/container_table_component.ex:48
#: lib/cannery_web/components/move_pack_component.ex:66
#: lib/cannery_web/components/pack_table_component.ex:95
#: lib/cannery_web/live/container_live/form_component.html.heex:39
#: lib/cannery_web/live/pack_live/form_component.html.heex:22
#, elixir-autogen, elixir-format
msgid "Type"
msgstr "Type"
@ -515,7 +505,7 @@ msgstr "Évènements de tir"
#: lib/cannery_web/components/core_components/pack_card.html.heex:47
#: lib/cannery_web/components/pack_table_component.ex:163
#: lib/cannery_web/components/pack_table_component.ex:246
#: lib/cannery_web/live/ammo_type_live/show.html.heex:152
#: lib/cannery_web/live/ammo_type_live/show.html.heex:150
#: lib/cannery_web/live/pack_live/show.html.heex:37
#: lib/cannery_web/live/pack_live/show.html.heex:42
#, elixir-autogen, elixir-format
@ -598,7 +588,7 @@ msgid "Edit %{name} tags"
msgstr "Éditer les tags de %{name}"
#: lib/cannery_web/components/core_components/container_card.html.heex:37
#: lib/cannery_web/live/ammo_type_live/show.html.heex:87
#: lib/cannery_web/live/ammo_type_live/show.html.heex:85
#: lib/cannery_web/live/container_live/show.html.heex:27
#, elixir-autogen, elixir-format
msgid "Rounds:"
@ -607,7 +597,7 @@ msgstr "Cartouches:"
#: lib/cannery_web/components/ammo_type_table_component.ex:260
#: lib/cannery_web/components/pack_table_component.ex:160
#: lib/cannery_web/components/pack_table_component.ex:242
#: lib/cannery_web/live/ammo_type_live/show.html.heex:156
#: lib/cannery_web/live/ammo_type_live/show.html.heex:154
#, elixir-autogen, elixir-format
msgid "No cost information"
msgstr "Aucune information de prix"
@ -678,7 +668,7 @@ msgstr "Enregistrer des tirs"
msgid "Copies"
msgstr "Exemplaires"
#: lib/cannery_web/live/ammo_type_live/show.html.heex:139
#: lib/cannery_web/live/ammo_type_live/show.html.heex:137
#, elixir-autogen, elixir-format
msgid "Added on:"
msgstr "Ajouté le:"
@ -758,7 +748,7 @@ msgid "This ammo is not in a container"
msgstr "Ce groupe de munition nest pas dans un conteneur"
#: lib/cannery_web/components/core_components/container_card.html.heex:32
#: lib/cannery_web/live/ammo_type_live/show.html.heex:113
#: lib/cannery_web/live/ammo_type_live/show.html.heex:111
#: lib/cannery_web/live/container_live/show.html.heex:22
#, elixir-autogen, elixir-format
msgid "Packs:"
@ -787,7 +777,7 @@ msgid "Container:"
msgstr "Conteneur"
#: 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:164
#: lib/cannery_web/live/pack_live/index.html.heex:87
#, elixir-autogen, elixir-format
msgid "Show used"
@ -816,7 +806,7 @@ msgstr "Packages:"
msgid "Rounds"
msgstr "Cartouches:"
#: lib/cannery_web/live/ammo_type_live/show.html.heex:172
#: lib/cannery_web/live/ammo_type_live/show.html.heex:170
#: lib/cannery_web/live/container_live/index.html.heex:40
#: lib/cannery_web/live/container_live/show.html.heex:115
#, elixir-autogen, elixir-format
@ -828,7 +818,7 @@ msgstr ""
msgid "Total ever packs"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/show.html.heex:130
#: lib/cannery_web/live/ammo_type_live/show.html.heex:128
#, elixir-autogen, elixir-format
msgid "Total ever packs:"
msgstr ""
@ -838,7 +828,7 @@ msgstr ""
msgid "Total ever rounds"
msgstr "Quantité de cartouches"
#: lib/cannery_web/live/ammo_type_live/show.html.heex:104
#: lib/cannery_web/live/ammo_type_live/show.html.heex:102
#, elixir-autogen, elixir-format, fuzzy
msgid "Total ever rounds:"
msgstr "Nombre totale de cartouches tirées:"
@ -848,7 +838,7 @@ msgstr "Nombre totale de cartouches tirées:"
msgid "Used packs"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/show.html.heex:122
#: lib/cannery_web/live/ammo_type_live/show.html.heex:120
#, elixir-autogen, elixir-format
msgid "Used packs:"
msgstr ""
@ -858,7 +848,7 @@ msgstr ""
msgid "Used rounds"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/show.html.heex:96
#: lib/cannery_web/live/ammo_type_live/show.html.heex:94
#, elixir-autogen, elixir-format, fuzzy
msgid "Used rounds:"
msgstr ""
@ -964,17 +954,11 @@ msgid "UPC:"
msgstr "UPC"
#: lib/cannery_web/components/ammo_type_table_component.ex:102
#: lib/cannery_web/live/ammo_type_live/show.html.heex:148
#: lib/cannery_web/live/ammo_type_live/show.html.heex:146
#, elixir-autogen, elixir-format
msgid "Average CPR"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.ex:28
#: lib/cannery_web/live/ammo_type_live/show.ex:82
#, elixir-autogen, elixir-format, fuzzy
msgid "Edit %{ammo_type_name}"
msgstr "Éditer %{name}"
#: lib/cannery_web/components/core_components/pack_card.html.heex:17
#: lib/cannery_web/components/pack_table_component.ex:250
#, elixir-autogen, elixir-format
@ -1038,12 +1022,6 @@ msgstr ""
msgid "Edit ammo"
msgstr "Éditer le type de munition"
#: lib/cannery_web/live/ammo_type_live/index.html.heex:8
#: lib/cannery_web/live/ammo_type_live/index.html.heex:71
#, elixir-autogen, elixir-format, fuzzy
msgid "No Ammo types"
msgstr "Aucun type de munition"
#: lib/cannery_web/live/ammo_type_live/index.html.heex:58
#, elixir-autogen, elixir-format
msgid "Search catalog"
@ -1314,14 +1292,14 @@ msgstr ""
msgid "No ammo"
msgstr "Aucune munition"
#: lib/cannery_web/live/ammo_type_live/show.html.heex:60
#: lib/cannery_web/live/ammo_type_live/show.html.heex:58
#, elixir-autogen, elixir-format
msgid "None specified"
msgstr ""
#: 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/show.html.heex:58
#: lib/cannery_web/live/ammo_type_live/show.html.heex:56
#: lib/cannery_web/live/container_live/show.html.heex:106
#: lib/cannery_web/live/pack_live/index.html.heex:61
#: lib/cannery_web/live/range_live/index.html.heex:95
@ -1346,7 +1324,7 @@ msgstr ""
#: 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/show.html.heex:56
#: lib/cannery_web/live/ammo_type_live/show.html.heex:54
#: lib/cannery_web/live/container_live/show.html.heex:104
#: lib/cannery_web/live/pack_live/index.html.heex:59
#: lib/cannery_web/live/range_live/index.html.heex:93
@ -1400,7 +1378,7 @@ msgstr ""
#: 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/show.html.heex:54
#: lib/cannery_web/live/ammo_type_live/show.html.heex:52
#: lib/cannery_web/live/container_live/show.html.heex:105
#: lib/cannery_web/live/pack_live/index.html.heex:60
#: lib/cannery_web/live/range_live/index.html.heex:94
@ -1444,7 +1422,7 @@ msgstr ""
#: lib/cannery_web/components/ammo_type_table_component.ex:150
#: 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/ammo_type_live/show.html.heex:46
#: lib/cannery_web/live/container_live/show.html.heex:97
#: lib/cannery_web/live/pack_live/index.html.heex:50
#: lib/cannery_web/live/range_live/index.html.heex:86
@ -1468,3 +1446,21 @@ msgstr ""
#, elixir-autogen, elixir-format, fuzzy
msgid "Edit Shot Record"
msgstr "Modifier les enregistrements de tir"
#: lib/cannery_web/live/ammo_type_live/index.ex:28
#: lib/cannery_web/live/ammo_type_live/show.ex:82
#, elixir-autogen, elixir-format, fuzzy
msgid "Edit %{type_name}"
msgstr "Éditer %{name}"
#: lib/cannery_web/live/ammo_type_live/index.ex:36
#: lib/cannery_web/live/ammo_type_live/index.ex:44
#, elixir-autogen, elixir-format, fuzzy
msgid "New Type"
msgstr "Nouveau type de munition"
#: lib/cannery_web/live/ammo_type_live/index.html.heex:8
#: lib/cannery_web/live/ammo_type_live/index.html.heex:71
#, elixir-autogen, elixir-format, fuzzy
msgid "No Types"
msgstr "Type"

View File

@ -172,16 +172,11 @@ msgstr "Impossible d'analyser le nombre de copies"
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}"
#: lib/cannery/ammo.ex:1123
#: lib/cannery/ammo.ex:1121
#, elixir-autogen, elixir-format
msgid "Invalid multiplier"
msgstr "Multiplicateur invalide"
#: lib/cannery/ammo/pack.ex:92
#, elixir-autogen, elixir-format
msgid "Please select an ammo type and container"
msgstr "Veuillez choisir un type de munitions et un conteneur"
#: lib/cannery_web/live/range_live/index.html.heex:74
#, elixir-autogen, elixir-format
msgid "Your browser does not support the canvas element."
@ -211,3 +206,8 @@ msgstr "La quantité doit être inférieur à %{count}"
#, elixir-autogen, elixir-format
msgid "can't be blank"
msgstr ""
#: lib/cannery/ammo/pack.ex:92
#, elixir-autogen, elixir-format, fuzzy
msgid "Please select a type and container"
msgstr "Veuillez choisir un type de munitions et un conteneur"

View File

@ -23,7 +23,7 @@ msgstr ""
## Run "mix gettext.extract" to bring this file up to
## date. Leave "msgstr"s empty as changing them here has no
## effect: edit them in PO (.po) files instead.
#: lib/cannery_web/live/ammo_type_live/form_component.ex:89
#: lib/cannery_web/live/ammo_type_live/form_component.ex:88
#: lib/cannery_web/live/container_live/form_component.ex:89
#: lib/cannery_web/live/invite_live/form_component.ex:80
#: lib/cannery_web/live/tag_live/form_component.ex:78
@ -44,7 +44,7 @@ msgstr "%{name} supprimé· avec succès"
msgid "%{name} has been deleted"
msgstr "%{name} a été supprimé·e"
#: lib/cannery_web/live/ammo_type_live/form_component.ex:70
#: lib/cannery_web/live/ammo_type_live/form_component.ex:69
#: lib/cannery_web/live/container_live/form_component.ex:70
#: lib/cannery_web/live/invite_live/form_component.ex:62
#: lib/cannery_web/live/tag_live/form_component.ex:60
@ -258,7 +258,7 @@ msgid_plural "Ammo added successfully"
msgstr[0] "Groupe de munition mis à jour avec succès"
msgstr[1] "Groupe de munition mis à jour avec succès"
#: lib/cannery_web/live/ammo_type_live/index.html.heex:122
#: lib/cannery_web/live/ammo_type_live/index.html.heex:116
#: lib/cannery_web/live/ammo_type_live/show.html.heex:29
#, elixir-autogen, elixir-format, fuzzy
msgid "Are you sure you want to delete %{name}? This will delete all %{name} type ammo as well!"

View File

@ -93,11 +93,6 @@ msgstr ""
msgid "Make your first tag!"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:17
#, elixir-autogen, elixir-format
msgid "New Ammo type"
msgstr ""
#: lib/cannery_web/live/container_live/index.html.heex:17
#, elixir-autogen, elixir-format
msgid "New Container"
@ -214,11 +209,6 @@ msgstr ""
msgid "View in Catalog"
msgstr ""
#: lib/cannery_web/live/pack_live/index.html.heex:24
#, elixir-autogen, elixir-format
msgid "add an ammo type first"
msgstr ""
#: lib/cannery_web/components/move_pack_component.ex:78
#: lib/cannery_web/live/pack_live/index.html.heex:144
#: lib/cannery_web/live/pack_live/show.html.heex:89
@ -248,11 +238,6 @@ msgstr ""
msgid "Export Data as JSON"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:110
#, elixir-autogen, elixir-format
msgid "Clone %{ammo_type_name}"
msgstr ""
#: lib/cannery_web/live/container_live/index.html.heex:87
#: lib/cannery_web/live/container_live/index.html.heex:145
#, elixir-autogen, elixir-format
@ -264,12 +249,6 @@ msgstr ""
msgid "Copy invite link for %{invite_name}"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:129
#: lib/cannery_web/live/ammo_type_live/show.html.heex:36
#, elixir-autogen, elixir-format
msgid "Delete %{ammo_type_name}"
msgstr ""
#: lib/cannery_web/live/container_live/index.html.heex:104
#: lib/cannery_web/live/container_live/index.html.heex:162
#: lib/cannery_web/live/container_live/show.html.heex:48
@ -287,12 +266,6 @@ msgstr ""
msgid "Delete invite for %{invite_name}"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:100
#: lib/cannery_web/live/ammo_type_live/show.html.heex:19
#, elixir-autogen, elixir-format
msgid "Edit %{ammo_type_name}"
msgstr ""
#: lib/cannery_web/live/container_live/index.html.heex:77
#: lib/cannery_web/live/container_live/index.html.heex:135
#: lib/cannery_web/live/container_live/show.html.heex:35
@ -326,11 +299,6 @@ msgstr ""
msgid "Unstage"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:90
#, elixir-autogen, elixir-format
msgid "View %{ammo_type_name}"
msgstr ""
#: lib/cannery_web/live/pack_live/index.html.heex:174
#, elixir-autogen, elixir-format, fuzzy
msgid "Clone pack of %{pack_count} bullets"
@ -348,7 +316,7 @@ msgstr ""
msgid "Edit pack of %{pack_count} bullets"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/show.html.heex:206
#: lib/cannery_web/live/ammo_type_live/show.html.heex:204
#: lib/cannery_web/live/pack_live/index.html.heex:154
#, elixir-autogen, elixir-format, fuzzy
msgid "View pack of %{pack_count} bullets"
@ -365,3 +333,35 @@ msgstr ""
#, elixir-autogen, elixir-format, fuzzy
msgid "Edit shot record of %{shot_record_count} shots"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:105
#, elixir-autogen, elixir-format, fuzzy
msgid "Clone %{type_name}"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:122
#: lib/cannery_web/live/ammo_type_live/show.html.heex:35
#, elixir-autogen, elixir-format, fuzzy
msgid "Delete %{type_name}"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:97
#: lib/cannery_web/live/ammo_type_live/show.html.heex:19
#, elixir-autogen, elixir-format, fuzzy
msgid "Edit %{type_name}"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:17
#, elixir-autogen, elixir-format, fuzzy
msgid "New Type"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:89
#, elixir-autogen, elixir-format, fuzzy
msgid "View %{type_name}"
msgstr ""
#: lib/cannery_web/live/pack_live/index.html.heex:24
#, elixir-autogen, elixir-format, fuzzy
msgid "add a type first"
msgstr ""

View File

@ -36,12 +36,6 @@ msgstr ""
msgid "Ammo"
msgstr ""
#: lib/cannery_web/components/pack_table_component.ex:95
#: lib/cannery_web/live/pack_live/form_component.html.heex:22
#, elixir-autogen, elixir-format
msgid "Ammo type"
msgstr ""
#: lib/cannery_web/live/tag_live/form_component.html.heex:25
#, elixir-autogen, elixir-format
msgid "Background color"
@ -238,12 +232,6 @@ msgstr ""
msgid "Name"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.ex:36
#: lib/cannery_web/live/ammo_type_live/index.ex:44
#, elixir-autogen, elixir-format
msgid "New Ammo type"
msgstr ""
#: lib/cannery_web/live/container_live/index.ex:32
#: lib/cannery_web/live/container_live/index.ex:39
#, elixir-autogen, elixir-format
@ -265,7 +253,7 @@ msgstr ""
msgid "No Ammo"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/show.html.heex:180
#: lib/cannery_web/live/ammo_type_live/show.html.heex:178
#, elixir-autogen, elixir-format
msgid "No ammo for this type"
msgstr ""
@ -399,7 +387,9 @@ msgstr ""
#: lib/cannery_web/components/container_table_component.ex:48
#: lib/cannery_web/components/move_pack_component.ex:66
#: lib/cannery_web/components/pack_table_component.ex:95
#: lib/cannery_web/live/container_live/form_component.html.heex:39
#: lib/cannery_web/live/pack_live/form_component.html.heex:22
#, elixir-autogen, elixir-format
msgid "Type"
msgstr ""
@ -509,7 +499,7 @@ msgstr ""
#: lib/cannery_web/components/core_components/pack_card.html.heex:47
#: lib/cannery_web/components/pack_table_component.ex:163
#: lib/cannery_web/components/pack_table_component.ex:246
#: lib/cannery_web/live/ammo_type_live/show.html.heex:152
#: lib/cannery_web/live/ammo_type_live/show.html.heex:150
#: lib/cannery_web/live/pack_live/show.html.heex:37
#: lib/cannery_web/live/pack_live/show.html.heex:42
#, elixir-autogen, elixir-format
@ -592,7 +582,7 @@ msgid "Edit %{name} tags"
msgstr ""
#: lib/cannery_web/components/core_components/container_card.html.heex:37
#: lib/cannery_web/live/ammo_type_live/show.html.heex:87
#: lib/cannery_web/live/ammo_type_live/show.html.heex:85
#: lib/cannery_web/live/container_live/show.html.heex:27
#, elixir-autogen, elixir-format
msgid "Rounds:"
@ -601,7 +591,7 @@ msgstr ""
#: lib/cannery_web/components/ammo_type_table_component.ex:260
#: lib/cannery_web/components/pack_table_component.ex:160
#: lib/cannery_web/components/pack_table_component.ex:242
#: lib/cannery_web/live/ammo_type_live/show.html.heex:156
#: lib/cannery_web/live/ammo_type_live/show.html.heex:154
#, elixir-autogen, elixir-format
msgid "No cost information"
msgstr ""
@ -672,7 +662,7 @@ msgstr ""
msgid "Copies"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/show.html.heex:139
#: lib/cannery_web/live/ammo_type_live/show.html.heex:137
#, elixir-autogen, elixir-format
msgid "Added on:"
msgstr ""
@ -752,7 +742,7 @@ msgid "This ammo is not in a container"
msgstr ""
#: lib/cannery_web/components/core_components/container_card.html.heex:32
#: lib/cannery_web/live/ammo_type_live/show.html.heex:113
#: lib/cannery_web/live/ammo_type_live/show.html.heex:111
#: lib/cannery_web/live/container_live/show.html.heex:22
#, elixir-autogen, elixir-format
msgid "Packs:"
@ -780,7 +770,7 @@ msgid "Container:"
msgstr ""
#: 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:164
#: lib/cannery_web/live/pack_live/index.html.heex:87
#, elixir-autogen, elixir-format
msgid "Show used"
@ -809,7 +799,7 @@ msgstr ""
msgid "Rounds"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/show.html.heex:172
#: lib/cannery_web/live/ammo_type_live/show.html.heex:170
#: lib/cannery_web/live/container_live/index.html.heex:40
#: lib/cannery_web/live/container_live/show.html.heex:115
#, elixir-autogen, elixir-format
@ -821,7 +811,7 @@ msgstr ""
msgid "Total ever packs"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/show.html.heex:130
#: lib/cannery_web/live/ammo_type_live/show.html.heex:128
#, elixir-autogen, elixir-format
msgid "Total ever packs:"
msgstr ""
@ -831,7 +821,7 @@ msgstr ""
msgid "Total ever rounds"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/show.html.heex:104
#: lib/cannery_web/live/ammo_type_live/show.html.heex:102
#, elixir-autogen, elixir-format, fuzzy
msgid "Total ever rounds:"
msgstr ""
@ -841,7 +831,7 @@ msgstr ""
msgid "Used packs"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/show.html.heex:122
#: lib/cannery_web/live/ammo_type_live/show.html.heex:120
#, elixir-autogen, elixir-format
msgid "Used packs:"
msgstr ""
@ -851,7 +841,7 @@ msgstr ""
msgid "Used rounds"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/show.html.heex:96
#: lib/cannery_web/live/ammo_type_live/show.html.heex:94
#, elixir-autogen, elixir-format, fuzzy
msgid "Used rounds:"
msgstr ""
@ -957,17 +947,11 @@ msgid "UPC:"
msgstr ""
#: lib/cannery_web/components/ammo_type_table_component.ex:102
#: lib/cannery_web/live/ammo_type_live/show.html.heex:148
#: lib/cannery_web/live/ammo_type_live/show.html.heex:146
#, elixir-autogen, elixir-format
msgid "Average CPR"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.ex:28
#: lib/cannery_web/live/ammo_type_live/show.ex:82
#, elixir-autogen, elixir-format, fuzzy
msgid "Edit %{ammo_type_name}"
msgstr ""
#: lib/cannery_web/components/core_components/pack_card.html.heex:17
#: lib/cannery_web/components/pack_table_component.ex:250
#, elixir-autogen, elixir-format
@ -1031,12 +1015,6 @@ msgstr ""
msgid "Edit ammo"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:8
#: lib/cannery_web/live/ammo_type_live/index.html.heex:71
#, elixir-autogen, elixir-format, fuzzy
msgid "No Ammo types"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:58
#, elixir-autogen, elixir-format
msgid "Search catalog"
@ -1305,14 +1283,14 @@ msgstr ""
msgid "No ammo"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/show.html.heex:60
#: lib/cannery_web/live/ammo_type_live/show.html.heex:58
#, elixir-autogen, elixir-format
msgid "None specified"
msgstr ""
#: 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/show.html.heex:58
#: lib/cannery_web/live/ammo_type_live/show.html.heex:56
#: lib/cannery_web/live/container_live/show.html.heex:106
#: lib/cannery_web/live/pack_live/index.html.heex:61
#: lib/cannery_web/live/range_live/index.html.heex:95
@ -1337,7 +1315,7 @@ msgstr ""
#: 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/show.html.heex:56
#: lib/cannery_web/live/ammo_type_live/show.html.heex:54
#: lib/cannery_web/live/container_live/show.html.heex:104
#: lib/cannery_web/live/pack_live/index.html.heex:59
#: lib/cannery_web/live/range_live/index.html.heex:93
@ -1391,7 +1369,7 @@ msgstr ""
#: 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/show.html.heex:54
#: lib/cannery_web/live/ammo_type_live/show.html.heex:52
#: lib/cannery_web/live/container_live/show.html.heex:105
#: lib/cannery_web/live/pack_live/index.html.heex:60
#: lib/cannery_web/live/range_live/index.html.heex:94
@ -1435,7 +1413,7 @@ msgstr ""
#: lib/cannery_web/components/ammo_type_table_component.ex:150
#: 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/ammo_type_live/show.html.heex:46
#: lib/cannery_web/live/container_live/show.html.heex:97
#: lib/cannery_web/live/pack_live/index.html.heex:50
#: lib/cannery_web/live/range_live/index.html.heex:86
@ -1459,3 +1437,21 @@ msgstr ""
#, elixir-autogen, elixir-format, fuzzy
msgid "Edit Shot Record"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.ex:28
#: lib/cannery_web/live/ammo_type_live/show.ex:82
#, elixir-autogen, elixir-format, fuzzy
msgid "Edit %{type_name}"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.ex:36
#: lib/cannery_web/live/ammo_type_live/index.ex:44
#, elixir-autogen, elixir-format, fuzzy
msgid "New Type"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:8
#: lib/cannery_web/live/ammo_type_live/index.html.heex:71
#, elixir-autogen, elixir-format, fuzzy
msgid "No Types"
msgstr ""

View File

@ -171,16 +171,11 @@ msgstr ""
msgid "Invalid number of copies, must be between 1 and %{max}. Was %{multiplier}"
msgstr ""
#: lib/cannery/ammo.ex:1123
#: lib/cannery/ammo.ex:1121
#, elixir-autogen, elixir-format
msgid "Invalid multiplier"
msgstr ""
#: lib/cannery/ammo/pack.ex:92
#, elixir-autogen, elixir-format
msgid "Please select an ammo type and container"
msgstr ""
#: lib/cannery_web/live/range_live/index.html.heex:74
#, elixir-autogen, elixir-format
msgid "Your browser does not support the canvas element."
@ -210,3 +205,8 @@ msgstr ""
#, elixir-autogen, elixir-format
msgid "can't be blank"
msgstr ""
#: lib/cannery/ammo/pack.ex:92
#, elixir-autogen, elixir-format, fuzzy
msgid "Please select a type and container"
msgstr ""

View File

@ -21,7 +21,7 @@ msgstr ""
## Run "mix gettext.extract" to bring this file up to
## date. Leave "msgstr"s empty as changing them here has no
## effect: edit them in PO (.po) files instead.
#: lib/cannery_web/live/ammo_type_live/form_component.ex:89
#: lib/cannery_web/live/ammo_type_live/form_component.ex:88
#: lib/cannery_web/live/container_live/form_component.ex:89
#: lib/cannery_web/live/invite_live/form_component.ex:80
#: lib/cannery_web/live/tag_live/form_component.ex:78
@ -42,7 +42,7 @@ msgstr ""
msgid "%{name} has been deleted"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/form_component.ex:70
#: lib/cannery_web/live/ammo_type_live/form_component.ex:69
#: lib/cannery_web/live/container_live/form_component.ex:70
#: lib/cannery_web/live/invite_live/form_component.ex:62
#: lib/cannery_web/live/tag_live/form_component.ex:60
@ -250,7 +250,7 @@ msgstr[2] ""
msgstr[3] ""
msgstr[4] ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:122
#: lib/cannery_web/live/ammo_type_live/index.html.heex:116
#: lib/cannery_web/live/ammo_type_live/show.html.heex:29
#, elixir-autogen, elixir-format
msgid "Are you sure you want to delete %{name}? This will delete all %{name} type ammo as well!"

View File

@ -10,7 +10,7 @@
msgid ""
msgstr ""
#: lib/cannery_web/live/ammo_type_live/form_component.ex:89
#: lib/cannery_web/live/ammo_type_live/form_component.ex:88
#: lib/cannery_web/live/container_live/form_component.ex:89
#: lib/cannery_web/live/invite_live/form_component.ex:80
#: lib/cannery_web/live/tag_live/form_component.ex:78
@ -31,7 +31,7 @@ msgstr ""
msgid "%{name} has been deleted"
msgstr ""
#: lib/cannery_web/live/ammo_type_live/form_component.ex:70
#: lib/cannery_web/live/ammo_type_live/form_component.ex:69
#: lib/cannery_web/live/container_live/form_component.ex:70
#: lib/cannery_web/live/invite_live/form_component.ex:62
#: lib/cannery_web/live/tag_live/form_component.ex:60
@ -236,7 +236,7 @@ msgid_plural "Ammo added successfully"
msgstr[0] ""
msgstr[1] ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:122
#: lib/cannery_web/live/ammo_type_live/index.html.heex:116
#: lib/cannery_web/live/ammo_type_live/show.html.heex:29
#, elixir-autogen, elixir-format
msgid "Are you sure you want to delete %{name}? This will delete all %{name} type ammo as well!"

View File

@ -13,10 +13,9 @@ defmodule Cannery.ActivityLogTest do
setup do
current_user = user_fixture()
container = container_fixture(current_user)
ammo_type = ammo_type_fixture(current_user)
type = type_fixture(current_user)
{1, [%{id: pack_id} = pack]} =
pack_fixture(%{count: 25}, ammo_type, container, current_user)
{1, [%{id: pack_id} = pack]} = pack_fixture(%{count: 25}, type, container, current_user)
shot_record =
%{count: 5, date: ~N[2022-02-13 03:17:00], notes: "some notes"}
@ -27,7 +26,7 @@ defmodule Cannery.ActivityLogTest do
[
current_user: current_user,
container: container,
ammo_type: ammo_type,
type: type,
pack: pack,
shot_record: shot_record
]
@ -47,8 +46,8 @@ defmodule Cannery.ActivityLogTest do
assert ActivityLog.get_shot_record_count!(other_user) == 0
container = container_fixture(other_user)
ammo_type = ammo_type_fixture(other_user)
{1, [pack]} = pack_fixture(%{count: 25}, ammo_type, container, other_user)
type = type_fixture(other_user)
{1, [pack]} = pack_fixture(%{count: 25}, type, container, other_user)
shot_record_fixture(%{count: 1, date: ~N[2022-02-13 03:17:00]}, other_user, pack)
assert ActivityLog.get_shot_record_count!(other_user) == 1
end
@ -191,11 +190,11 @@ defmodule Cannery.ActivityLogTest do
test "get_used_count/2 returns accurate used count", %{
pack: pack,
ammo_type: ammo_type,
type: type,
container: container,
current_user: current_user
} do
{1, [another_pack]} = pack_fixture(ammo_type, container, current_user)
{1, [another_pack]} = pack_fixture(type, container, current_user)
assert 0 = another_pack |> ActivityLog.get_used_count(current_user)
assert 5 = pack |> ActivityLog.get_used_count(current_user)
@ -205,18 +204,17 @@ defmodule Cannery.ActivityLogTest do
shot_record_fixture(%{count: 10}, current_user, pack)
assert 30 = pack |> ActivityLog.get_used_count(current_user)
{1, [another_pack]} = pack_fixture(ammo_type, container, current_user)
{1, [another_pack]} = pack_fixture(type, container, current_user)
assert 0 = another_pack |> ActivityLog.get_used_count(current_user)
end
test "get_used_counts/2 returns accurate used counts", %{
pack: %{id: pack_id} = pack,
ammo_type: ammo_type,
type: type,
container: container,
current_user: current_user
} do
{1, [%{id: another_pack_id} = another_pack]} =
pack_fixture(ammo_type, container, current_user)
{1, [%{id: another_pack_id} = another_pack]} = pack_fixture(type, container, current_user)
assert %{pack_id => 5} ==
[pack, another_pack] |> ActivityLog.get_used_counts(current_user)
@ -239,12 +237,12 @@ defmodule Cannery.ActivityLogTest do
test "get_last_used_date/2 returns accurate used count", %{
pack: pack,
ammo_type: ammo_type,
type: type,
container: container,
shot_record: %{date: date},
current_user: current_user
} do
{1, [another_pack]} = pack_fixture(ammo_type, container, current_user)
{1, [another_pack]} = pack_fixture(type, container, current_user)
assert another_pack |> ActivityLog.get_last_used_date(current_user) |> is_nil()
assert ^date = pack |> ActivityLog.get_last_used_date(current_user)
@ -257,13 +255,12 @@ defmodule Cannery.ActivityLogTest do
test "get_last_used_dates/2 returns accurate used counts", %{
pack: %{id: pack_id} = pack,
ammo_type: ammo_type,
type: type,
container: container,
shot_record: %{date: date},
current_user: current_user
} do
{1, [%{id: another_pack_id} = another_pack]} =
pack_fixture(ammo_type, container, current_user)
{1, [%{id: another_pack_id} = another_pack]} = pack_fixture(type, container, current_user)
# unset date
assert %{pack_id => date} ==
@ -297,49 +294,47 @@ defmodule Cannery.ActivityLogTest do
assert %{^another_pack_id => ~D[2022-11-09]} = last_used_shot_records
end
test "get_used_count_for_ammo_type/2 gets accurate used round count for ammo type",
%{ammo_type: ammo_type, pack: pack, current_user: current_user} do
another_ammo_type = ammo_type_fixture(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)
test "get_used_count_for_type/2 gets accurate used round count for type",
%{type: type, pack: pack, current_user: current_user} do
another_type = type_fixture(current_user)
assert 0 = another_type |> ActivityLog.get_used_count_for_type(current_user)
assert 5 = type |> ActivityLog.get_used_count_for_type(current_user)
shot_record_fixture(%{count: 5}, current_user, pack)
assert 10 = ammo_type |> ActivityLog.get_used_count_for_ammo_type(current_user)
assert 10 = type |> ActivityLog.get_used_count_for_type(current_user)
shot_record_fixture(%{count: 1}, current_user, pack)
assert 11 = ammo_type |> ActivityLog.get_used_count_for_ammo_type(current_user)
assert 11 = type |> ActivityLog.get_used_count_for_type(current_user)
end
test "get_used_count_for_ammo_types/2 gets accurate used round count for ammo types", %{
ammo_type: %{id: ammo_type_id} = ammo_type,
test "get_used_count_for_types/2 gets accurate used round count for types", %{
type: %{id: type_id} = type,
container: container,
current_user: current_user
} do
# testing unused ammo type
%{id: another_ammo_type_id} = another_ammo_type = ammo_type_fixture(current_user)
{1, [pack]} = pack_fixture(another_ammo_type, container, current_user)
# testing unused type
%{id: another_type_id} = another_type = type_fixture(current_user)
{1, [pack]} = pack_fixture(another_type, container, current_user)
assert %{ammo_type_id => 5} ==
[ammo_type, another_ammo_type]
|> ActivityLog.get_used_count_for_ammo_types(current_user)
assert %{type_id => 5} ==
[type, another_type]
|> ActivityLog.get_used_count_for_types(current_user)
# use generated pack
shot_record_fixture(%{count: 5}, current_user, pack)
used_counts =
[ammo_type, another_ammo_type] |> ActivityLog.get_used_count_for_ammo_types(current_user)
used_counts = [type, another_type] |> ActivityLog.get_used_count_for_types(current_user)
assert %{^ammo_type_id => 5} = used_counts
assert %{^another_ammo_type_id => 5} = used_counts
assert %{^type_id => 5} = used_counts
assert %{^another_type_id => 5} = used_counts
# use generated pack again
shot_record_fixture(%{count: 1}, current_user, pack)
used_counts =
[ammo_type, another_ammo_type] |> ActivityLog.get_used_count_for_ammo_types(current_user)
used_counts = [type, another_type] |> ActivityLog.get_used_count_for_types(current_user)
assert %{^ammo_type_id => 5} = used_counts
assert %{^another_ammo_type_id => 6} = used_counts
assert %{^type_id => 5} = used_counts
assert %{^another_type_id => 6} = used_counts
end
end
@ -347,13 +342,13 @@ defmodule Cannery.ActivityLogTest do
setup do
current_user = user_fixture()
container = container_fixture(current_user)
ammo_type = ammo_type_fixture(current_user)
{1, [pack]} = pack_fixture(ammo_type, container, current_user)
type = type_fixture(current_user)
{1, [pack]} = pack_fixture(type, container, current_user)
[
current_user: current_user,
container: container,
ammo_type: ammo_type,
type: type,
pack: pack
]
end
@ -364,21 +359,21 @@ defmodule Cannery.ActivityLogTest do
other_container = container_fixture(other_user)
for class <- ["rifle", "shotgun", "pistol"] do
other_ammo_type = ammo_type_fixture(%{class: class}, other_user)
{1, [other_pack]} = pack_fixture(other_ammo_type, other_container, other_user)
other_type = type_fixture(%{class: class}, other_user)
{1, [other_pack]} = pack_fixture(other_type, other_container, other_user)
shot_record_fixture(other_user, other_pack)
end
rifle_ammo_type = ammo_type_fixture(%{class: :rifle}, current_user)
{1, [rifle_pack]} = pack_fixture(rifle_ammo_type, container, current_user)
rifle_type = type_fixture(%{class: :rifle}, current_user)
{1, [rifle_pack]} = pack_fixture(rifle_type, container, current_user)
rifle_shot_record = shot_record_fixture(current_user, rifle_pack)
shotgun_ammo_type = ammo_type_fixture(%{class: :shotgun}, current_user)
{1, [shotgun_pack]} = pack_fixture(shotgun_ammo_type, container, current_user)
shotgun_type = type_fixture(%{class: :shotgun}, current_user)
{1, [shotgun_pack]} = pack_fixture(shotgun_type, container, current_user)
shotgun_shot_record = shot_record_fixture(current_user, shotgun_pack)
pistol_ammo_type = ammo_type_fixture(%{class: :pistol}, current_user)
{1, [pistol_pack]} = pack_fixture(pistol_ammo_type, container, current_user)
pistol_type = type_fixture(%{class: :pistol}, current_user)
{1, [pistol_pack]} = pack_fixture(pistol_type, container, current_user)
pistol_shot_record = shot_record_fixture(current_user, pistol_pack)
assert [^rifle_shot_record] = ActivityLog.list_shot_records(:rifle, current_user)
@ -399,29 +394,28 @@ defmodule Cannery.ActivityLogTest do
end
test "list_shot_records/3 returns relevant shot_records for a search", %{
ammo_type: ammo_type,
type: type,
pack: pack,
container: container,
current_user: current_user
} do
shot_record_a = shot_record_fixture(%{notes: "amazing"}, current_user, pack)
{1, [another_pack]} =
pack_fixture(%{notes: "stupendous"}, ammo_type, container, current_user)
{1, [another_pack]} = pack_fixture(%{notes: "stupendous"}, type, container, current_user)
shot_record_b = shot_record_fixture(current_user, another_pack)
another_ammo_type = ammo_type_fixture(%{name: "fabulous ammo"}, current_user)
another_type = type_fixture(%{name: "fabulous ammo"}, current_user)
{1, [yet_another_pack]} = pack_fixture(another_ammo_type, container, current_user)
{1, [yet_another_pack]} = pack_fixture(another_type, container, current_user)
shot_record_c = shot_record_fixture(current_user, yet_another_pack)
another_user = user_fixture()
another_container = container_fixture(another_user)
another_ammo_type = ammo_type_fixture(another_user)
another_type = type_fixture(another_user)
{1, [another_pack]} = pack_fixture(another_ammo_type, another_container, another_user)
{1, [another_pack]} = pack_fixture(another_type, another_container, another_user)
_shouldnt_return = shot_record_fixture(another_user, another_pack)
@ -431,7 +425,7 @@ defmodule Cannery.ActivityLogTest do
# pack attributes
assert ActivityLog.list_shot_records("stupendous", :all, current_user) == [shot_record_b]
# ammo type attributes
# type attributes
assert ActivityLog.list_shot_records("fabulous", :all, current_user) == [shot_record_c]
end
end

File diff suppressed because it is too large Load Diff

View File

@ -11,16 +11,16 @@ defmodule CanneryWeb.ExportControllerTest do
setup [:register_and_log_in_user]
defp add_data(%{current_user: current_user}) do
ammo_type = ammo_type_fixture(current_user)
type = type_fixture(current_user)
container = container_fixture(current_user)
tag = tag_fixture(current_user)
Containers.add_tag!(container, tag, current_user)
{1, [pack]} = pack_fixture(ammo_type, container, current_user)
{1, [pack]} = pack_fixture(type, container, current_user)
shot_record = shot_record_fixture(current_user, pack)
pack = pack |> Repo.reload!()
%{
ammo_type: ammo_type,
type: type,
pack: pack,
container: container,
shot_record: shot_record,
@ -35,7 +35,7 @@ defmodule CanneryWeb.ExportControllerTest do
conn: conn,
current_user: current_user,
container: container,
ammo_type: ammo_type,
type: type,
pack: pack,
shot_record: shot_record,
tag: tag
@ -43,7 +43,7 @@ defmodule CanneryWeb.ExportControllerTest do
conn = get(conn, Routes.export_path(conn, :export, :json))
ideal_pack = %{
"ammo_type_id" => pack.ammo_type_id,
"type_id" => pack.type_id,
"container_id" => pack.container_id,
"count" => pack.count,
"id" => pack.id,
@ -56,34 +56,34 @@ defmodule CanneryWeb.ExportControllerTest do
"percentage_remaining" => pack |> Ammo.get_percentage_remaining(current_user)
}
ideal_ammo_type = %{
"blank" => ammo_type.blank,
"bullet_core" => ammo_type.bullet_core,
"bullet_type" => ammo_type.bullet_type,
"caliber" => ammo_type.caliber,
"cartridge" => ammo_type.cartridge,
"case_material" => ammo_type.case_material,
"corrosive" => ammo_type.corrosive,
"desc" => ammo_type.desc,
"firing_type" => ammo_type.firing_type,
"grains" => ammo_type.grains,
"id" => ammo_type.id,
"incendiary" => ammo_type.incendiary,
"jacket_type" => ammo_type.jacket_type,
"manufacturer" => ammo_type.manufacturer,
"muzzle_velocity" => ammo_type.muzzle_velocity,
"name" => ammo_type.name,
"powder_grains_per_charge" => ammo_type.powder_grains_per_charge,
"powder_type" => ammo_type.powder_type,
"pressure" => ammo_type.pressure,
"primer_type" => ammo_type.primer_type,
"tracer" => ammo_type.tracer,
"upc" => ammo_type.upc,
"average_cost" => ammo_type |> Ammo.get_average_cost_for_ammo_type(current_user),
"round_count" => ammo_type |> Ammo.get_round_count_for_ammo_type(current_user),
"used_count" => ammo_type |> ActivityLog.get_used_count_for_ammo_type(current_user),
"pack_count" => ammo_type |> Ammo.get_packs_count_for_type(current_user),
"total_pack_count" => ammo_type |> Ammo.get_packs_count_for_type(current_user, true)
ideal_type = %{
"blank" => type.blank,
"bullet_core" => type.bullet_core,
"bullet_type" => type.bullet_type,
"caliber" => type.caliber,
"cartridge" => type.cartridge,
"case_material" => type.case_material,
"corrosive" => type.corrosive,
"desc" => type.desc,
"firing_type" => type.firing_type,
"grains" => type.grains,
"id" => type.id,
"incendiary" => type.incendiary,
"jacket_type" => type.jacket_type,
"manufacturer" => type.manufacturer,
"muzzle_velocity" => type.muzzle_velocity,
"name" => type.name,
"powder_grains_per_charge" => type.powder_grains_per_charge,
"powder_type" => type.powder_type,
"pressure" => type.pressure,
"primer_type" => type.primer_type,
"tracer" => type.tracer,
"upc" => type.upc,
"average_cost" => type |> Ammo.get_average_cost_for_type(current_user),
"round_count" => type |> Ammo.get_round_count_for_type(current_user),
"used_count" => type |> ActivityLog.get_used_count_for_type(current_user),
"pack_count" => type |> Ammo.get_packs_count_for_type(current_user),
"total_pack_count" => type |> Ammo.get_packs_count_for_type(current_user, true)
}
ideal_container = %{
@ -125,7 +125,7 @@ defmodule CanneryWeb.ExportControllerTest do
json_resp = conn |> json_response(200)
assert %{"packs" => [^ideal_pack]} = json_resp
assert %{"ammo_types" => [^ideal_ammo_type]} = json_resp
assert %{"types" => [^ideal_type]} = json_resp
assert %{"containers" => [^ideal_container]} = json_resp
assert %{"shot_records" => [^ideal_shot_record]} = json_resp
assert %{"user" => ^ideal_user} = json_resp

View File

@ -1,13 +1,13 @@
defmodule CanneryWeb.AmmoTypeLiveTest do
defmodule CanneryWeb.TypeLiveTest do
@moduledoc """
Tests the ammo type liveview
Tests the type liveview
"""
use CanneryWeb.ConnCase
import Phoenix.LiveViewTest
alias Cannery.{Ammo, Repo}
@moduletag :ammo_type_live_test
@moduletag :type_live_test
@create_attrs %{
bullet_type: "some bullet_type",
@ -42,39 +42,39 @@ defmodule CanneryWeb.AmmoTypeLiveTest do
count: 20
}
defp create_ammo_type(%{current_user: current_user}) do
[ammo_type: ammo_type_fixture(@create_attrs, current_user)]
defp create_type(%{current_user: current_user}) do
[type: type_fixture(@create_attrs, current_user)]
end
defp create_pack(%{ammo_type: ammo_type, current_user: current_user}) do
defp create_pack(%{type: type, current_user: current_user}) do
container = container_fixture(current_user)
{1, [pack]} = pack_fixture(@pack_attrs, ammo_type, container, current_user)
{1, [pack]} = pack_fixture(@pack_attrs, type, container, current_user)
[pack: pack, container: container]
end
defp create_empty_pack(%{ammo_type: ammo_type, current_user: current_user}) do
defp create_empty_pack(%{type: type, current_user: current_user}) do
container = container_fixture(current_user)
{1, [pack]} = pack_fixture(@pack_attrs, ammo_type, container, current_user)
{1, [pack]} = pack_fixture(@pack_attrs, type, container, current_user)
shot_record = shot_record_fixture(@shot_record_attrs, current_user, pack)
pack = pack |> Repo.reload!()
[pack: pack, container: container, shot_record: shot_record]
end
describe "Index" do
setup [:register_and_log_in_user, :create_ammo_type]
setup [:register_and_log_in_user, :create_type]
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))
test "lists all types", %{conn: conn, type: type} do
{:ok, _index_live, html} = live(conn, Routes.type_index_path(conn, :index))
assert html =~ "Catalog"
assert html =~ ammo_type.bullet_type
assert html =~ type.bullet_type
end
test "can sort by class", %{conn: conn, current_user: current_user} do
rifle_type = ammo_type_fixture(%{class: :rifle}, current_user)
shotgun_type = ammo_type_fixture(%{class: :shotgun}, current_user)
pistol_type = ammo_type_fixture(%{class: :pistol}, current_user)
rifle_type = type_fixture(%{class: :rifle}, current_user)
shotgun_type = type_fixture(%{class: :shotgun}, current_user)
pistol_type = 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.type_index_path(conn, :index))
assert html =~ "All"
@ -85,7 +85,7 @@ defmodule CanneryWeb.AmmoTypeLiveTest do
html =
index_live
|> form(~s/form[phx-change="change_class"]/)
|> render_change(ammo_type: %{class: :rifle})
|> render_change(type: %{class: :rifle})
assert html =~ rifle_type.name
refute html =~ shotgun_type.name
@ -94,7 +94,7 @@ defmodule CanneryWeb.AmmoTypeLiveTest do
html =
index_live
|> form(~s/form[phx-change="change_class"]/)
|> render_change(ammo_type: %{class: :shotgun})
|> render_change(type: %{class: :shotgun})
refute html =~ rifle_type.name
assert html =~ shotgun_type.name
@ -103,7 +103,7 @@ defmodule CanneryWeb.AmmoTypeLiveTest do
html =
index_live
|> form(~s/form[phx-change="change_class"]/)
|> render_change(ammo_type: %{class: :pistol})
|> render_change(type: %{class: :pistol})
refute html =~ rifle_type.name
refute html =~ shotgun_type.name
@ -112,148 +112,148 @@ defmodule CanneryWeb.AmmoTypeLiveTest do
html =
index_live
|> form(~s/form[phx-change="change_class"]/)
|> render_change(ammo_type: %{class: :all})
|> render_change(type: %{class: :all})
assert html =~ rifle_type.name
assert html =~ shotgun_type.name
assert html =~ pistol_type.name
end
test "can search for ammo_type", %{conn: conn, ammo_type: ammo_type} do
{:ok, index_live, html} = live(conn, Routes.ammo_type_index_path(conn, :index))
test "can search for type", %{conn: conn, type: type} do
{:ok, index_live, html} = live(conn, Routes.type_index_path(conn, :index))
assert html =~ ammo_type.bullet_type
assert html =~ type.bullet_type
assert index_live
|> form(~s/form[phx-change="search"]/)
|> render_change(search: %{search_term: ammo_type.bullet_type}) =~
ammo_type.bullet_type
|> render_change(search: %{search_term: type.bullet_type}) =~
type.bullet_type
assert_patch(index_live, Routes.ammo_type_index_path(conn, :search, ammo_type.bullet_type))
assert_patch(index_live, Routes.type_index_path(conn, :search, type.bullet_type))
refute index_live
|> form(~s/form[phx-change="search"]/)
|> render_change(search: %{search_term: "something_else"}) =~ ammo_type.bullet_type
|> render_change(search: %{search_term: "something_else"}) =~ type.bullet_type
assert_patch(index_live, Routes.ammo_type_index_path(conn, :search, "something_else"))
assert_patch(index_live, Routes.type_index_path(conn, :search, "something_else"))
assert index_live
|> form(~s/form[phx-change="search"]/)
|> render_change(search: %{search_term: ""}) =~ ammo_type.bullet_type
|> render_change(search: %{search_term: ""}) =~ type.bullet_type
assert_patch(index_live, Routes.ammo_type_index_path(conn, :index))
assert_patch(index_live, Routes.type_index_path(conn, :index))
end
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))
test "saves new type", %{conn: conn, current_user: current_user, type: type} do
{:ok, index_live, _html} = live(conn, Routes.type_index_path(conn, :index))
assert index_live |> element("a", "New Ammo type") |> render_click() =~ "New Ammo type"
assert_patch(index_live, Routes.ammo_type_index_path(conn, :new))
assert index_live |> element("a", "New Type") |> render_click() =~ "New Type"
assert_patch(index_live, Routes.type_index_path(conn, :new))
assert index_live
|> form("#ammo_type-form")
|> render_change(ammo_type: @invalid_attrs) =~ "can&#39;t be blank"
|> form("#type-form")
|> render_change(type: @invalid_attrs) =~ "can&#39;t be blank"
{:ok, _view, html} =
index_live
|> form("#ammo_type-form")
|> render_submit(ammo_type: @create_attrs)
|> follow_redirect(conn, Routes.ammo_type_index_path(conn, :index))
|> form("#type-form")
|> render_submit(type: @create_attrs)
|> follow_redirect(conn, Routes.type_index_path(conn, :index))
ammo_type = ammo_type.id |> Ammo.get_ammo_type!(current_user)
assert html =~ "#{ammo_type.name} created successfully"
type = type.id |> Ammo.get_type!(current_user)
assert html =~ "#{type.name} created successfully"
assert html =~ "some bullet_type"
end
test "updates ammo_type in listing",
%{conn: conn, current_user: current_user, ammo_type: ammo_type} do
{:ok, index_live, _html} = live(conn, Routes.ammo_type_index_path(conn, :index))
test "updates type in listing",
%{conn: conn, current_user: current_user, type: type} do
{:ok, index_live, _html} = live(conn, Routes.type_index_path(conn, :index))
assert index_live |> element(~s/a[aria-label="Edit #{ammo_type.name}"]/) |> render_click() =~
"Edit #{ammo_type.name}"
assert index_live |> element(~s/a[aria-label="Edit #{type.name}"]/) |> render_click() =~
"Edit #{type.name}"
assert_patch(index_live, Routes.ammo_type_index_path(conn, :edit, ammo_type))
assert_patch(index_live, Routes.type_index_path(conn, :edit, type))
assert index_live
|> form("#ammo_type-form")
|> render_change(ammo_type: @invalid_attrs) =~ "can&#39;t be blank"
|> form("#type-form")
|> render_change(type: @invalid_attrs) =~ "can&#39;t be blank"
{:ok, _view, html} =
index_live
|> form("#ammo_type-form")
|> render_submit(ammo_type: @update_attrs)
|> follow_redirect(conn, Routes.ammo_type_index_path(conn, :index))
|> form("#type-form")
|> render_submit(type: @update_attrs)
|> follow_redirect(conn, Routes.type_index_path(conn, :index))
ammo_type = ammo_type.id |> Ammo.get_ammo_type!(current_user)
assert html =~ "#{ammo_type.name} updated successfully"
type = type.id |> Ammo.get_type!(current_user)
assert html =~ "#{type.name} updated successfully"
assert html =~ "some updated bullet_type"
end
test "clones ammo_type in listing",
%{conn: conn, current_user: current_user, ammo_type: ammo_type} do
{:ok, index_live, _html} = live(conn, Routes.ammo_type_index_path(conn, :index))
test "clones type in listing",
%{conn: conn, current_user: current_user, type: type} do
{:ok, index_live, _html} = live(conn, Routes.type_index_path(conn, :index))
html = index_live |> element(~s/a[aria-label="Clone #{ammo_type.name}"]/) |> render_click()
assert html =~ "New Ammo type"
html = index_live |> element(~s/a[aria-label="Clone #{type.name}"]/) |> render_click()
assert html =~ "New Type"
assert html =~ "some bullet_type"
assert_patch(index_live, Routes.ammo_type_index_path(conn, :clone, ammo_type))
assert_patch(index_live, Routes.type_index_path(conn, :clone, type))
assert index_live
|> form("#ammo_type-form")
|> render_change(ammo_type: @invalid_attrs) =~ "can&#39;t be blank"
|> form("#type-form")
|> render_change(type: @invalid_attrs) =~ "can&#39;t be blank"
{:ok, _view, html} =
index_live
|> form("#ammo_type-form")
|> render_submit(ammo_type: @create_attrs)
|> follow_redirect(conn, Routes.ammo_type_index_path(conn, :index))
|> form("#type-form")
|> render_submit(type: @create_attrs)
|> follow_redirect(conn, Routes.type_index_path(conn, :index))
ammo_type = ammo_type.id |> Ammo.get_ammo_type!(current_user)
assert html =~ "#{ammo_type.name} created successfully"
type = type.id |> Ammo.get_type!(current_user)
assert html =~ "#{type.name} created successfully"
assert html =~ "some bullet_type"
end
test "clones ammo_type in listing with updates",
%{conn: conn, current_user: current_user, ammo_type: ammo_type} do
{:ok, index_live, _html} = live(conn, Routes.ammo_type_index_path(conn, :index))
test "clones type in listing with updates",
%{conn: conn, current_user: current_user, type: type} do
{:ok, index_live, _html} = live(conn, Routes.type_index_path(conn, :index))
html = index_live |> element(~s/a[aria-label="Clone #{ammo_type.name}"]/) |> render_click()
assert html =~ "New Ammo type"
html = index_live |> element(~s/a[aria-label="Clone #{type.name}"]/) |> render_click()
assert html =~ "New Type"
assert html =~ "some bullet_type"
assert_patch(index_live, Routes.ammo_type_index_path(conn, :clone, ammo_type))
assert_patch(index_live, Routes.type_index_path(conn, :clone, type))
assert index_live
|> form("#ammo_type-form")
|> render_change(ammo_type: @invalid_attrs) =~ "can&#39;t be blank"
|> form("#type-form")
|> render_change(type: @invalid_attrs) =~ "can&#39;t be blank"
{:ok, _view, html} =
index_live
|> form("#ammo_type-form")
|> form("#type-form")
|> render_submit(
ammo_type: Map.merge(@create_attrs, %{bullet_type: "some updated bullet_type"})
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.type_index_path(conn, :index))
ammo_type = ammo_type.id |> Ammo.get_ammo_type!(current_user)
assert html =~ "#{ammo_type.name} created successfully"
type = type.id |> Ammo.get_type!(current_user)
assert html =~ "#{type.name} created successfully"
assert html =~ "some updated bullet_type"
end
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))
assert index_live |> element(~s/a[aria-label="Delete #{ammo_type.name}"]/) |> render_click()
refute has_element?(index_live, "#ammo_type-#{ammo_type.id}")
test "deletes type in listing", %{conn: conn, type: type} do
{:ok, index_live, _html} = live(conn, Routes.type_index_path(conn, :index))
assert index_live |> element(~s/a[aria-label="Delete #{type.name}"]/) |> render_click()
refute has_element?(index_live, "#type-#{type.id}")
end
end
describe "Index with pack" do
setup [:register_and_log_in_user, :create_ammo_type, :create_pack]
setup [:register_and_log_in_user, :create_type, :create_pack]
test "shows used packs on toggle",
%{conn: conn, pack: pack, 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.type_index_path(conn, :index))
assert html =~ "Show used"
refute html =~ "Used rounds"
@ -277,7 +277,7 @@ defmodule CanneryWeb.AmmoTypeLiveTest do
shot_record_fixture(%{count: 5}, current_user, pack)
{:ok, index_live, _html} = live(conn, Routes.ammo_type_index_path(conn, :index))
{:ok, index_live, _html} = live(conn, Routes.type_index_path(conn, :index))
html =
index_live
@ -289,62 +289,62 @@ defmodule CanneryWeb.AmmoTypeLiveTest do
end
end
describe "Show ammo type" do
setup [:register_and_log_in_user, :create_ammo_type]
describe "Show type" do
setup [:register_and_log_in_user, :create_type]
test "displays ammo_type", %{
test "displays type", %{
conn: conn,
ammo_type: %{name: name, bullet_type: bullet_type} = ammo_type
type: %{name: name, bullet_type: bullet_type} = type
} do
{:ok, _show_live, html} = live(conn, Routes.ammo_type_show_path(conn, :show, ammo_type))
{:ok, _show_live, html} = live(conn, Routes.type_show_path(conn, :show, type))
assert html =~ name
assert html =~ bullet_type
end
test "updates ammo_type within modal",
%{conn: conn, current_user: current_user, ammo_type: %{name: name} = ammo_type} do
{:ok, show_live, _html} = live(conn, Routes.ammo_type_show_path(conn, :show, ammo_type))
test "updates type within modal",
%{conn: conn, current_user: current_user, type: %{name: name} = type} do
{:ok, show_live, _html} = live(conn, Routes.type_show_path(conn, :show, type))
assert show_live |> element(~s/a[aria-label="Edit #{ammo_type.name}"]/) |> render_click() =~
assert show_live |> element(~s/a[aria-label="Edit #{type.name}"]/) |> render_click() =~
"Edit #{name}"
assert_patch(show_live, Routes.ammo_type_show_path(conn, :edit, ammo_type))
assert_patch(show_live, Routes.type_show_path(conn, :edit, type))
assert show_live
|> form("#ammo_type-form")
|> render_change(ammo_type: @invalid_attrs) =~ "can&#39;t be blank"
|> form("#type-form")
|> render_change(type: @invalid_attrs) =~ "can&#39;t be blank"
{:ok, _view, html} =
show_live
|> form("#ammo_type-form")
|> render_submit(ammo_type: @update_attrs)
|> follow_redirect(conn, Routes.ammo_type_show_path(conn, :show, ammo_type))
|> form("#type-form")
|> render_submit(type: @update_attrs)
|> follow_redirect(conn, Routes.type_show_path(conn, :show, type))
ammo_type = ammo_type.id |> Ammo.get_ammo_type!(current_user)
assert html =~ "#{ammo_type.name} updated successfully"
type = type.id |> Ammo.get_type!(current_user)
assert html =~ "#{type.name} updated successfully"
assert html =~ "some updated bullet_type"
end
end
describe "Show ammo type with pack" do
setup [:register_and_log_in_user, :create_ammo_type, :create_pack]
describe "Show type with pack" do
setup [:register_and_log_in_user, :create_type, :create_pack]
test "displays pack", %{
conn: conn,
ammo_type: %{name: ammo_type_name} = ammo_type,
type: %{name: type_name} = 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.type_show_path(conn, :show, type))
assert html =~ ammo_type_name
assert html =~ type_name
assert html =~ "\n20\n"
assert html =~ container_name
end
test "displays pack in table",
%{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))
%{conn: conn, type: type, container: %{name: container_name}} do
{:ok, show_live, _html} = live(conn, Routes.type_show_path(conn, :show, type))
html =
show_live
@ -356,12 +356,12 @@ defmodule CanneryWeb.AmmoTypeLiveTest do
end
end
describe "Show ammo type with empty pack" do
setup [:register_and_log_in_user, :create_ammo_type, :create_empty_pack]
describe "Show type with empty pack" do
setup [:register_and_log_in_user, :create_type, :create_empty_pack]
test "displays empty packs on toggle",
%{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))
%{conn: conn, type: type, container: %{name: container_name}} do
{:ok, show_live, html} = live(conn, Routes.type_show_path(conn, :show, type))
assert html =~ "Show used"
refute html =~ "\n20\n"
@ -376,8 +376,8 @@ defmodule CanneryWeb.AmmoTypeLiveTest do
end
test "displays empty packs in table on toggle",
%{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))
%{conn: conn, type: type, container: %{name: container_name}} do
{:ok, show_live, _html} = live(conn, Routes.type_show_path(conn, :show, type))
html =
show_live

View File

@ -22,7 +22,7 @@ defmodule CanneryWeb.ContainerLiveTest do
type: "some updated type"
}
@invalid_attrs %{desc: nil, location: nil, name: nil, type: nil}
@ammo_type_attrs %{
@type_attrs %{
bullet_type: "some bullet_type",
case_material: "some case_material",
desc: "some desc",
@ -41,10 +41,10 @@ defmodule CanneryWeb.ContainerLiveTest do
end
defp create_pack(%{container: container, current_user: current_user}) do
ammo_type = ammo_type_fixture(@ammo_type_attrs, current_user)
{1, [pack]} = pack_fixture(@pack_attrs, ammo_type, container, current_user)
type = type_fixture(@type_attrs, current_user)
{1, [pack]} = pack_fixture(@pack_attrs, type, container, current_user)
[ammo_type: ammo_type, pack: pack]
[type: type, pack: pack]
end
describe "Index" do
@ -245,56 +245,56 @@ defmodule CanneryWeb.ContainerLiveTest do
test "can sort by type",
%{conn: conn, container: container, current_user: current_user} do
rifle_type = ammo_type_fixture(%{class: :rifle}, current_user)
rifle_type = type_fixture(%{class: :rifle}, current_user)
{1, [rifle_pack]} = pack_fixture(rifle_type, container, current_user)
shotgun_type = ammo_type_fixture(%{class: :shotgun}, current_user)
shotgun_type = type_fixture(%{class: :shotgun}, current_user)
{1, [shotgun_pack]} = pack_fixture(shotgun_type, container, current_user)
pistol_type = ammo_type_fixture(%{class: :pistol}, current_user)
pistol_type = type_fixture(%{class: :pistol}, current_user)
{1, [pistol_pack]} = pack_fixture(pistol_type, container, current_user)
{:ok, index_live, html} = live(conn, Routes.container_show_path(conn, :show, container))
assert html =~ "All"
assert html =~ rifle_pack.ammo_type.name
assert html =~ shotgun_pack.ammo_type.name
assert html =~ pistol_pack.ammo_type.name
assert html =~ rifle_pack.type.name
assert html =~ shotgun_pack.type.name
assert html =~ pistol_pack.type.name
html =
index_live
|> form(~s/form[phx-change="change_class"]/)
|> render_change(ammo_type: %{class: :rifle})
|> render_change(type: %{class: :rifle})
assert html =~ rifle_pack.ammo_type.name
refute html =~ shotgun_pack.ammo_type.name
refute html =~ pistol_pack.ammo_type.name
assert html =~ rifle_pack.type.name
refute html =~ shotgun_pack.type.name
refute html =~ pistol_pack.type.name
html =
index_live
|> form(~s/form[phx-change="change_class"]/)
|> render_change(ammo_type: %{class: :shotgun})
|> render_change(type: %{class: :shotgun})
refute html =~ rifle_pack.ammo_type.name
assert html =~ shotgun_pack.ammo_type.name
refute html =~ pistol_pack.ammo_type.name
refute html =~ rifle_pack.type.name
assert html =~ shotgun_pack.type.name
refute html =~ pistol_pack.type.name
html =
index_live
|> form(~s/form[phx-change="change_class"]/)
|> render_change(ammo_type: %{class: :pistol})
|> render_change(type: %{class: :pistol})
refute html =~ rifle_pack.ammo_type.name
refute html =~ shotgun_pack.ammo_type.name
assert html =~ pistol_pack.ammo_type.name
refute html =~ rifle_pack.type.name
refute html =~ shotgun_pack.type.name
assert html =~ pistol_pack.type.name
html =
index_live
|> form(~s/form[phx-change="change_class"]/)
|> render_change(ammo_type: %{class: :all})
|> render_change(type: %{class: :all})
assert html =~ rifle_pack.ammo_type.name
assert html =~ shotgun_pack.ammo_type.name
assert html =~ pistol_pack.ammo_type.name
assert html =~ rifle_pack.type.name
assert html =~ shotgun_pack.type.name
assert html =~ pistol_pack.type.name
end
end
@ -302,15 +302,15 @@ defmodule CanneryWeb.ContainerLiveTest do
setup [:register_and_log_in_user, :create_container, :create_pack]
test "displays pack",
%{conn: conn, ammo_type: %{name: ammo_type_name}, container: container} do
%{conn: conn, type: %{name: type_name}, container: container} do
{:ok, _show_live, html} = live(conn, Routes.container_show_path(conn, :show, container))
assert html =~ ammo_type_name
assert html =~ type_name
assert html =~ "\n20\n"
end
test "displays pack in table",
%{conn: conn, ammo_type: %{name: ammo_type_name}, container: container} do
%{conn: conn, type: %{name: type_name}, container: container} do
{:ok, show_live, _html} = live(conn, Routes.container_show_path(conn, :show, container))
html =
@ -318,7 +318,7 @@ defmodule CanneryWeb.ContainerLiveTest do
|> element(~s/input[type="checkbox"][aria-labelledby="toggle_table-label"}]/)
|> render_click()
assert html =~ ammo_type_name
assert html =~ type_name
assert html =~ "\n20\n"
end
end

View File

@ -29,10 +29,10 @@ defmodule CanneryWeb.PackLiveTest do
}
defp create_pack(%{current_user: current_user}) do
ammo_type = ammo_type_fixture(current_user)
type = type_fixture(current_user)
container = container_fixture(current_user)
{1, [pack]} = pack_fixture(@create_attrs, ammo_type, container, current_user)
[ammo_type: ammo_type, pack: pack, container: container]
{1, [pack]} = pack_fixture(@create_attrs, type, container, current_user)
[type: type, pack: pack, container: container]
end
defp create_shot_record(%{current_user: current_user, pack: pack}) do
@ -43,10 +43,10 @@ defmodule CanneryWeb.PackLiveTest do
defp create_empty_pack(%{
current_user: current_user,
ammo_type: ammo_type,
type: type,
container: container
}) do
{1, [pack]} = pack_fixture(@empty_attrs, ammo_type, container, current_user)
{1, [pack]} = pack_fixture(@empty_attrs, type, container, current_user)
shot_record = shot_record_fixture(@shot_record_attrs, current_user, pack)
pack = pack |> Repo.reload!()
[empty_pack: pack, shot_record: shot_record]
@ -57,92 +57,92 @@ defmodule CanneryWeb.PackLiveTest do
test "lists all packs", %{conn: conn, pack: pack} do
{:ok, _index_live, html} = live(conn, Routes.pack_index_path(conn, :index))
pack = pack |> Repo.preload(:ammo_type)
pack = pack |> Repo.preload(:type)
assert html =~ "Ammo"
assert html =~ pack.ammo_type.name
assert html =~ pack.type.name
end
test "can sort by type",
%{conn: conn, container: container, current_user: current_user} do
rifle_type = ammo_type_fixture(%{class: :rifle}, current_user)
rifle_type = type_fixture(%{class: :rifle}, current_user)
{1, [rifle_pack]} = pack_fixture(rifle_type, container, current_user)
shotgun_type = ammo_type_fixture(%{class: :shotgun}, current_user)
shotgun_type = type_fixture(%{class: :shotgun}, current_user)
{1, [shotgun_pack]} = pack_fixture(shotgun_type, container, current_user)
pistol_type = ammo_type_fixture(%{class: :pistol}, current_user)
pistol_type = type_fixture(%{class: :pistol}, current_user)
{1, [pistol_pack]} = pack_fixture(pistol_type, container, current_user)
{:ok, index_live, html} = live(conn, Routes.pack_index_path(conn, :index))
assert html =~ "All"
assert html =~ rifle_pack.ammo_type.name
assert html =~ shotgun_pack.ammo_type.name
assert html =~ pistol_pack.ammo_type.name
assert html =~ rifle_pack.type.name
assert html =~ shotgun_pack.type.name
assert html =~ pistol_pack.type.name
html =
index_live
|> form(~s/form[phx-change="change_class"]/)
|> render_change(ammo_type: %{class: :rifle})
|> render_change(type: %{class: :rifle})
assert html =~ rifle_pack.ammo_type.name
refute html =~ shotgun_pack.ammo_type.name
refute html =~ pistol_pack.ammo_type.name
assert html =~ rifle_pack.type.name
refute html =~ shotgun_pack.type.name
refute html =~ pistol_pack.type.name
html =
index_live
|> form(~s/form[phx-change="change_class"]/)
|> render_change(ammo_type: %{class: :shotgun})
|> render_change(type: %{class: :shotgun})
refute html =~ rifle_pack.ammo_type.name
assert html =~ shotgun_pack.ammo_type.name
refute html =~ pistol_pack.ammo_type.name
refute html =~ rifle_pack.type.name
assert html =~ shotgun_pack.type.name
refute html =~ pistol_pack.type.name
html =
index_live
|> form(~s/form[phx-change="change_class"]/)
|> render_change(ammo_type: %{class: :pistol})
|> render_change(type: %{class: :pistol})
refute html =~ rifle_pack.ammo_type.name
refute html =~ shotgun_pack.ammo_type.name
assert html =~ pistol_pack.ammo_type.name
refute html =~ rifle_pack.type.name
refute html =~ shotgun_pack.type.name
assert html =~ pistol_pack.type.name
html =
index_live
|> form(~s/form[phx-change="change_class"]/)
|> render_change(ammo_type: %{class: :all})
|> render_change(type: %{class: :all})
assert html =~ rifle_pack.ammo_type.name
assert html =~ shotgun_pack.ammo_type.name
assert html =~ pistol_pack.ammo_type.name
assert html =~ rifle_pack.type.name
assert html =~ shotgun_pack.type.name
assert html =~ pistol_pack.type.name
end
test "can search for packs", %{conn: conn, pack: pack} do
{:ok, index_live, html} = live(conn, Routes.pack_index_path(conn, :index))
pack = pack |> Repo.preload(:ammo_type)
pack = pack |> Repo.preload(:type)
assert html =~ pack.ammo_type.name
assert html =~ pack.type.name
assert index_live
|> form(~s/form[phx-change="search"]/)
|> render_change(search: %{search_term: pack.ammo_type.name}) =~
pack.ammo_type.name
|> render_change(search: %{search_term: pack.type.name}) =~
pack.type.name
assert_patch(
index_live,
Routes.pack_index_path(conn, :search, pack.ammo_type.name)
Routes.pack_index_path(conn, :search, pack.type.name)
)
refute index_live
|> form(~s/form[phx-change="search"]/)
|> render_change(search: %{search_term: "something_else"}) =~
pack.ammo_type.name
pack.type.name
assert_patch(index_live, Routes.pack_index_path(conn, :search, "something_else"))
assert index_live
|> form(~s/form[phx-change="search"]/)
|> render_change(search: %{search_term: ""}) =~ pack.ammo_type.name
|> render_change(search: %{search_term: ""}) =~ pack.type.name
assert_patch(index_live, Routes.pack_index_path(conn, :index))
end
@ -366,9 +366,9 @@ defmodule CanneryWeb.PackLiveTest do
test "displays pack", %{conn: conn, pack: pack} do
{:ok, _show_live, html} = live(conn, Routes.pack_show_path(conn, :show, pack))
pack = pack |> Repo.preload(:ammo_type)
pack = pack |> Repo.preload(:type)
assert html =~ "Show Ammo"
assert html =~ pack.ammo_type.name
assert html =~ pack.type.name
end
test "updates pack within modal", %{conn: conn, pack: pack} do

View File

@ -14,9 +14,9 @@ defmodule CanneryWeb.RangeLiveTest do
defp create_shot_record(%{current_user: current_user}) do
container = container_fixture(%{staged: true}, current_user)
ammo_type = ammo_type_fixture(current_user)
type = type_fixture(current_user)
{1, [pack]} = pack_fixture(%{staged: true}, ammo_type, container, current_user)
{1, [pack]} = pack_fixture(%{staged: true}, type, container, current_user)
shot_record =
%{count: 5, date: ~N[2022-02-13 03:17:00], notes: "some notes"}
@ -24,7 +24,7 @@ defmodule CanneryWeb.RangeLiveTest do
[
container: container,
ammo_type: ammo_type,
type: type,
pack: pack,
shot_record: shot_record
]
@ -42,18 +42,18 @@ defmodule CanneryWeb.RangeLiveTest do
test "can sort by type",
%{conn: conn, container: container, current_user: current_user} do
rifle_ammo_type = ammo_type_fixture(%{class: :rifle}, current_user)
{1, [rifle_pack]} = pack_fixture(rifle_ammo_type, container, current_user)
rifle_type = type_fixture(%{class: :rifle}, current_user)
{1, [rifle_pack]} = pack_fixture(rifle_type, container, current_user)
rifle_shot_record = shot_record_fixture(%{notes: "group_one"}, current_user, rifle_pack)
shotgun_ammo_type = ammo_type_fixture(%{class: :shotgun}, current_user)
{1, [shotgun_pack]} = pack_fixture(shotgun_ammo_type, container, current_user)
shotgun_type = type_fixture(%{class: :shotgun}, current_user)
{1, [shotgun_pack]} = pack_fixture(shotgun_type, container, current_user)
shotgun_shot_record = shot_record_fixture(%{notes: "group_two"}, current_user, shotgun_pack)
pistol_ammo_type = ammo_type_fixture(%{class: :pistol}, current_user)
{1, [pistol_pack]} = pack_fixture(pistol_ammo_type, container, current_user)
pistol_type = type_fixture(%{class: :pistol}, current_user)
{1, [pistol_pack]} = pack_fixture(pistol_type, container, current_user)
pistol_shot_record = shot_record_fixture(%{notes: "group_three"}, current_user, pistol_pack)
@ -68,7 +68,7 @@ defmodule CanneryWeb.RangeLiveTest do
html =
index_live
|> form(~s/form[phx-change="change_class"]/)
|> render_change(ammo_type: %{class: :rifle})
|> render_change(type: %{class: :rifle})
assert html =~ rifle_shot_record.notes
refute html =~ shotgun_shot_record.notes
@ -77,7 +77,7 @@ defmodule CanneryWeb.RangeLiveTest do
html =
index_live
|> form(~s/form[phx-change="change_class"]/)
|> render_change(ammo_type: %{class: :shotgun})
|> render_change(type: %{class: :shotgun})
refute html =~ rifle_shot_record.notes
assert html =~ shotgun_shot_record.notes
@ -86,7 +86,7 @@ defmodule CanneryWeb.RangeLiveTest do
html =
index_live
|> form(~s/form[phx-change="change_class"]/)
|> render_change(ammo_type: %{class: :pistol})
|> render_change(type: %{class: :pistol})
refute html =~ rifle_shot_record.notes
refute html =~ shotgun_shot_record.notes
@ -95,7 +95,7 @@ defmodule CanneryWeb.RangeLiveTest do
html =
index_live
|> form(~s/form[phx-change="change_class"]/)
|> render_change(ammo_type: %{class: :all})
|> render_change(type: %{class: :all})
assert html =~ rifle_shot_record.notes
assert html =~ shotgun_shot_record.notes

View File

@ -10,8 +10,8 @@ defmodule Cannery.Fixtures do
Accounts.User,
ActivityLog.ShotRecord,
Ammo,
Ammo.AmmoType,
Ammo.Pack,
Ammo.Type,
Containers,
Containers.Container,
Containers.Tag,
@ -102,11 +102,11 @@ defmodule Cannery.Fixtures do
end
@doc """
Generate a AmmoType
Generate a Type
"""
@spec ammo_type_fixture(User.t()) :: AmmoType.t()
@spec ammo_type_fixture(attrs :: map(), User.t()) :: AmmoType.t()
def ammo_type_fixture(attrs \\ %{}, %User{} = user) do
@spec type_fixture(User.t()) :: Type.t()
@spec type_fixture(attrs :: map(), User.t()) :: Type.t()
def type_fixture(attrs \\ %{}, %User{} = user) do
attrs
|> Enum.into(%{
name: random_string(),
@ -142,34 +142,34 @@ defmodule Cannery.Fixtures do
manufacturer: random_string(),
upc: random_string()
})
|> Ammo.create_ammo_type(user)
|> Ammo.create_type(user)
|> unwrap_ok_tuple()
end
@doc """
Generate a Pack
"""
@spec pack_fixture(AmmoType.t(), Container.t(), User.t()) ::
@spec pack_fixture(Type.t(), Container.t(), User.t()) ::
{count :: non_neg_integer(), [Pack.t()]}
@spec pack_fixture(attrs :: map(), AmmoType.t(), Container.t(), User.t()) ::
@spec pack_fixture(attrs :: map(), Type.t(), Container.t(), User.t()) ::
{count :: non_neg_integer(), [Pack.t()]}
@spec pack_fixture(
attrs :: map(),
multiplier :: non_neg_integer(),
AmmoType.t(),
Type.t(),
Container.t(),
User.t()
) :: {count :: non_neg_integer(), [Pack.t()]}
def pack_fixture(
attrs \\ %{},
multiplier \\ 1,
%AmmoType{id: ammo_type_id},
%Type{id: type_id},
%Container{id: container_id},
%User{} = user
) do
attrs
|> Enum.into(%{
ammo_type_id: ammo_type_id,
type_id: type_id,
container_id: container_id,
count: 20,
purchased_on: Date.utc_today()