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 # v0.9.1
- Rename ammo type's "type" to "class" to avoid confusion - 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 - Fixes shot records table disappearing after selecting an empty ammo class
- Code quality improvements - Code quality improvements

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,10 +1,10 @@
defmodule CanneryWeb.AmmoTypeLive.Show do defmodule CanneryWeb.TypeLive.Show do
@moduledoc """ @moduledoc """
Liveview for showing and editing an Cannery.Ammo.AmmoType Liveview for showing and editing an Cannery.Ammo.Type
""" """
use CanneryWeb, :live_view use CanneryWeb, :live_view
alias Cannery.{ActivityLog, Ammo, Ammo.AmmoType, Containers} alias Cannery.{ActivityLog, Ammo, Ammo.Type, Containers}
alias CanneryWeb.Endpoint alias CanneryWeb.Endpoint
@impl true @impl true
@ -13,38 +13,38 @@ defmodule CanneryWeb.AmmoTypeLive.Show do
@impl true @impl true
def handle_params(%{"id" => id}, _params, socket) do def handle_params(%{"id" => id}, _params, socket) do
{:noreply, socket |> display_ammo_type(id)} {:noreply, socket |> display_type(id)}
end end
@impl true @impl true
def handle_event( def handle_event(
"delete", "delete",
_params, _params,
%{assigns: %{ammo_type: ammo_type, current_user: current_user}} = socket %{assigns: %{type: type, current_user: current_user}} = socket
) do ) 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) prompt = dgettext("prompts", "%{name} deleted succesfully", name: type_name)
redirect_to = Routes.ammo_type_index_path(socket, :index) redirect_to = Routes.type_index_path(socket, :index)
{:noreply, socket |> put_flash(:info, prompt) |> push_navigate(to: redirect_to)} {:noreply, socket |> put_flash(:info, prompt) |> push_navigate(to: redirect_to)}
end end
def handle_event("toggle_show_used", _params, %{assigns: %{show_used: show_used}} = socket) do 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 end
def handle_event("toggle_table", _params, %{assigns: %{view_table: view_table}} = socket) do def handle_event("toggle_table", _params, %{assigns: %{view_table: view_table}} = socket) do
{:noreply, socket |> assign(:view_table, !view_table)} {:noreply, socket |> assign(:view_table, !view_table)}
end end
defp display_ammo_type( defp display_type(
%{assigns: %{live_action: live_action, current_user: current_user, show_used: show_used}} = %{assigns: %{live_action: live_action, current_user: current_user, show_used: show_used}} =
socket, socket,
%AmmoType{name: ammo_type_name} = ammo_type %Type{name: type_name} = type
) do ) do
custom_fields? = custom_fields? =
fields_to_display(ammo_type) fields_to_display(type)
|> Enum.any?(fn %{key: field, type: type} -> |> Enum.any?(fn %{key: field, type: type} ->
default_value = default_value =
case type do case type do
@ -52,10 +52,10 @@ defmodule CanneryWeb.AmmoTypeLive.Show do
_other_type -> nil _other_type -> nil
end end
ammo_type |> Map.get(field) != default_value type |> Map.get(field) != default_value
end) 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, original_counts,
@ -67,10 +67,10 @@ defmodule CanneryWeb.AmmoTypeLive.Show do
if show_used do if show_used do
[ [
packs |> Ammo.get_original_counts(current_user), packs |> Ammo.get_original_counts(current_user),
ammo_type |> Ammo.get_used_packs_count_for_type(current_user), type |> Ammo.get_used_packs_count_for_type(current_user),
ammo_type |> Ammo.get_packs_count_for_type(current_user, true), type |> Ammo.get_packs_count_for_type(current_user, true),
ammo_type |> ActivityLog.get_used_count_for_ammo_type(current_user), type |> ActivityLog.get_used_count_for_type(current_user),
ammo_type |> Ammo.get_historical_count_for_ammo_type(current_user) type |> Ammo.get_historical_count_for_type(current_user)
] ]
else else
[nil, nil, nil, nil, nil] [nil, nil, nil, nil, nil]
@ -78,8 +78,8 @@ defmodule CanneryWeb.AmmoTypeLive.Show do
page_title = page_title =
case live_action do case live_action do
:show -> ammo_type_name :show -> type_name
:edit -> gettext("Edit %{ammo_type_name}", ammo_type_name: ammo_type_name) :edit -> gettext("Edit %{type_name}", type_name: type_name)
end end
containers = containers =
@ -90,33 +90,33 @@ defmodule CanneryWeb.AmmoTypeLive.Show do
socket socket
|> assign( |> assign(
page_title: page_title, page_title: page_title,
ammo_type: ammo_type, type: type,
packs: packs, packs: packs,
containers: containers, containers: containers,
cprs: packs |> Ammo.get_cprs(current_user), cprs: packs |> Ammo.get_cprs(current_user),
last_used_dates: packs |> ActivityLog.get_last_used_dates(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), avg_cost_per_round: type |> Ammo.get_average_cost_for_type(current_user),
rounds: ammo_type |> Ammo.get_round_count_for_ammo_type(current_user), rounds: type |> Ammo.get_round_count_for_type(current_user),
original_counts: original_counts, original_counts: original_counts,
used_rounds: used_rounds, used_rounds: used_rounds,
historical_round_count: historical_round_count, 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, used_packs_count: used_packs_count,
historical_packs_count: historical_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? custom_fields?: custom_fields?
) )
end end
defp display_ammo_type(%{assigns: %{current_user: current_user}} = socket, ammo_type_id) do defp display_type(%{assigns: %{current_user: current_user}} = socket, type_id) do
socket |> display_ammo_type(Ammo.get_ammo_type!(ammo_type_id, current_user)) socket |> display_type(Ammo.get_type!(type_id, current_user))
end end
defp display_ammo_type(%{assigns: %{ammo_type: ammo_type}} = socket) do defp display_type(%{assigns: %{type: type}} = socket) do
socket |> display_ammo_type(ammo_type) socket |> display_type(type)
end end
defp fields_to_display(%AmmoType{class: class}) do defp fields_to_display(%Type{class: class}) do
[ [
%{label: gettext("Cartridge:"), key: :cartridge, type: :string}, %{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"> <div class="space-y-4 flex flex-col justify-center items-center">
<h1 class="title text-2xl title-primary-500"> <h1 class="title text-2xl title-primary-500">
<%= @ammo_type.name %> <%= @type.name %>
</h1> </h1>
<span <span
:if={@ammo_type.desc} :if={@type.desc}
class="max-w-2xl w-full px-8 py-4 rounded-lg class="max-w-2xl w-full px-8 py-4 rounded-lg
text-center title text-lg text-center title text-lg
border border-primary-600" border border-primary-600"
> >
<%= @ammo_type.desc %> <%= @type.desc %>
</span> </span>
<div class="flex space-x-4 justify-center items-center text-primary-600"> <div class="flex space-x-4 justify-center items-center text-primary-600">
<.link <.link
patch={Routes.ammo_type_show_path(Endpoint, :edit, @ammo_type)} patch={Routes.type_show_path(Endpoint, :edit, @type)}
class="text-primary-600 link" 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> <i class="fa-fw fa-lg fas fa-edit"></i>
</.link> </.link>
@ -29,12 +29,10 @@
dgettext( dgettext(
"prompts", "prompts",
"Are you sure you want to delete %{name}? This will delete all %{name} type ammo as well!", "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={ aria-label={dgettext("actions", "Delete %{type_name}", type_name: @type.name)}
dgettext("actions", "Delete %{ammo_type_name}", ammo_type_name: @ammo_type.name)
}
> >
<i class="fa-fw fa-lg fas fa-trash"></i> <i class="fa-fw fa-lg fas fa-trash"></i>
</.link> </.link>
@ -42,14 +40,14 @@
<hr class="hr" /> <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"> <div class="grid sm:grid-cols-2 gap-4 text-center justify-center items-center">
<h3 class="title text-lg"> <h3 class="title text-lg">
<%= gettext("Class") %> <%= gettext("Class") %>
</h3> </h3>
<span class="text-primary-600"> <span class="text-primary-600">
<%= case @ammo_type.class do %> <%= case @type.class do %>
<% :shotgun -> %> <% :shotgun -> %>
<%= gettext("Shotgun") %> <%= gettext("Shotgun") %>
<% :rifle -> %> <% :rifle -> %>
@ -62,7 +60,7 @@
</span> </span>
<%= for %{label: label, key: key, type: type} <- @fields_to_display do %> <%= 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"> <h3 class="title text-lg">
<%= label %> <%= label %>
</h3> </h3>
@ -70,9 +68,9 @@
<span class="text-primary-600"> <span class="text-primary-600">
<%= case type do %> <%= case type do %>
<% :boolean -> %> <% :boolean -> %>
<%= @ammo_type |> Map.get(key) |> humanize() %> <%= @type |> Map.get(key) |> humanize() %>
<% _ -> %> <% _ -> %>
<%= @ammo_type |> Map.get(key) %> <%= @type |> Map.get(key) %>
<% end %> <% end %>
</span> </span>
<% end %> <% end %>
@ -140,7 +138,7 @@
</h3> </h3>
<span class="text-primary-600"> <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> </span>
<%= if @avg_cost_per_round do %> <%= if @avg_cost_per_round do %>
@ -184,7 +182,7 @@
<%= if @view_table do %> <%= if @view_table do %>
<.live_component <.live_component
module={CanneryWeb.Components.PackTableComponent} module={CanneryWeb.Components.PackTableComponent}
id="ammo-type-show-table" id="type-show-table"
packs={@packs} packs={@packs}
current_user={@current_user} current_user={@current_user}
show_used={@show_used} show_used={@show_used}
@ -228,17 +226,14 @@
</div> </div>
</div> </div>
<.modal <.modal :if={@live_action == :edit} return_to={Routes.type_show_path(Endpoint, :show, @type)}>
:if={@live_action == :edit}
return_to={Routes.ammo_type_show_path(Endpoint, :show, @ammo_type)}
>
<.live_component <.live_component
module={CanneryWeb.AmmoTypeLive.FormComponent} module={CanneryWeb.TypeLive.FormComponent}
id={@ammo_type.id} id={@type.id}
title={@page_title} title={@page_title}
action={@live_action} action={@live_action}
ammo_type={@ammo_type} type={@type}
return_to={Routes.ammo_type_show_path(Endpoint, :show, @ammo_type)} return_to={Routes.type_show_path(Endpoint, :show, @type)}
current_user={@current_user} current_user={@current_user}
/> />
</.modal> </.modal>

View File

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

View File

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

View File

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

View File

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

View File

@ -122,19 +122,19 @@ defmodule CanneryWeb.PackLive.Index do
{:noreply, socket} {:noreply, socket}
end 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()} {:noreply, socket |> assign(:class, :rifle) |> display_packs()}
end 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()} {:noreply, socket |> assign(:class, :shotgun) |> display_packs()}
end 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()} {:noreply, socket |> assign(:class, :pistol) |> display_packs()}
end 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()} {:noreply, socket |> assign(:class, :all) |> display_packs()}
end end
@ -152,13 +152,13 @@ defmodule CanneryWeb.PackLive.Index do
# prompts # prompts
packs_count = Ammo.get_packs_count!(current_user, true) packs_count = Ammo.get_packs_count!(current_user, true)
packs = Ammo.list_packs(search, class, current_user, show_used) 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) containers_count = Containers.get_containers_count!(current_user)
socket socket
|> assign( |> assign(
packs: packs, packs: packs,
ammo_types_count: ammo_types_count, types_count: types_count,
containers_count: containers_count, containers_count: containers_count,
packs_count: packs_count packs_count: packs_count
) )

View File

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

View File

@ -1,6 +1,6 @@
<div class="mx-auto space-y-4 max-w-3xl flex flex-col justify-center items-center"> <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"> <h1 class="title text-2xl title-primary-500">
<%= @pack.ammo_type.name %> <%= @pack.type.name %>
</h1> </h1>
<div class="space-y-2 flex flex-col justify-center items-center"> <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-col justify-center items-center">
<div class="flex flex-wrap justify-center items-center text-primary-600"> <div class="flex flex-wrap justify-center items-center text-primary-600">
<.link <.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" class="mx-4 my-2 btn btn-primary"
> >
<%= dgettext("actions", "View in Catalog") %> <%= 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))} {:noreply, socket |> push_patch(to: Routes.range_index_path(Endpoint, :search, search_term))}
end 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()} {:noreply, socket |> assign(:class, :rifle) |> display_shot_records()}
end 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()} {:noreply, socket |> assign(:class, :shotgun) |> display_shot_records()}
end 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()} {:noreply, socket |> assign(:class, :pistol) |> display_shot_records()}
end 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()} {:noreply, socket |> assign(:class, :all) |> display_shot_records()}
end end

View File

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

View File

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

View File

@ -82,11 +82,6 @@ msgstr ""
msgid "Make your first tag!" msgid "Make your first tag!"
msgstr "" 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 #: lib/cannery_web/live/container_live/index.html.heex:17
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "New Container" msgid "New Container"
@ -203,11 +198,6 @@ msgstr ""
msgid "View in Catalog" msgid "View in Catalog"
msgstr "" 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/components/move_pack_component.ex:78
#: lib/cannery_web/live/pack_live/index.html.heex:144 #: lib/cannery_web/live/pack_live/index.html.heex:144
#: lib/cannery_web/live/pack_live/show.html.heex:89 #: lib/cannery_web/live/pack_live/show.html.heex:89
@ -237,11 +227,6 @@ msgstr ""
msgid "Export Data as JSON" msgid "Export Data as JSON"
msgstr "" 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:87
#: lib/cannery_web/live/container_live/index.html.heex:145 #: lib/cannery_web/live/container_live/index.html.heex:145
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
@ -253,12 +238,6 @@ msgstr ""
msgid "Copy invite link for %{invite_name}" msgid "Copy invite link for %{invite_name}"
msgstr "" 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:104
#: lib/cannery_web/live/container_live/index.html.heex:162 #: lib/cannery_web/live/container_live/index.html.heex:162
#: lib/cannery_web/live/container_live/show.html.heex:48 #: lib/cannery_web/live/container_live/show.html.heex:48
@ -276,12 +255,6 @@ msgstr ""
msgid "Delete invite for %{invite_name}" msgid "Delete invite for %{invite_name}"
msgstr "" 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:77
#: lib/cannery_web/live/container_live/index.html.heex:135 #: lib/cannery_web/live/container_live/index.html.heex:135
#: lib/cannery_web/live/container_live/show.html.heex:35 #: lib/cannery_web/live/container_live/show.html.heex:35
@ -315,11 +288,6 @@ msgstr ""
msgid "Unstage" msgid "Unstage"
msgstr "" 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 #: lib/cannery_web/live/pack_live/index.html.heex:174
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Clone pack of %{pack_count} bullets" msgid "Clone pack of %{pack_count} bullets"
@ -337,7 +305,7 @@ msgstr ""
msgid "Edit pack of %{pack_count} bullets" msgid "Edit pack of %{pack_count} bullets"
msgstr "" 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 #: lib/cannery_web/live/pack_live/index.html.heex:154
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "View pack of %{pack_count} bullets" msgid "View pack of %{pack_count} bullets"
@ -354,3 +322,35 @@ msgstr ""
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Edit shot record of %{shot_record_count} shots" msgid "Edit shot record of %{shot_record_count} shots"
msgstr "" 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!" msgid "Make your first tag!"
msgstr "Erstellen Sie ihren ersten 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 #: lib/cannery_web/live/container_live/index.html.heex:17
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "New Container" msgid "New Container"
@ -216,11 +211,6 @@ msgstr "Sprache wechseln"
msgid "View in Catalog" msgid "View in Catalog"
msgstr "" 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/components/move_pack_component.ex:78
#: lib/cannery_web/live/pack_live/index.html.heex:144 #: lib/cannery_web/live/pack_live/index.html.heex:144
#: lib/cannery_web/live/pack_live/show.html.heex:89 #: lib/cannery_web/live/pack_live/show.html.heex:89
@ -250,11 +240,6 @@ msgstr ""
msgid "Export Data as JSON" msgid "Export Data as JSON"
msgstr "" 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:87
#: lib/cannery_web/live/container_live/index.html.heex:145 #: lib/cannery_web/live/container_live/index.html.heex:145
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
@ -266,12 +251,6 @@ msgstr ""
msgid "Copy invite link for %{invite_name}" msgid "Copy invite link for %{invite_name}"
msgstr "" 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:104
#: lib/cannery_web/live/container_live/index.html.heex:162 #: lib/cannery_web/live/container_live/index.html.heex:162
#: lib/cannery_web/live/container_live/show.html.heex:48 #: lib/cannery_web/live/container_live/show.html.heex:48
@ -289,12 +268,6 @@ msgstr ""
msgid "Delete invite for %{invite_name}" msgid "Delete invite for %{invite_name}"
msgstr "" 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:77
#: lib/cannery_web/live/container_live/index.html.heex:135 #: lib/cannery_web/live/container_live/index.html.heex:135
#: lib/cannery_web/live/container_live/show.html.heex:35 #: lib/cannery_web/live/container_live/show.html.heex:35
@ -328,11 +301,6 @@ msgstr ""
msgid "Unstage" msgid "Unstage"
msgstr "" 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 #: lib/cannery_web/live/pack_live/index.html.heex:174
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "Clone pack of %{pack_count} bullets" msgid "Clone pack of %{pack_count} bullets"
@ -350,7 +318,7 @@ msgstr ""
msgid "Edit pack of %{pack_count} bullets" msgid "Edit pack of %{pack_count} bullets"
msgstr "" 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 #: lib/cannery_web/live/pack_live/index.html.heex:154
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "View pack of %{pack_count} bullets" msgid "View pack of %{pack_count} bullets"
@ -367,3 +335,35 @@ msgstr ""
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "Edit shot record of %{shot_record_count} shots" msgid "Edit shot record of %{shot_record_count} shots"
msgstr "" 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" msgid "Ammo"
msgstr "Munition" 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 #: lib/cannery_web/live/tag_live/form_component.html.heex:25
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Background color" msgid "Background color"
@ -240,12 +234,6 @@ msgstr "Meine coole Munitionskiste"
msgid "Name" msgid "Name"
msgstr "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:32
#: lib/cannery_web/live/container_live/index.ex:39 #: lib/cannery_web/live/container_live/index.ex:39
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
@ -267,7 +255,7 @@ msgstr "Neuer Tag"
msgid "No Ammo" msgid "No Ammo"
msgstr "Keine Munition" 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 #, elixir-autogen, elixir-format
msgid "No ammo for this type" msgid "No ammo for this type"
msgstr "Keine Munition dieser Art" msgstr "Keine Munition dieser Art"
@ -403,7 +391,9 @@ msgstr "Leuchtspur"
#: lib/cannery_web/components/container_table_component.ex:48 #: lib/cannery_web/components/container_table_component.ex:48
#: lib/cannery_web/components/move_pack_component.ex:66 #: 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/container_live/form_component.html.heex:39
#: lib/cannery_web/live/pack_live/form_component.html.heex:22
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Type" msgid "Type"
msgstr "Art" msgstr "Art"
@ -513,7 +503,7 @@ msgstr "Schießkladde"
#: lib/cannery_web/components/core_components/pack_card.html.heex:47 #: 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:163
#: lib/cannery_web/components/pack_table_component.ex:246 #: 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:37
#: lib/cannery_web/live/pack_live/show.html.heex:42 #: lib/cannery_web/live/pack_live/show.html.heex:42
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
@ -596,7 +586,7 @@ msgid "Edit %{name} tags"
msgstr "Editiere %{name} Tags" msgstr "Editiere %{name} Tags"
#: lib/cannery_web/components/core_components/container_card.html.heex:37 #: 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 #: lib/cannery_web/live/container_live/show.html.heex:27
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Rounds:" msgid "Rounds:"
@ -605,7 +595,7 @@ msgstr "Patronen:"
#: lib/cannery_web/components/ammo_type_table_component.ex:260 #: 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:160
#: lib/cannery_web/components/pack_table_component.ex:242 #: 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 #, elixir-autogen, elixir-format
msgid "No cost information" msgid "No cost information"
msgstr "Keine Preisinformationen" msgstr "Keine Preisinformationen"
@ -676,7 +666,7 @@ msgstr "Schüsse dokumentieren"
msgid "Copies" msgid "Copies"
msgstr "Kopien" 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 #, elixir-autogen, elixir-format
msgid "Added on:" msgid "Added on:"
msgstr "Hinzugefügt am:" 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" msgstr "Diese Munitionsgruppe ist nicht in einem Behälter"
#: lib/cannery_web/components/core_components/container_card.html.heex:32 #: 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 #: lib/cannery_web/live/container_live/show.html.heex:22
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Packs:" msgid "Packs:"
@ -784,7 +774,7 @@ msgid "Container:"
msgstr "Behälter" msgstr "Behälter"
#: lib/cannery_web/live/ammo_type_live/index.html.heex:64 #: lib/cannery_web/live/ammo_type_live/index.html.heex:64
#: lib/cannery_web/live/ammo_type_live/show.html.heex:166 #: lib/cannery_web/live/ammo_type_live/show.html.heex:164
#: lib/cannery_web/live/pack_live/index.html.heex:87 #: lib/cannery_web/live/pack_live/index.html.heex:87
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Show used" msgid "Show used"
@ -813,7 +803,7 @@ msgstr ""
msgid "Rounds" msgid "Rounds"
msgstr "Patronen:" 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/index.html.heex:40
#: lib/cannery_web/live/container_live/show.html.heex:115 #: lib/cannery_web/live/container_live/show.html.heex:115
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
@ -825,7 +815,7 @@ msgstr ""
msgid "Total ever packs" msgid "Total ever packs"
msgstr "" 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 #, elixir-autogen, elixir-format
msgid "Total ever packs:" msgid "Total ever packs:"
msgstr "" msgstr ""
@ -835,7 +825,7 @@ msgstr ""
msgid "Total ever rounds" msgid "Total ever rounds"
msgstr "Summe aller Patronen" 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 #, elixir-autogen, elixir-format, fuzzy
msgid "Total ever rounds:" msgid "Total ever rounds:"
msgstr "Summe abgegebener Schüsse:" msgstr "Summe abgegebener Schüsse:"
@ -845,7 +835,7 @@ msgstr "Summe abgegebener Schüsse:"
msgid "Used packs" msgid "Used packs"
msgstr "" 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 #, elixir-autogen, elixir-format
msgid "Used packs:" msgid "Used packs:"
msgstr "" msgstr ""
@ -855,7 +845,7 @@ msgstr ""
msgid "Used rounds" msgid "Used rounds"
msgstr "" 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 #, elixir-autogen, elixir-format, fuzzy
msgid "Used rounds:" msgid "Used rounds:"
msgstr "" msgstr ""
@ -961,17 +951,11 @@ msgid "UPC:"
msgstr "UPC" msgstr "UPC"
#: lib/cannery_web/components/ammo_type_table_component.ex:102 #: 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 #, elixir-autogen, elixir-format
msgid "Average CPR" msgid "Average CPR"
msgstr "" 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/core_components/pack_card.html.heex:17
#: lib/cannery_web/components/pack_table_component.ex:250 #: lib/cannery_web/components/pack_table_component.ex:250
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
@ -1035,12 +1019,6 @@ msgstr ""
msgid "Edit ammo" msgid "Edit ammo"
msgstr "Munitionstyp bearbeiten" 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 #: lib/cannery_web/live/ammo_type_live/index.html.heex:58
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Search catalog" msgid "Search catalog"
@ -1311,14 +1289,14 @@ msgstr ""
msgid "No ammo" msgid "No ammo"
msgstr "Keine Munition" 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 #, elixir-autogen, elixir-format
msgid "None specified" msgid "None specified"
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:25 #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:25
#: lib/cannery_web/live/ammo_type_live/index.html.heex:38 #: lib/cannery_web/live/ammo_type_live/index.html.heex:38
#: lib/cannery_web/live/ammo_type_live/show.html.heex:58 #: lib/cannery_web/live/ammo_type_live/show.html.heex:56
#: lib/cannery_web/live/container_live/show.html.heex:106 #: lib/cannery_web/live/container_live/show.html.heex:106
#: lib/cannery_web/live/pack_live/index.html.heex:61 #: lib/cannery_web/live/pack_live/index.html.heex:61
#: lib/cannery_web/live/range_live/index.html.heex:95 #: 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/form_component.html.heex:25
#: lib/cannery_web/live/ammo_type_live/index.html.heex:36 #: lib/cannery_web/live/ammo_type_live/index.html.heex:36
#: lib/cannery_web/live/ammo_type_live/show.html.heex:56 #: lib/cannery_web/live/ammo_type_live/show.html.heex:54
#: lib/cannery_web/live/container_live/show.html.heex:104 #: lib/cannery_web/live/container_live/show.html.heex:104
#: lib/cannery_web/live/pack_live/index.html.heex:59 #: lib/cannery_web/live/pack_live/index.html.heex:59
#: lib/cannery_web/live/range_live/index.html.heex:93 #: 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/form_component.html.heex:25
#: lib/cannery_web/live/ammo_type_live/index.html.heex:37 #: lib/cannery_web/live/ammo_type_live/index.html.heex:37
#: lib/cannery_web/live/ammo_type_live/show.html.heex:54 #: lib/cannery_web/live/ammo_type_live/show.html.heex:52
#: lib/cannery_web/live/container_live/show.html.heex:105 #: lib/cannery_web/live/container_live/show.html.heex:105
#: lib/cannery_web/live/pack_live/index.html.heex:60 #: lib/cannery_web/live/pack_live/index.html.heex:60
#: lib/cannery_web/live/range_live/index.html.heex:94 #: 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/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/form_component.html.heex:21
#: lib/cannery_web/live/ammo_type_live/index.html.heex:29 #: 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/container_live/show.html.heex:97
#: lib/cannery_web/live/pack_live/index.html.heex:50 #: lib/cannery_web/live/pack_live/index.html.heex:50
#: lib/cannery_web/live/range_live/index.html.heex:86 #: lib/cannery_web/live/range_live/index.html.heex:86
@ -1465,3 +1443,21 @@ msgstr ""
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "Edit Shot Record" msgid "Edit Shot Record"
msgstr "Schießkladde editieren" 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 " "Ungültige Nummer an Kopien. Muss zwischen 1 and %{max} liegen. War "
"%{multiplier}" "%{multiplier}"
#: lib/cannery/ammo.ex:1123 #: lib/cannery/ammo.ex:1121
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Invalid multiplier" msgid "Invalid multiplier"
msgstr "" 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 #: lib/cannery_web/live/range_live/index.html.heex:74
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Your browser does not support the canvas element." msgid "Your browser does not support the canvas element."
@ -212,3 +207,8 @@ msgstr "Anzahl muss weniger als %{count} betragen"
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "can't be blank" msgid "can't be blank"
msgstr "" 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 ## Run "mix gettext.extract" to bring this file up to
## date. Leave "msgstr"s empty as changing them here has no ## date. Leave "msgstr"s empty as changing them here has no
## effect: edit them in PO (.po) files instead. ## effect: edit them in PO (.po) files instead.
#: lib/cannery_web/live/ammo_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/container_live/form_component.ex:89
#: lib/cannery_web/live/invite_live/form_component.ex:80 #: lib/cannery_web/live/invite_live/form_component.ex:80
#: lib/cannery_web/live/tag_live/form_component.ex:78 #: lib/cannery_web/live/tag_live/form_component.ex:78
@ -44,7 +44,7 @@ msgstr "%{name} erfolgreich gelöscht"
msgid "%{name} has been deleted" msgid "%{name} has been deleted"
msgstr "%{name} wurde gelöscht" 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/container_live/form_component.ex:70
#: lib/cannery_web/live/invite_live/form_component.ex:62 #: lib/cannery_web/live/invite_live/form_component.ex:62
#: lib/cannery_web/live/tag_live/form_component.ex:60 #: 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[0] "Munitionsgruppe erfolgreich aktualisiert"
msgstr[1] "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 #: lib/cannery_web/live/ammo_type_live/show.html.heex:29
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "Are you sure you want to delete %{name}? This will delete all %{name} type ammo as well!" 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" msgid "Ammo"
msgstr "" 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 #: lib/cannery_web/live/tag_live/form_component.html.heex:25
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Background color" msgid "Background color"
@ -236,12 +230,6 @@ msgstr ""
msgid "Name" msgid "Name"
msgstr "" 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:32
#: lib/cannery_web/live/container_live/index.ex:39 #: lib/cannery_web/live/container_live/index.ex:39
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
@ -263,7 +251,7 @@ msgstr ""
msgid "No Ammo" msgid "No Ammo"
msgstr "" 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 #, elixir-autogen, elixir-format
msgid "No ammo for this type" msgid "No ammo for this type"
msgstr "" msgstr ""
@ -397,7 +385,9 @@ msgstr ""
#: lib/cannery_web/components/container_table_component.ex:48 #: lib/cannery_web/components/container_table_component.ex:48
#: lib/cannery_web/components/move_pack_component.ex:66 #: 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/container_live/form_component.html.heex:39
#: lib/cannery_web/live/pack_live/form_component.html.heex:22
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Type" msgid "Type"
msgstr "" msgstr ""
@ -507,7 +497,7 @@ msgstr ""
#: lib/cannery_web/components/core_components/pack_card.html.heex:47 #: 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:163
#: lib/cannery_web/components/pack_table_component.ex:246 #: 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:37
#: lib/cannery_web/live/pack_live/show.html.heex:42 #: lib/cannery_web/live/pack_live/show.html.heex:42
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
@ -590,7 +580,7 @@ msgid "Edit %{name} tags"
msgstr "" msgstr ""
#: lib/cannery_web/components/core_components/container_card.html.heex:37 #: 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 #: lib/cannery_web/live/container_live/show.html.heex:27
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Rounds:" msgid "Rounds:"
@ -599,7 +589,7 @@ msgstr ""
#: lib/cannery_web/components/ammo_type_table_component.ex:260 #: 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:160
#: lib/cannery_web/components/pack_table_component.ex:242 #: 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 #, elixir-autogen, elixir-format
msgid "No cost information" msgid "No cost information"
msgstr "" msgstr ""
@ -670,7 +660,7 @@ msgstr ""
msgid "Copies" msgid "Copies"
msgstr "" 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 #, elixir-autogen, elixir-format
msgid "Added on:" msgid "Added on:"
msgstr "" msgstr ""
@ -750,7 +740,7 @@ msgid "This ammo is not in a container"
msgstr "" msgstr ""
#: lib/cannery_web/components/core_components/container_card.html.heex:32 #: 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 #: lib/cannery_web/live/container_live/show.html.heex:22
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Packs:" msgid "Packs:"
@ -778,7 +768,7 @@ msgid "Container:"
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:64 #: lib/cannery_web/live/ammo_type_live/index.html.heex:64
#: lib/cannery_web/live/ammo_type_live/show.html.heex:166 #: lib/cannery_web/live/ammo_type_live/show.html.heex:164
#: lib/cannery_web/live/pack_live/index.html.heex:87 #: lib/cannery_web/live/pack_live/index.html.heex:87
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Show used" msgid "Show used"
@ -807,7 +797,7 @@ msgstr ""
msgid "Rounds" msgid "Rounds"
msgstr "" 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/index.html.heex:40
#: lib/cannery_web/live/container_live/show.html.heex:115 #: lib/cannery_web/live/container_live/show.html.heex:115
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
@ -819,7 +809,7 @@ msgstr ""
msgid "Total ever packs" msgid "Total ever packs"
msgstr "" 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 #, elixir-autogen, elixir-format
msgid "Total ever packs:" msgid "Total ever packs:"
msgstr "" msgstr ""
@ -829,7 +819,7 @@ msgstr ""
msgid "Total ever rounds" msgid "Total ever rounds"
msgstr "" 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 #, elixir-autogen, elixir-format
msgid "Total ever rounds:" msgid "Total ever rounds:"
msgstr "" msgstr ""
@ -839,7 +829,7 @@ msgstr ""
msgid "Used packs" msgid "Used packs"
msgstr "" 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 #, elixir-autogen, elixir-format
msgid "Used packs:" msgid "Used packs:"
msgstr "" msgstr ""
@ -849,7 +839,7 @@ msgstr ""
msgid "Used rounds" msgid "Used rounds"
msgstr "" 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 #, elixir-autogen, elixir-format
msgid "Used rounds:" msgid "Used rounds:"
msgstr "" msgstr ""
@ -955,17 +945,11 @@ msgid "UPC:"
msgstr "" msgstr ""
#: lib/cannery_web/components/ammo_type_table_component.ex:102 #: 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 #, elixir-autogen, elixir-format
msgid "Average CPR" msgid "Average CPR"
msgstr "" 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/core_components/pack_card.html.heex:17
#: lib/cannery_web/components/pack_table_component.ex:250 #: lib/cannery_web/components/pack_table_component.ex:250
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
@ -1029,12 +1013,6 @@ msgstr ""
msgid "Edit ammo" msgid "Edit ammo"
msgstr "" 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 #: lib/cannery_web/live/ammo_type_live/index.html.heex:58
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Search catalog" msgid "Search catalog"
@ -1294,14 +1272,14 @@ msgstr ""
msgid "No ammo" msgid "No ammo"
msgstr "" 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 #, elixir-autogen, elixir-format
msgid "None specified" msgid "None specified"
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:25 #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:25
#: lib/cannery_web/live/ammo_type_live/index.html.heex:38 #: lib/cannery_web/live/ammo_type_live/index.html.heex:38
#: lib/cannery_web/live/ammo_type_live/show.html.heex:58 #: lib/cannery_web/live/ammo_type_live/show.html.heex:56
#: lib/cannery_web/live/container_live/show.html.heex:106 #: lib/cannery_web/live/container_live/show.html.heex:106
#: lib/cannery_web/live/pack_live/index.html.heex:61 #: lib/cannery_web/live/pack_live/index.html.heex:61
#: lib/cannery_web/live/range_live/index.html.heex:95 #: 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/form_component.html.heex:25
#: lib/cannery_web/live/ammo_type_live/index.html.heex:36 #: lib/cannery_web/live/ammo_type_live/index.html.heex:36
#: lib/cannery_web/live/ammo_type_live/show.html.heex:56 #: lib/cannery_web/live/ammo_type_live/show.html.heex:54
#: lib/cannery_web/live/container_live/show.html.heex:104 #: lib/cannery_web/live/container_live/show.html.heex:104
#: lib/cannery_web/live/pack_live/index.html.heex:59 #: lib/cannery_web/live/pack_live/index.html.heex:59
#: lib/cannery_web/live/range_live/index.html.heex:93 #: 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/form_component.html.heex:25
#: lib/cannery_web/live/ammo_type_live/index.html.heex:37 #: lib/cannery_web/live/ammo_type_live/index.html.heex:37
#: lib/cannery_web/live/ammo_type_live/show.html.heex:54 #: lib/cannery_web/live/ammo_type_live/show.html.heex:52
#: lib/cannery_web/live/container_live/show.html.heex:105 #: lib/cannery_web/live/container_live/show.html.heex:105
#: lib/cannery_web/live/pack_live/index.html.heex:60 #: lib/cannery_web/live/pack_live/index.html.heex:60
#: lib/cannery_web/live/range_live/index.html.heex:94 #: 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/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/form_component.html.heex:21
#: lib/cannery_web/live/ammo_type_live/index.html.heex:29 #: 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/container_live/show.html.heex:97
#: lib/cannery_web/live/pack_live/index.html.heex:50 #: lib/cannery_web/live/pack_live/index.html.heex:50
#: lib/cannery_web/live/range_live/index.html.heex:86 #: lib/cannery_web/live/range_live/index.html.heex:86
@ -1448,3 +1426,21 @@ msgstr ""
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Edit Shot Record" msgid "Edit Shot Record"
msgstr "" 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!" msgid "Make your first tag!"
msgstr "" 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 #: lib/cannery_web/live/container_live/index.html.heex:17
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "New Container" msgid "New Container"
@ -203,11 +198,6 @@ msgstr ""
msgid "View in Catalog" msgid "View in Catalog"
msgstr "" 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/components/move_pack_component.ex:78
#: lib/cannery_web/live/pack_live/index.html.heex:144 #: lib/cannery_web/live/pack_live/index.html.heex:144
#: lib/cannery_web/live/pack_live/show.html.heex:89 #: lib/cannery_web/live/pack_live/show.html.heex:89
@ -237,11 +227,6 @@ msgstr ""
msgid "Export Data as JSON" msgid "Export Data as JSON"
msgstr "" 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:87
#: lib/cannery_web/live/container_live/index.html.heex:145 #: lib/cannery_web/live/container_live/index.html.heex:145
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
@ -253,12 +238,6 @@ msgstr ""
msgid "Copy invite link for %{invite_name}" msgid "Copy invite link for %{invite_name}"
msgstr "" 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:104
#: lib/cannery_web/live/container_live/index.html.heex:162 #: lib/cannery_web/live/container_live/index.html.heex:162
#: lib/cannery_web/live/container_live/show.html.heex:48 #: lib/cannery_web/live/container_live/show.html.heex:48
@ -276,12 +255,6 @@ msgstr ""
msgid "Delete invite for %{invite_name}" msgid "Delete invite for %{invite_name}"
msgstr "" 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:77
#: lib/cannery_web/live/container_live/index.html.heex:135 #: lib/cannery_web/live/container_live/index.html.heex:135
#: lib/cannery_web/live/container_live/show.html.heex:35 #: lib/cannery_web/live/container_live/show.html.heex:35
@ -315,11 +288,6 @@ msgstr ""
msgid "Unstage" msgid "Unstage"
msgstr "" 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 #: lib/cannery_web/live/pack_live/index.html.heex:174
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "Clone pack of %{pack_count} bullets" msgid "Clone pack of %{pack_count} bullets"
@ -337,7 +305,7 @@ msgstr ""
msgid "Edit pack of %{pack_count} bullets" msgid "Edit pack of %{pack_count} bullets"
msgstr "" 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 #: lib/cannery_web/live/pack_live/index.html.heex:154
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "View pack of %{pack_count} bullets" msgid "View pack of %{pack_count} bullets"
@ -354,3 +322,35 @@ msgstr ""
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "Edit shot record of %{shot_record_count} shots" msgid "Edit shot record of %{shot_record_count} shots"
msgstr "" 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" msgid "Ammo"
msgstr "" 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 #: lib/cannery_web/live/tag_live/form_component.html.heex:25
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Background color" msgid "Background color"
@ -236,12 +230,6 @@ msgstr ""
msgid "Name" msgid "Name"
msgstr "" 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:32
#: lib/cannery_web/live/container_live/index.ex:39 #: lib/cannery_web/live/container_live/index.ex:39
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
@ -263,7 +251,7 @@ msgstr ""
msgid "No Ammo" msgid "No Ammo"
msgstr "" 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 #, elixir-autogen, elixir-format
msgid "No ammo for this type" msgid "No ammo for this type"
msgstr "" msgstr ""
@ -397,7 +385,9 @@ msgstr ""
#: lib/cannery_web/components/container_table_component.ex:48 #: lib/cannery_web/components/container_table_component.ex:48
#: lib/cannery_web/components/move_pack_component.ex:66 #: 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/container_live/form_component.html.heex:39
#: lib/cannery_web/live/pack_live/form_component.html.heex:22
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Type" msgid "Type"
msgstr "" msgstr ""
@ -507,7 +497,7 @@ msgstr ""
#: lib/cannery_web/components/core_components/pack_card.html.heex:47 #: 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:163
#: lib/cannery_web/components/pack_table_component.ex:246 #: 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:37
#: lib/cannery_web/live/pack_live/show.html.heex:42 #: lib/cannery_web/live/pack_live/show.html.heex:42
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
@ -590,7 +580,7 @@ msgid "Edit %{name} tags"
msgstr "" msgstr ""
#: lib/cannery_web/components/core_components/container_card.html.heex:37 #: 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 #: lib/cannery_web/live/container_live/show.html.heex:27
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "Rounds:" msgid "Rounds:"
@ -599,7 +589,7 @@ msgstr ""
#: lib/cannery_web/components/ammo_type_table_component.ex:260 #: 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:160
#: lib/cannery_web/components/pack_table_component.ex:242 #: 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 #, elixir-autogen, elixir-format
msgid "No cost information" msgid "No cost information"
msgstr "" msgstr ""
@ -670,7 +660,7 @@ msgstr ""
msgid "Copies" msgid "Copies"
msgstr "" 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 #, elixir-autogen, elixir-format
msgid "Added on:" msgid "Added on:"
msgstr "" msgstr ""
@ -750,7 +740,7 @@ msgid "This ammo is not in a container"
msgstr "" msgstr ""
#: lib/cannery_web/components/core_components/container_card.html.heex:32 #: 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 #: lib/cannery_web/live/container_live/show.html.heex:22
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Packs:" msgid "Packs:"
@ -778,7 +768,7 @@ msgid "Container:"
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:64 #: lib/cannery_web/live/ammo_type_live/index.html.heex:64
#: lib/cannery_web/live/ammo_type_live/show.html.heex:166 #: lib/cannery_web/live/ammo_type_live/show.html.heex:164
#: lib/cannery_web/live/pack_live/index.html.heex:87 #: lib/cannery_web/live/pack_live/index.html.heex:87
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Show used" msgid "Show used"
@ -807,7 +797,7 @@ msgstr ""
msgid "Rounds" msgid "Rounds"
msgstr "" 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/index.html.heex:40
#: lib/cannery_web/live/container_live/show.html.heex:115 #: lib/cannery_web/live/container_live/show.html.heex:115
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
@ -819,7 +809,7 @@ msgstr ""
msgid "Total ever packs" msgid "Total ever packs"
msgstr "" 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 #, elixir-autogen, elixir-format
msgid "Total ever packs:" msgid "Total ever packs:"
msgstr "" msgstr ""
@ -829,7 +819,7 @@ msgstr ""
msgid "Total ever rounds" msgid "Total ever rounds"
msgstr "" 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 #, elixir-autogen, elixir-format, fuzzy
msgid "Total ever rounds:" msgid "Total ever rounds:"
msgstr "" msgstr ""
@ -839,7 +829,7 @@ msgstr ""
msgid "Used packs" msgid "Used packs"
msgstr "" 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 #, elixir-autogen, elixir-format
msgid "Used packs:" msgid "Used packs:"
msgstr "" msgstr ""
@ -849,7 +839,7 @@ msgstr ""
msgid "Used rounds" msgid "Used rounds"
msgstr "" 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 #, elixir-autogen, elixir-format, fuzzy
msgid "Used rounds:" msgid "Used rounds:"
msgstr "" msgstr ""
@ -955,17 +945,11 @@ msgid "UPC:"
msgstr "" msgstr ""
#: lib/cannery_web/components/ammo_type_table_component.ex:102 #: 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 #, elixir-autogen, elixir-format
msgid "Average CPR" msgid "Average CPR"
msgstr "" 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/core_components/pack_card.html.heex:17
#: lib/cannery_web/components/pack_table_component.ex:250 #: lib/cannery_web/components/pack_table_component.ex:250
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
@ -1029,12 +1013,6 @@ msgstr ""
msgid "Edit ammo" msgid "Edit ammo"
msgstr "" 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 #: lib/cannery_web/live/ammo_type_live/index.html.heex:58
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Search catalog" msgid "Search catalog"
@ -1294,14 +1272,14 @@ msgstr ""
msgid "No ammo" msgid "No ammo"
msgstr "" 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 #, elixir-autogen, elixir-format
msgid "None specified" msgid "None specified"
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:25 #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:25
#: lib/cannery_web/live/ammo_type_live/index.html.heex:38 #: lib/cannery_web/live/ammo_type_live/index.html.heex:38
#: lib/cannery_web/live/ammo_type_live/show.html.heex:58 #: lib/cannery_web/live/ammo_type_live/show.html.heex:56
#: lib/cannery_web/live/container_live/show.html.heex:106 #: lib/cannery_web/live/container_live/show.html.heex:106
#: lib/cannery_web/live/pack_live/index.html.heex:61 #: lib/cannery_web/live/pack_live/index.html.heex:61
#: lib/cannery_web/live/range_live/index.html.heex:95 #: 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/form_component.html.heex:25
#: lib/cannery_web/live/ammo_type_live/index.html.heex:36 #: lib/cannery_web/live/ammo_type_live/index.html.heex:36
#: lib/cannery_web/live/ammo_type_live/show.html.heex:56 #: lib/cannery_web/live/ammo_type_live/show.html.heex:54
#: lib/cannery_web/live/container_live/show.html.heex:104 #: lib/cannery_web/live/container_live/show.html.heex:104
#: lib/cannery_web/live/pack_live/index.html.heex:59 #: lib/cannery_web/live/pack_live/index.html.heex:59
#: lib/cannery_web/live/range_live/index.html.heex:93 #: 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/form_component.html.heex:25
#: lib/cannery_web/live/ammo_type_live/index.html.heex:37 #: lib/cannery_web/live/ammo_type_live/index.html.heex:37
#: lib/cannery_web/live/ammo_type_live/show.html.heex:54 #: lib/cannery_web/live/ammo_type_live/show.html.heex:52
#: lib/cannery_web/live/container_live/show.html.heex:105 #: lib/cannery_web/live/container_live/show.html.heex:105
#: lib/cannery_web/live/pack_live/index.html.heex:60 #: lib/cannery_web/live/pack_live/index.html.heex:60
#: lib/cannery_web/live/range_live/index.html.heex:94 #: 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/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/form_component.html.heex:21
#: lib/cannery_web/live/ammo_type_live/index.html.heex:29 #: 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/container_live/show.html.heex:97
#: lib/cannery_web/live/pack_live/index.html.heex:50 #: lib/cannery_web/live/pack_live/index.html.heex:50
#: lib/cannery_web/live/range_live/index.html.heex:86 #: lib/cannery_web/live/range_live/index.html.heex:86
@ -1448,3 +1426,21 @@ msgstr ""
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "Edit Shot Record" msgid "Edit Shot Record"
msgstr "" 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}" msgid "Invalid number of copies, must be between 1 and %{max}. Was %{multiplier}"
msgstr "" msgstr ""
#: lib/cannery/ammo.ex:1123 #: lib/cannery/ammo.ex:1121
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Invalid multiplier" msgid "Invalid multiplier"
msgstr "" 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 #: lib/cannery_web/live/range_live/index.html.heex:74
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Your browser does not support the canvas element." msgid "Your browser does not support the canvas element."
@ -195,3 +190,8 @@ msgstr ""
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "can't be blank" msgid "can't be blank"
msgstr "" 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 "" msgstr ""
"Language: en\n" "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/container_live/form_component.ex:89
#: lib/cannery_web/live/invite_live/form_component.ex:80 #: lib/cannery_web/live/invite_live/form_component.ex:80
#: lib/cannery_web/live/tag_live/form_component.ex:78 #: lib/cannery_web/live/tag_live/form_component.ex:78
@ -31,7 +31,7 @@ msgstr ""
msgid "%{name} has been deleted" msgid "%{name} has been deleted"
msgstr "" 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/container_live/form_component.ex:70
#: lib/cannery_web/live/invite_live/form_component.ex:62 #: lib/cannery_web/live/invite_live/form_component.ex:62
#: lib/cannery_web/live/tag_live/form_component.ex:60 #: lib/cannery_web/live/tag_live/form_component.ex:60
@ -236,7 +236,7 @@ msgid_plural "Ammo added successfully"
msgstr[0] "" msgstr[0] ""
msgstr[1] "" 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 #: lib/cannery_web/live/ammo_type_live/show.html.heex:29
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "Are you sure you want to delete %{name}? This will delete all %{name} type ammo as well!" 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}" msgid "Invalid number of copies, must be between 1 and %{max}. Was %{multiplier}"
msgstr "" msgstr ""
#: lib/cannery/ammo.ex:1123 #: lib/cannery/ammo.ex:1121
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Invalid multiplier" msgid "Invalid multiplier"
msgstr "" 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 #: lib/cannery_web/live/range_live/index.html.heex:74
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Your browser does not support the canvas element." msgid "Your browser does not support the canvas element."
@ -194,3 +189,8 @@ msgstr ""
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "can't be blank" msgid "can't be blank"
msgstr "" 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!" msgid "Make your first tag!"
msgstr "¡Aplica tu primera etiqueta!" 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 #: lib/cannery_web/live/container_live/index.html.heex:17
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "New Container" msgid "New Container"
@ -216,11 +211,6 @@ msgstr "Cambiar lenguaje"
msgid "View in Catalog" msgid "View in Catalog"
msgstr "Ver en Catalogo" 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/components/move_pack_component.ex:78
#: lib/cannery_web/live/pack_live/index.html.heex:144 #: lib/cannery_web/live/pack_live/index.html.heex:144
#: lib/cannery_web/live/pack_live/show.html.heex:89 #: 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" msgid "Export Data as JSON"
msgstr "Exportar datos como 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:87
#: lib/cannery_web/live/container_live/index.html.heex:145 #: lib/cannery_web/live/container_live/index.html.heex:145
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
@ -266,12 +251,6 @@ msgstr ""
msgid "Copy invite link for %{invite_name}" msgid "Copy invite link for %{invite_name}"
msgstr "" 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:104
#: lib/cannery_web/live/container_live/index.html.heex:162 #: lib/cannery_web/live/container_live/index.html.heex:162
#: lib/cannery_web/live/container_live/show.html.heex:48 #: lib/cannery_web/live/container_live/show.html.heex:48
@ -289,12 +268,6 @@ msgstr ""
msgid "Delete invite for %{invite_name}" msgid "Delete invite for %{invite_name}"
msgstr "" 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:77
#: lib/cannery_web/live/container_live/index.html.heex:135 #: lib/cannery_web/live/container_live/index.html.heex:135
#: lib/cannery_web/live/container_live/show.html.heex:35 #: lib/cannery_web/live/container_live/show.html.heex:35
@ -328,11 +301,6 @@ msgstr ""
msgid "Unstage" msgid "Unstage"
msgstr "" 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 #: lib/cannery_web/live/pack_live/index.html.heex:174
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "Clone pack of %{pack_count} bullets" msgid "Clone pack of %{pack_count} bullets"
@ -350,7 +318,7 @@ msgstr ""
msgid "Edit pack of %{pack_count} bullets" msgid "Edit pack of %{pack_count} bullets"
msgstr "" 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 #: lib/cannery_web/live/pack_live/index.html.heex:154
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "View pack of %{pack_count} bullets" msgid "View pack of %{pack_count} bullets"
@ -367,3 +335,35 @@ msgstr ""
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "Edit shot record of %{shot_record_count} shots" msgid "Edit shot record of %{shot_record_count} shots"
msgstr "" 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" msgid "Ammo"
msgstr "Munición" 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 #: lib/cannery_web/live/tag_live/form_component.html.heex:25
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Background color" msgid "Background color"
@ -240,12 +234,6 @@ msgstr "Mi lata de munición guapa"
msgid "Name" msgid "Name"
msgstr "Nombre" 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:32
#: lib/cannery_web/live/container_live/index.ex:39 #: lib/cannery_web/live/container_live/index.ex:39
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
@ -267,7 +255,7 @@ msgstr "Nueva Etiqueta"
msgid "No Ammo" msgid "No Ammo"
msgstr "Sin Munición" 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 #, elixir-autogen, elixir-format
msgid "No ammo for this type" msgid "No ammo for this type"
msgstr "Sin munición para este tipo" 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/container_table_component.ex:48
#: lib/cannery_web/components/move_pack_component.ex:66 #: 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/container_live/form_component.html.heex:39
#: lib/cannery_web/live/pack_live/form_component.html.heex:22
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Type" msgid "Type"
msgstr "Tipo" 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/core_components/pack_card.html.heex:47
#: lib/cannery_web/components/pack_table_component.ex:163 #: lib/cannery_web/components/pack_table_component.ex:163
#: lib/cannery_web/components/pack_table_component.ex:246 #: 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:37
#: lib/cannery_web/live/pack_live/show.html.heex:42 #: lib/cannery_web/live/pack_live/show.html.heex:42
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
@ -597,7 +587,7 @@ msgid "Edit %{name} tags"
msgstr "Editar etiquetas de %{name}" msgstr "Editar etiquetas de %{name}"
#: lib/cannery_web/components/core_components/container_card.html.heex:37 #: 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 #: lib/cannery_web/live/container_live/show.html.heex:27
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Rounds:" msgid "Rounds:"
@ -606,7 +596,7 @@ msgstr "Balas:"
#: lib/cannery_web/components/ammo_type_table_component.ex:260 #: 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:160
#: lib/cannery_web/components/pack_table_component.ex:242 #: 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 #, elixir-autogen, elixir-format
msgid "No cost information" msgid "No cost information"
msgstr "No hay información de coste" msgstr "No hay información de coste"
@ -677,7 +667,7 @@ msgstr "Tiros Récord"
msgid "Copies" msgid "Copies"
msgstr "Copias" 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 #, elixir-autogen, elixir-format
msgid "Added on:" msgid "Added on:"
msgstr "Añadido en:" 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" msgstr "Esta munición no está en un contenedor"
#: lib/cannery_web/components/core_components/container_card.html.heex:32 #: 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 #: lib/cannery_web/live/container_live/show.html.heex:22
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Packs:" msgid "Packs:"
@ -786,7 +776,7 @@ msgid "Container:"
msgstr "Contenedor:" msgstr "Contenedor:"
#: lib/cannery_web/live/ammo_type_live/index.html.heex:64 #: lib/cannery_web/live/ammo_type_live/index.html.heex:64
#: lib/cannery_web/live/ammo_type_live/show.html.heex:166 #: lib/cannery_web/live/ammo_type_live/show.html.heex:164
#: lib/cannery_web/live/pack_live/index.html.heex:87 #: lib/cannery_web/live/pack_live/index.html.heex:87
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Show used" msgid "Show used"
@ -815,7 +805,7 @@ msgstr "Paquetes"
msgid "Rounds" msgid "Rounds"
msgstr "Balas" 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/index.html.heex:40
#: lib/cannery_web/live/container_live/show.html.heex:115 #: lib/cannery_web/live/container_live/show.html.heex:115
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
@ -827,7 +817,7 @@ msgstr "Ver como tabla"
msgid "Total ever packs" msgid "Total ever packs"
msgstr "Paquetes totales" 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 #, elixir-autogen, elixir-format
msgid "Total ever packs:" msgid "Total ever packs:"
msgstr "Paquetes totales:" msgstr "Paquetes totales:"
@ -837,7 +827,7 @@ msgstr "Paquetes totales:"
msgid "Total ever rounds" msgid "Total ever rounds"
msgstr "Balas totales" 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 #, elixir-autogen, elixir-format
msgid "Total ever rounds:" msgid "Total ever rounds:"
msgstr "Balas totales:" msgstr "Balas totales:"
@ -847,7 +837,7 @@ msgstr "Balas totales:"
msgid "Used packs" msgid "Used packs"
msgstr "Paquetes usados" 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 #, elixir-autogen, elixir-format
msgid "Used packs:" msgid "Used packs:"
msgstr "Paquetes usados:" msgstr "Paquetes usados:"
@ -857,7 +847,7 @@ msgstr "Paquetes usados:"
msgid "Used rounds" msgid "Used rounds"
msgstr "Balas usadas" 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 #, elixir-autogen, elixir-format
msgid "Used rounds:" msgid "Used rounds:"
msgstr "Balas usadas:" msgstr "Balas usadas:"
@ -963,17 +953,11 @@ msgid "UPC:"
msgstr "" msgstr ""
#: lib/cannery_web/components/ammo_type_table_component.ex:102 #: 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 #, elixir-autogen, elixir-format
msgid "Average CPR" msgid "Average CPR"
msgstr "" 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/core_components/pack_card.html.heex:17
#: lib/cannery_web/components/pack_table_component.ex:250 #: lib/cannery_web/components/pack_table_component.ex:250
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
@ -1037,12 +1021,6 @@ msgstr "Comprada en:"
msgid "Edit ammo" msgid "Edit ammo"
msgstr "Editar munición" 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 #: lib/cannery_web/live/ammo_type_live/index.html.heex:58
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Search catalog" msgid "Search catalog"
@ -1313,14 +1291,14 @@ msgstr ""
msgid "No ammo" msgid "No ammo"
msgstr "Sin Munición" 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 #, elixir-autogen, elixir-format
msgid "None specified" msgid "None specified"
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:25 #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:25
#: lib/cannery_web/live/ammo_type_live/index.html.heex:38 #: lib/cannery_web/live/ammo_type_live/index.html.heex:38
#: lib/cannery_web/live/ammo_type_live/show.html.heex:58 #: lib/cannery_web/live/ammo_type_live/show.html.heex:56
#: lib/cannery_web/live/container_live/show.html.heex:106 #: lib/cannery_web/live/container_live/show.html.heex:106
#: lib/cannery_web/live/pack_live/index.html.heex:61 #: lib/cannery_web/live/pack_live/index.html.heex:61
#: lib/cannery_web/live/range_live/index.html.heex:95 #: 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/form_component.html.heex:25
#: lib/cannery_web/live/ammo_type_live/index.html.heex:36 #: lib/cannery_web/live/ammo_type_live/index.html.heex:36
#: lib/cannery_web/live/ammo_type_live/show.html.heex:56 #: lib/cannery_web/live/ammo_type_live/show.html.heex:54
#: lib/cannery_web/live/container_live/show.html.heex:104 #: lib/cannery_web/live/container_live/show.html.heex:104
#: lib/cannery_web/live/pack_live/index.html.heex:59 #: lib/cannery_web/live/pack_live/index.html.heex:59
#: lib/cannery_web/live/range_live/index.html.heex:93 #: 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/form_component.html.heex:25
#: lib/cannery_web/live/ammo_type_live/index.html.heex:37 #: lib/cannery_web/live/ammo_type_live/index.html.heex:37
#: lib/cannery_web/live/ammo_type_live/show.html.heex:54 #: lib/cannery_web/live/ammo_type_live/show.html.heex:52
#: lib/cannery_web/live/container_live/show.html.heex:105 #: lib/cannery_web/live/container_live/show.html.heex:105
#: lib/cannery_web/live/pack_live/index.html.heex:60 #: lib/cannery_web/live/pack_live/index.html.heex:60
#: lib/cannery_web/live/range_live/index.html.heex:94 #: 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/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/form_component.html.heex:21
#: lib/cannery_web/live/ammo_type_live/index.html.heex:29 #: 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/container_live/show.html.heex:97
#: lib/cannery_web/live/pack_live/index.html.heex:50 #: lib/cannery_web/live/pack_live/index.html.heex:50
#: lib/cannery_web/live/range_live/index.html.heex:86 #: lib/cannery_web/live/range_live/index.html.heex:86
@ -1467,3 +1445,21 @@ msgstr ""
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "Edit Shot Record" msgid "Edit Shot Record"
msgstr "Editar Tiros Récord" 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}" msgid "Invalid number of copies, must be between 1 and %{max}. Was %{multiplier}"
msgstr "Número inválido de copias, debe ser entre 1 y %{max}. Fue %{multiplier" msgstr "Número inválido de copias, debe ser entre 1 y %{max}. Fue %{multiplier"
#: lib/cannery/ammo.ex:1123 #: lib/cannery/ammo.ex:1121
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Invalid multiplier" msgid "Invalid multiplier"
msgstr "Multiplicador inválido" 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 #: lib/cannery_web/live/range_live/index.html.heex:74
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Your browser does not support the canvas element." 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 #, elixir-autogen, elixir-format
msgid "can't be blank" msgid "can't be blank"
msgstr "" 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 ## Run "mix gettext.extract" to bring this file up to
## date. Leave "msgstr"s empty as changing them here has no ## date. Leave "msgstr"s empty as changing them here has no
## effect: edit them in PO (.po) files instead. ## effect: edit them in PO (.po) files instead.
#: lib/cannery_web/live/ammo_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/container_live/form_component.ex:89
#: lib/cannery_web/live/invite_live/form_component.ex:80 #: lib/cannery_web/live/invite_live/form_component.ex:80
#: lib/cannery_web/live/tag_live/form_component.ex:78 #: lib/cannery_web/live/tag_live/form_component.ex:78
@ -44,7 +44,7 @@ msgstr "%{name} borrado exitosamente"
msgid "%{name} has been deleted" msgid "%{name} has been deleted"
msgstr "%{name} ha sido borrado" 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/container_live/form_component.ex:70
#: lib/cannery_web/live/invite_live/form_component.ex:62 #: lib/cannery_web/live/invite_live/form_component.ex:62
#: lib/cannery_web/live/tag_live/form_component.ex:60 #: 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[0] "Munición añadida exitosamente"
msgstr[1] "Municiones añadidas 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 #: lib/cannery_web/live/ammo_type_live/show.html.heex:29
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Are you sure you want to delete %{name}? This will delete all %{name} type ammo as well!" 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!" msgid "Make your first tag!"
msgstr "Faîtes votre premier 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 #: lib/cannery_web/live/container_live/index.html.heex:17
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "New Container" msgid "New Container"
@ -216,11 +211,6 @@ msgstr "Changer la langue"
msgid "View in Catalog" msgid "View in Catalog"
msgstr "Voir en catalogue" 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/components/move_pack_component.ex:78
#: lib/cannery_web/live/pack_live/index.html.heex:144 #: lib/cannery_web/live/pack_live/index.html.heex:144
#: lib/cannery_web/live/pack_live/show.html.heex:89 #: lib/cannery_web/live/pack_live/show.html.heex:89
@ -250,11 +240,6 @@ msgstr ""
msgid "Export Data as JSON" msgid "Export Data as JSON"
msgstr "" 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:87
#: lib/cannery_web/live/container_live/index.html.heex:145 #: lib/cannery_web/live/container_live/index.html.heex:145
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
@ -266,12 +251,6 @@ msgstr ""
msgid "Copy invite link for %{invite_name}" msgid "Copy invite link for %{invite_name}"
msgstr "" 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:104
#: lib/cannery_web/live/container_live/index.html.heex:162 #: lib/cannery_web/live/container_live/index.html.heex:162
#: lib/cannery_web/live/container_live/show.html.heex:48 #: lib/cannery_web/live/container_live/show.html.heex:48
@ -289,12 +268,6 @@ msgstr ""
msgid "Delete invite for %{invite_name}" msgid "Delete invite for %{invite_name}"
msgstr "" 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:77
#: lib/cannery_web/live/container_live/index.html.heex:135 #: lib/cannery_web/live/container_live/index.html.heex:135
#: lib/cannery_web/live/container_live/show.html.heex:35 #: lib/cannery_web/live/container_live/show.html.heex:35
@ -328,11 +301,6 @@ msgstr ""
msgid "Unstage" msgid "Unstage"
msgstr "" 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 #: lib/cannery_web/live/pack_live/index.html.heex:174
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "Clone pack of %{pack_count} bullets" msgid "Clone pack of %{pack_count} bullets"
@ -350,7 +318,7 @@ msgstr ""
msgid "Edit pack of %{pack_count} bullets" msgid "Edit pack of %{pack_count} bullets"
msgstr "" 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 #: lib/cannery_web/live/pack_live/index.html.heex:154
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "View pack of %{pack_count} bullets" msgid "View pack of %{pack_count} bullets"
@ -367,3 +335,35 @@ msgstr ""
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "Edit shot record of %{shot_record_count} shots" msgid "Edit shot record of %{shot_record_count} shots"
msgstr "" 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" msgid "Ammo"
msgstr "Munition" 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 #: lib/cannery_web/live/tag_live/form_component.html.heex:25
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Background color" msgid "Background color"
@ -240,12 +234,6 @@ msgstr "Ma superbe boite de munition"
msgid "Name" msgid "Name"
msgstr "Nom" 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:32
#: lib/cannery_web/live/container_live/index.ex:39 #: lib/cannery_web/live/container_live/index.ex:39
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
@ -267,7 +255,7 @@ msgstr "Nouveau tag"
msgid "No Ammo" msgid "No Ammo"
msgstr "Aucune munition" 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 #, elixir-autogen, elixir-format
msgid "No ammo for this type" msgid "No ammo for this type"
msgstr "Aucune munition pour ce 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/container_table_component.ex:48
#: lib/cannery_web/components/move_pack_component.ex:66 #: 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/container_live/form_component.html.heex:39
#: lib/cannery_web/live/pack_live/form_component.html.heex:22
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Type" msgid "Type"
msgstr "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/core_components/pack_card.html.heex:47
#: lib/cannery_web/components/pack_table_component.ex:163 #: lib/cannery_web/components/pack_table_component.ex:163
#: lib/cannery_web/components/pack_table_component.ex:246 #: 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:37
#: lib/cannery_web/live/pack_live/show.html.heex:42 #: lib/cannery_web/live/pack_live/show.html.heex:42
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
@ -598,7 +588,7 @@ msgid "Edit %{name} tags"
msgstr "Éditer les tags de %{name}" msgstr "Éditer les tags de %{name}"
#: lib/cannery_web/components/core_components/container_card.html.heex:37 #: 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 #: lib/cannery_web/live/container_live/show.html.heex:27
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Rounds:" msgid "Rounds:"
@ -607,7 +597,7 @@ msgstr "Cartouches:"
#: lib/cannery_web/components/ammo_type_table_component.ex:260 #: 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:160
#: lib/cannery_web/components/pack_table_component.ex:242 #: 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 #, elixir-autogen, elixir-format
msgid "No cost information" msgid "No cost information"
msgstr "Aucune information de prix" msgstr "Aucune information de prix"
@ -678,7 +668,7 @@ msgstr "Enregistrer des tirs"
msgid "Copies" msgid "Copies"
msgstr "Exemplaires" 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 #, elixir-autogen, elixir-format
msgid "Added on:" msgid "Added on:"
msgstr "Ajouté le:" 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" msgstr "Ce groupe de munition nest pas dans un conteneur"
#: lib/cannery_web/components/core_components/container_card.html.heex:32 #: 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 #: lib/cannery_web/live/container_live/show.html.heex:22
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Packs:" msgid "Packs:"
@ -787,7 +777,7 @@ msgid "Container:"
msgstr "Conteneur" msgstr "Conteneur"
#: lib/cannery_web/live/ammo_type_live/index.html.heex:64 #: lib/cannery_web/live/ammo_type_live/index.html.heex:64
#: lib/cannery_web/live/ammo_type_live/show.html.heex:166 #: lib/cannery_web/live/ammo_type_live/show.html.heex:164
#: lib/cannery_web/live/pack_live/index.html.heex:87 #: lib/cannery_web/live/pack_live/index.html.heex:87
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Show used" msgid "Show used"
@ -816,7 +806,7 @@ msgstr "Packages:"
msgid "Rounds" msgid "Rounds"
msgstr "Cartouches:" 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/index.html.heex:40
#: lib/cannery_web/live/container_live/show.html.heex:115 #: lib/cannery_web/live/container_live/show.html.heex:115
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
@ -828,7 +818,7 @@ msgstr ""
msgid "Total ever packs" msgid "Total ever packs"
msgstr "" 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 #, elixir-autogen, elixir-format
msgid "Total ever packs:" msgid "Total ever packs:"
msgstr "" msgstr ""
@ -838,7 +828,7 @@ msgstr ""
msgid "Total ever rounds" msgid "Total ever rounds"
msgstr "Quantité de cartouches" 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 #, elixir-autogen, elixir-format, fuzzy
msgid "Total ever rounds:" msgid "Total ever rounds:"
msgstr "Nombre totale de cartouches tirées:" msgstr "Nombre totale de cartouches tirées:"
@ -848,7 +838,7 @@ msgstr "Nombre totale de cartouches tirées:"
msgid "Used packs" msgid "Used packs"
msgstr "" 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 #, elixir-autogen, elixir-format
msgid "Used packs:" msgid "Used packs:"
msgstr "" msgstr ""
@ -858,7 +848,7 @@ msgstr ""
msgid "Used rounds" msgid "Used rounds"
msgstr "" 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 #, elixir-autogen, elixir-format, fuzzy
msgid "Used rounds:" msgid "Used rounds:"
msgstr "" msgstr ""
@ -964,17 +954,11 @@ msgid "UPC:"
msgstr "UPC" msgstr "UPC"
#: lib/cannery_web/components/ammo_type_table_component.ex:102 #: 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 #, elixir-autogen, elixir-format
msgid "Average CPR" msgid "Average CPR"
msgstr "" 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/core_components/pack_card.html.heex:17
#: lib/cannery_web/components/pack_table_component.ex:250 #: lib/cannery_web/components/pack_table_component.ex:250
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
@ -1038,12 +1022,6 @@ msgstr ""
msgid "Edit ammo" msgid "Edit ammo"
msgstr "Éditer le type de munition" 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 #: lib/cannery_web/live/ammo_type_live/index.html.heex:58
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Search catalog" msgid "Search catalog"
@ -1314,14 +1292,14 @@ msgstr ""
msgid "No ammo" msgid "No ammo"
msgstr "Aucune munition" 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 #, elixir-autogen, elixir-format
msgid "None specified" msgid "None specified"
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:25 #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:25
#: lib/cannery_web/live/ammo_type_live/index.html.heex:38 #: lib/cannery_web/live/ammo_type_live/index.html.heex:38
#: lib/cannery_web/live/ammo_type_live/show.html.heex:58 #: lib/cannery_web/live/ammo_type_live/show.html.heex:56
#: lib/cannery_web/live/container_live/show.html.heex:106 #: lib/cannery_web/live/container_live/show.html.heex:106
#: lib/cannery_web/live/pack_live/index.html.heex:61 #: lib/cannery_web/live/pack_live/index.html.heex:61
#: lib/cannery_web/live/range_live/index.html.heex:95 #: 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/form_component.html.heex:25
#: lib/cannery_web/live/ammo_type_live/index.html.heex:36 #: lib/cannery_web/live/ammo_type_live/index.html.heex:36
#: lib/cannery_web/live/ammo_type_live/show.html.heex:56 #: lib/cannery_web/live/ammo_type_live/show.html.heex:54
#: lib/cannery_web/live/container_live/show.html.heex:104 #: lib/cannery_web/live/container_live/show.html.heex:104
#: lib/cannery_web/live/pack_live/index.html.heex:59 #: lib/cannery_web/live/pack_live/index.html.heex:59
#: lib/cannery_web/live/range_live/index.html.heex:93 #: 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/form_component.html.heex:25
#: lib/cannery_web/live/ammo_type_live/index.html.heex:37 #: lib/cannery_web/live/ammo_type_live/index.html.heex:37
#: lib/cannery_web/live/ammo_type_live/show.html.heex:54 #: lib/cannery_web/live/ammo_type_live/show.html.heex:52
#: lib/cannery_web/live/container_live/show.html.heex:105 #: lib/cannery_web/live/container_live/show.html.heex:105
#: lib/cannery_web/live/pack_live/index.html.heex:60 #: lib/cannery_web/live/pack_live/index.html.heex:60
#: lib/cannery_web/live/range_live/index.html.heex:94 #: 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/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/form_component.html.heex:21
#: lib/cannery_web/live/ammo_type_live/index.html.heex:29 #: 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/container_live/show.html.heex:97
#: lib/cannery_web/live/pack_live/index.html.heex:50 #: lib/cannery_web/live/pack_live/index.html.heex:50
#: lib/cannery_web/live/range_live/index.html.heex:86 #: lib/cannery_web/live/range_live/index.html.heex:86
@ -1468,3 +1446,21 @@ msgstr ""
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "Edit Shot Record" msgid "Edit Shot Record"
msgstr "Modifier les enregistrements de tir" 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}" msgid "Invalid number of copies, must be between 1 and %{max}. Was %{multiplier}"
msgstr "Nombre de copies invalide, doit être 1 et %{max}. Été %{multiplier}" msgstr "Nombre de copies invalide, doit être 1 et %{max}. Été %{multiplier}"
#: lib/cannery/ammo.ex:1123 #: lib/cannery/ammo.ex:1121
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Invalid multiplier" msgid "Invalid multiplier"
msgstr "Multiplicateur invalide" 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 #: lib/cannery_web/live/range_live/index.html.heex:74
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Your browser does not support the canvas element." 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 #, elixir-autogen, elixir-format
msgid "can't be blank" msgid "can't be blank"
msgstr "" 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 ## Run "mix gettext.extract" to bring this file up to
## date. Leave "msgstr"s empty as changing them here has no ## date. Leave "msgstr"s empty as changing them here has no
## effect: edit them in PO (.po) files instead. ## effect: edit them in PO (.po) files instead.
#: lib/cannery_web/live/ammo_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/container_live/form_component.ex:89
#: lib/cannery_web/live/invite_live/form_component.ex:80 #: lib/cannery_web/live/invite_live/form_component.ex:80
#: lib/cannery_web/live/tag_live/form_component.ex:78 #: 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" msgid "%{name} has been deleted"
msgstr "%{name} a été supprimé·e" 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/container_live/form_component.ex:70
#: lib/cannery_web/live/invite_live/form_component.ex:62 #: lib/cannery_web/live/invite_live/form_component.ex:62
#: lib/cannery_web/live/tag_live/form_component.ex:60 #: 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[0] "Groupe de munition mis à jour avec succès"
msgstr[1] "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 #: lib/cannery_web/live/ammo_type_live/show.html.heex:29
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "Are you sure you want to delete %{name}? This will delete all %{name} type ammo as well!" 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!" msgid "Make your first tag!"
msgstr "" 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 #: lib/cannery_web/live/container_live/index.html.heex:17
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "New Container" msgid "New Container"
@ -214,11 +209,6 @@ msgstr ""
msgid "View in Catalog" msgid "View in Catalog"
msgstr "" 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/components/move_pack_component.ex:78
#: lib/cannery_web/live/pack_live/index.html.heex:144 #: lib/cannery_web/live/pack_live/index.html.heex:144
#: lib/cannery_web/live/pack_live/show.html.heex:89 #: lib/cannery_web/live/pack_live/show.html.heex:89
@ -248,11 +238,6 @@ msgstr ""
msgid "Export Data as JSON" msgid "Export Data as JSON"
msgstr "" 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:87
#: lib/cannery_web/live/container_live/index.html.heex:145 #: lib/cannery_web/live/container_live/index.html.heex:145
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
@ -264,12 +249,6 @@ msgstr ""
msgid "Copy invite link for %{invite_name}" msgid "Copy invite link for %{invite_name}"
msgstr "" 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:104
#: lib/cannery_web/live/container_live/index.html.heex:162 #: lib/cannery_web/live/container_live/index.html.heex:162
#: lib/cannery_web/live/container_live/show.html.heex:48 #: lib/cannery_web/live/container_live/show.html.heex:48
@ -287,12 +266,6 @@ msgstr ""
msgid "Delete invite for %{invite_name}" msgid "Delete invite for %{invite_name}"
msgstr "" 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:77
#: lib/cannery_web/live/container_live/index.html.heex:135 #: lib/cannery_web/live/container_live/index.html.heex:135
#: lib/cannery_web/live/container_live/show.html.heex:35 #: lib/cannery_web/live/container_live/show.html.heex:35
@ -326,11 +299,6 @@ msgstr ""
msgid "Unstage" msgid "Unstage"
msgstr "" 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 #: lib/cannery_web/live/pack_live/index.html.heex:174
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "Clone pack of %{pack_count} bullets" msgid "Clone pack of %{pack_count} bullets"
@ -348,7 +316,7 @@ msgstr ""
msgid "Edit pack of %{pack_count} bullets" msgid "Edit pack of %{pack_count} bullets"
msgstr "" 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 #: lib/cannery_web/live/pack_live/index.html.heex:154
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "View pack of %{pack_count} bullets" msgid "View pack of %{pack_count} bullets"
@ -365,3 +333,35 @@ msgstr ""
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "Edit shot record of %{shot_record_count} shots" msgid "Edit shot record of %{shot_record_count} shots"
msgstr "" 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" msgid "Ammo"
msgstr "" 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 #: lib/cannery_web/live/tag_live/form_component.html.heex:25
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Background color" msgid "Background color"
@ -238,12 +232,6 @@ msgstr ""
msgid "Name" msgid "Name"
msgstr "" 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:32
#: lib/cannery_web/live/container_live/index.ex:39 #: lib/cannery_web/live/container_live/index.ex:39
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
@ -265,7 +253,7 @@ msgstr ""
msgid "No Ammo" msgid "No Ammo"
msgstr "" 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 #, elixir-autogen, elixir-format
msgid "No ammo for this type" msgid "No ammo for this type"
msgstr "" msgstr ""
@ -399,7 +387,9 @@ msgstr ""
#: lib/cannery_web/components/container_table_component.ex:48 #: lib/cannery_web/components/container_table_component.ex:48
#: lib/cannery_web/components/move_pack_component.ex:66 #: 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/container_live/form_component.html.heex:39
#: lib/cannery_web/live/pack_live/form_component.html.heex:22
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Type" msgid "Type"
msgstr "" msgstr ""
@ -509,7 +499,7 @@ msgstr ""
#: lib/cannery_web/components/core_components/pack_card.html.heex:47 #: 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:163
#: lib/cannery_web/components/pack_table_component.ex:246 #: 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:37
#: lib/cannery_web/live/pack_live/show.html.heex:42 #: lib/cannery_web/live/pack_live/show.html.heex:42
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
@ -592,7 +582,7 @@ msgid "Edit %{name} tags"
msgstr "" msgstr ""
#: lib/cannery_web/components/core_components/container_card.html.heex:37 #: 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 #: lib/cannery_web/live/container_live/show.html.heex:27
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Rounds:" msgid "Rounds:"
@ -601,7 +591,7 @@ msgstr ""
#: lib/cannery_web/components/ammo_type_table_component.ex:260 #: 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:160
#: lib/cannery_web/components/pack_table_component.ex:242 #: 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 #, elixir-autogen, elixir-format
msgid "No cost information" msgid "No cost information"
msgstr "" msgstr ""
@ -672,7 +662,7 @@ msgstr ""
msgid "Copies" msgid "Copies"
msgstr "" 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 #, elixir-autogen, elixir-format
msgid "Added on:" msgid "Added on:"
msgstr "" msgstr ""
@ -752,7 +742,7 @@ msgid "This ammo is not in a container"
msgstr "" msgstr ""
#: lib/cannery_web/components/core_components/container_card.html.heex:32 #: 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 #: lib/cannery_web/live/container_live/show.html.heex:22
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Packs:" msgid "Packs:"
@ -780,7 +770,7 @@ msgid "Container:"
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.html.heex:64 #: lib/cannery_web/live/ammo_type_live/index.html.heex:64
#: lib/cannery_web/live/ammo_type_live/show.html.heex:166 #: lib/cannery_web/live/ammo_type_live/show.html.heex:164
#: lib/cannery_web/live/pack_live/index.html.heex:87 #: lib/cannery_web/live/pack_live/index.html.heex:87
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Show used" msgid "Show used"
@ -809,7 +799,7 @@ msgstr ""
msgid "Rounds" msgid "Rounds"
msgstr "" 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/index.html.heex:40
#: lib/cannery_web/live/container_live/show.html.heex:115 #: lib/cannery_web/live/container_live/show.html.heex:115
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
@ -821,7 +811,7 @@ msgstr ""
msgid "Total ever packs" msgid "Total ever packs"
msgstr "" 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 #, elixir-autogen, elixir-format
msgid "Total ever packs:" msgid "Total ever packs:"
msgstr "" msgstr ""
@ -831,7 +821,7 @@ msgstr ""
msgid "Total ever rounds" msgid "Total ever rounds"
msgstr "" 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 #, elixir-autogen, elixir-format, fuzzy
msgid "Total ever rounds:" msgid "Total ever rounds:"
msgstr "" msgstr ""
@ -841,7 +831,7 @@ msgstr ""
msgid "Used packs" msgid "Used packs"
msgstr "" 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 #, elixir-autogen, elixir-format
msgid "Used packs:" msgid "Used packs:"
msgstr "" msgstr ""
@ -851,7 +841,7 @@ msgstr ""
msgid "Used rounds" msgid "Used rounds"
msgstr "" 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 #, elixir-autogen, elixir-format, fuzzy
msgid "Used rounds:" msgid "Used rounds:"
msgstr "" msgstr ""
@ -957,17 +947,11 @@ msgid "UPC:"
msgstr "" msgstr ""
#: lib/cannery_web/components/ammo_type_table_component.ex:102 #: 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 #, elixir-autogen, elixir-format
msgid "Average CPR" msgid "Average CPR"
msgstr "" 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/core_components/pack_card.html.heex:17
#: lib/cannery_web/components/pack_table_component.ex:250 #: lib/cannery_web/components/pack_table_component.ex:250
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
@ -1031,12 +1015,6 @@ msgstr ""
msgid "Edit ammo" msgid "Edit ammo"
msgstr "" 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 #: lib/cannery_web/live/ammo_type_live/index.html.heex:58
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Search catalog" msgid "Search catalog"
@ -1305,14 +1283,14 @@ msgstr ""
msgid "No ammo" msgid "No ammo"
msgstr "" 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 #, elixir-autogen, elixir-format
msgid "None specified" msgid "None specified"
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:25 #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:25
#: lib/cannery_web/live/ammo_type_live/index.html.heex:38 #: lib/cannery_web/live/ammo_type_live/index.html.heex:38
#: lib/cannery_web/live/ammo_type_live/show.html.heex:58 #: lib/cannery_web/live/ammo_type_live/show.html.heex:56
#: lib/cannery_web/live/container_live/show.html.heex:106 #: lib/cannery_web/live/container_live/show.html.heex:106
#: lib/cannery_web/live/pack_live/index.html.heex:61 #: lib/cannery_web/live/pack_live/index.html.heex:61
#: lib/cannery_web/live/range_live/index.html.heex:95 #: 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/form_component.html.heex:25
#: lib/cannery_web/live/ammo_type_live/index.html.heex:36 #: lib/cannery_web/live/ammo_type_live/index.html.heex:36
#: lib/cannery_web/live/ammo_type_live/show.html.heex:56 #: lib/cannery_web/live/ammo_type_live/show.html.heex:54
#: lib/cannery_web/live/container_live/show.html.heex:104 #: lib/cannery_web/live/container_live/show.html.heex:104
#: lib/cannery_web/live/pack_live/index.html.heex:59 #: lib/cannery_web/live/pack_live/index.html.heex:59
#: lib/cannery_web/live/range_live/index.html.heex:93 #: 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/form_component.html.heex:25
#: lib/cannery_web/live/ammo_type_live/index.html.heex:37 #: lib/cannery_web/live/ammo_type_live/index.html.heex:37
#: lib/cannery_web/live/ammo_type_live/show.html.heex:54 #: lib/cannery_web/live/ammo_type_live/show.html.heex:52
#: lib/cannery_web/live/container_live/show.html.heex:105 #: lib/cannery_web/live/container_live/show.html.heex:105
#: lib/cannery_web/live/pack_live/index.html.heex:60 #: lib/cannery_web/live/pack_live/index.html.heex:60
#: lib/cannery_web/live/range_live/index.html.heex:94 #: 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/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/form_component.html.heex:21
#: lib/cannery_web/live/ammo_type_live/index.html.heex:29 #: 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/container_live/show.html.heex:97
#: lib/cannery_web/live/pack_live/index.html.heex:50 #: lib/cannery_web/live/pack_live/index.html.heex:50
#: lib/cannery_web/live/range_live/index.html.heex:86 #: lib/cannery_web/live/range_live/index.html.heex:86
@ -1459,3 +1437,21 @@ msgstr ""
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "Edit Shot Record" msgid "Edit Shot Record"
msgstr "" 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}" msgid "Invalid number of copies, must be between 1 and %{max}. Was %{multiplier}"
msgstr "" msgstr ""
#: lib/cannery/ammo.ex:1123 #: lib/cannery/ammo.ex:1121
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Invalid multiplier" msgid "Invalid multiplier"
msgstr "" 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 #: lib/cannery_web/live/range_live/index.html.heex:74
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Your browser does not support the canvas element." msgid "Your browser does not support the canvas element."
@ -210,3 +205,8 @@ msgstr ""
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "can't be blank" msgid "can't be blank"
msgstr "" 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 ## Run "mix gettext.extract" to bring this file up to
## date. Leave "msgstr"s empty as changing them here has no ## date. Leave "msgstr"s empty as changing them here has no
## effect: edit them in PO (.po) files instead. ## effect: edit them in PO (.po) files instead.
#: lib/cannery_web/live/ammo_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/container_live/form_component.ex:89
#: lib/cannery_web/live/invite_live/form_component.ex:80 #: lib/cannery_web/live/invite_live/form_component.ex:80
#: lib/cannery_web/live/tag_live/form_component.ex:78 #: lib/cannery_web/live/tag_live/form_component.ex:78
@ -42,7 +42,7 @@ msgstr ""
msgid "%{name} has been deleted" msgid "%{name} has been deleted"
msgstr "" 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/container_live/form_component.ex:70
#: lib/cannery_web/live/invite_live/form_component.ex:62 #: lib/cannery_web/live/invite_live/form_component.ex:62
#: lib/cannery_web/live/tag_live/form_component.ex:60 #: lib/cannery_web/live/tag_live/form_component.ex:60
@ -250,7 +250,7 @@ msgstr[2] ""
msgstr[3] "" msgstr[3] ""
msgstr[4] "" 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 #: lib/cannery_web/live/ammo_type_live/show.html.heex:29
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Are you sure you want to delete %{name}? This will delete all %{name} type ammo as well!" 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 "" msgid ""
msgstr "" 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/container_live/form_component.ex:89
#: lib/cannery_web/live/invite_live/form_component.ex:80 #: lib/cannery_web/live/invite_live/form_component.ex:80
#: lib/cannery_web/live/tag_live/form_component.ex:78 #: lib/cannery_web/live/tag_live/form_component.ex:78
@ -31,7 +31,7 @@ msgstr ""
msgid "%{name} has been deleted" msgid "%{name} has been deleted"
msgstr "" 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/container_live/form_component.ex:70
#: lib/cannery_web/live/invite_live/form_component.ex:62 #: lib/cannery_web/live/invite_live/form_component.ex:62
#: lib/cannery_web/live/tag_live/form_component.ex:60 #: lib/cannery_web/live/tag_live/form_component.ex:60
@ -236,7 +236,7 @@ msgid_plural "Ammo added successfully"
msgstr[0] "" msgstr[0] ""
msgstr[1] "" 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 #: lib/cannery_web/live/ammo_type_live/show.html.heex:29
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Are you sure you want to delete %{name}? This will delete all %{name} type ammo as well!" 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 setup do
current_user = user_fixture() current_user = user_fixture()
container = container_fixture(current_user) container = container_fixture(current_user)
ammo_type = ammo_type_fixture(current_user) type = type_fixture(current_user)
{1, [%{id: pack_id} = pack]} = {1, [%{id: pack_id} = pack]} = pack_fixture(%{count: 25}, type, container, current_user)
pack_fixture(%{count: 25}, ammo_type, container, current_user)
shot_record = shot_record =
%{count: 5, date: ~N[2022-02-13 03:17:00], notes: "some notes"} %{count: 5, date: ~N[2022-02-13 03:17:00], notes: "some notes"}
@ -27,7 +26,7 @@ defmodule Cannery.ActivityLogTest do
[ [
current_user: current_user, current_user: current_user,
container: container, container: container,
ammo_type: ammo_type, type: type,
pack: pack, pack: pack,
shot_record: shot_record shot_record: shot_record
] ]
@ -47,8 +46,8 @@ defmodule Cannery.ActivityLogTest do
assert ActivityLog.get_shot_record_count!(other_user) == 0 assert ActivityLog.get_shot_record_count!(other_user) == 0
container = container_fixture(other_user) container = container_fixture(other_user)
ammo_type = ammo_type_fixture(other_user) type = type_fixture(other_user)
{1, [pack]} = pack_fixture(%{count: 25}, ammo_type, container, 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) 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 assert ActivityLog.get_shot_record_count!(other_user) == 1
end end
@ -191,11 +190,11 @@ defmodule Cannery.ActivityLogTest do
test "get_used_count/2 returns accurate used count", %{ test "get_used_count/2 returns accurate used count", %{
pack: pack, pack: pack,
ammo_type: ammo_type, type: type,
container: container, container: container,
current_user: current_user current_user: current_user
} do } 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 0 = another_pack |> ActivityLog.get_used_count(current_user)
assert 5 = 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) shot_record_fixture(%{count: 10}, current_user, pack)
assert 30 = pack |> ActivityLog.get_used_count(current_user) 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) assert 0 = another_pack |> ActivityLog.get_used_count(current_user)
end end
test "get_used_counts/2 returns accurate used counts", %{ test "get_used_counts/2 returns accurate used counts", %{
pack: %{id: pack_id} = pack, pack: %{id: pack_id} = pack,
ammo_type: ammo_type, type: type,
container: container, container: container,
current_user: current_user current_user: current_user
} do } do
{1, [%{id: another_pack_id} = another_pack]} = {1, [%{id: another_pack_id} = another_pack]} = pack_fixture(type, container, current_user)
pack_fixture(ammo_type, container, current_user)
assert %{pack_id => 5} == assert %{pack_id => 5} ==
[pack, another_pack] |> ActivityLog.get_used_counts(current_user) [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", %{ test "get_last_used_date/2 returns accurate used count", %{
pack: pack, pack: pack,
ammo_type: ammo_type, type: type,
container: container, container: container,
shot_record: %{date: date}, shot_record: %{date: date},
current_user: current_user current_user: current_user
} do } 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 another_pack |> ActivityLog.get_last_used_date(current_user) |> is_nil()
assert ^date = pack |> ActivityLog.get_last_used_date(current_user) 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", %{ test "get_last_used_dates/2 returns accurate used counts", %{
pack: %{id: pack_id} = pack, pack: %{id: pack_id} = pack,
ammo_type: ammo_type, type: type,
container: container, container: container,
shot_record: %{date: date}, shot_record: %{date: date},
current_user: current_user current_user: current_user
} do } do
{1, [%{id: another_pack_id} = another_pack]} = {1, [%{id: another_pack_id} = another_pack]} = pack_fixture(type, container, current_user)
pack_fixture(ammo_type, container, current_user)
# unset date # unset date
assert %{pack_id => 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 assert %{^another_pack_id => ~D[2022-11-09]} = last_used_shot_records
end end
test "get_used_count_for_ammo_type/2 gets accurate used round count for ammo type", test "get_used_count_for_type/2 gets accurate used round count for type",
%{ammo_type: ammo_type, pack: pack, current_user: current_user} do %{type: type, pack: pack, current_user: current_user} do
another_ammo_type = ammo_type_fixture(current_user) another_type = type_fixture(current_user)
assert 0 = another_ammo_type |> ActivityLog.get_used_count_for_ammo_type(current_user) assert 0 = another_type |> ActivityLog.get_used_count_for_type(current_user)
assert 5 = ammo_type |> ActivityLog.get_used_count_for_ammo_type(current_user) assert 5 = type |> ActivityLog.get_used_count_for_type(current_user)
shot_record_fixture(%{count: 5}, current_user, pack) 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) 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 end
test "get_used_count_for_ammo_types/2 gets accurate used round count for ammo types", %{ test "get_used_count_for_types/2 gets accurate used round count for types", %{
ammo_type: %{id: ammo_type_id} = ammo_type, type: %{id: type_id} = type,
container: container, container: container,
current_user: current_user current_user: current_user
} do } do
# testing unused ammo type # testing unused type
%{id: another_ammo_type_id} = another_ammo_type = ammo_type_fixture(current_user) %{id: another_type_id} = another_type = type_fixture(current_user)
{1, [pack]} = pack_fixture(another_ammo_type, container, current_user) {1, [pack]} = pack_fixture(another_type, container, current_user)
assert %{ammo_type_id => 5} == assert %{type_id => 5} ==
[ammo_type, another_ammo_type] [type, another_type]
|> ActivityLog.get_used_count_for_ammo_types(current_user) |> ActivityLog.get_used_count_for_types(current_user)
# use generated pack # use generated pack
shot_record_fixture(%{count: 5}, current_user, pack) shot_record_fixture(%{count: 5}, current_user, pack)
used_counts = used_counts = [type, another_type] |> ActivityLog.get_used_count_for_types(current_user)
[ammo_type, another_ammo_type] |> ActivityLog.get_used_count_for_ammo_types(current_user)
assert %{^ammo_type_id => 5} = used_counts assert %{^type_id => 5} = used_counts
assert %{^another_ammo_type_id => 5} = used_counts assert %{^another_type_id => 5} = used_counts
# use generated pack again # use generated pack again
shot_record_fixture(%{count: 1}, current_user, pack) shot_record_fixture(%{count: 1}, current_user, pack)
used_counts = used_counts = [type, another_type] |> ActivityLog.get_used_count_for_types(current_user)
[ammo_type, another_ammo_type] |> ActivityLog.get_used_count_for_ammo_types(current_user)
assert %{^ammo_type_id => 5} = used_counts assert %{^type_id => 5} = used_counts
assert %{^another_ammo_type_id => 6} = used_counts assert %{^another_type_id => 6} = used_counts
end end
end end
@ -347,13 +342,13 @@ defmodule Cannery.ActivityLogTest do
setup do setup do
current_user = user_fixture() current_user = user_fixture()
container = container_fixture(current_user) container = container_fixture(current_user)
ammo_type = ammo_type_fixture(current_user) type = type_fixture(current_user)
{1, [pack]} = pack_fixture(ammo_type, container, current_user) {1, [pack]} = pack_fixture(type, container, current_user)
[ [
current_user: current_user, current_user: current_user,
container: container, container: container,
ammo_type: ammo_type, type: type,
pack: pack pack: pack
] ]
end end
@ -364,21 +359,21 @@ defmodule Cannery.ActivityLogTest do
other_container = container_fixture(other_user) other_container = container_fixture(other_user)
for class <- ["rifle", "shotgun", "pistol"] do for class <- ["rifle", "shotgun", "pistol"] do
other_ammo_type = ammo_type_fixture(%{class: class}, other_user) other_type = type_fixture(%{class: class}, other_user)
{1, [other_pack]} = pack_fixture(other_ammo_type, other_container, other_user) {1, [other_pack]} = pack_fixture(other_type, other_container, other_user)
shot_record_fixture(other_user, other_pack) shot_record_fixture(other_user, other_pack)
end end
rifle_ammo_type = ammo_type_fixture(%{class: :rifle}, current_user) rifle_type = type_fixture(%{class: :rifle}, current_user)
{1, [rifle_pack]} = pack_fixture(rifle_ammo_type, container, current_user) {1, [rifle_pack]} = pack_fixture(rifle_type, container, current_user)
rifle_shot_record = shot_record_fixture(current_user, rifle_pack) rifle_shot_record = shot_record_fixture(current_user, rifle_pack)
shotgun_ammo_type = ammo_type_fixture(%{class: :shotgun}, current_user) shotgun_type = type_fixture(%{class: :shotgun}, current_user)
{1, [shotgun_pack]} = pack_fixture(shotgun_ammo_type, container, current_user) {1, [shotgun_pack]} = pack_fixture(shotgun_type, container, current_user)
shotgun_shot_record = shot_record_fixture(current_user, shotgun_pack) shotgun_shot_record = shot_record_fixture(current_user, shotgun_pack)
pistol_ammo_type = ammo_type_fixture(%{class: :pistol}, current_user) pistol_type = type_fixture(%{class: :pistol}, current_user)
{1, [pistol_pack]} = pack_fixture(pistol_ammo_type, container, current_user) {1, [pistol_pack]} = pack_fixture(pistol_type, container, current_user)
pistol_shot_record = shot_record_fixture(current_user, pistol_pack) pistol_shot_record = shot_record_fixture(current_user, pistol_pack)
assert [^rifle_shot_record] = ActivityLog.list_shot_records(:rifle, current_user) assert [^rifle_shot_record] = ActivityLog.list_shot_records(:rifle, current_user)
@ -399,29 +394,28 @@ defmodule Cannery.ActivityLogTest do
end end
test "list_shot_records/3 returns relevant shot_records for a search", %{ test "list_shot_records/3 returns relevant shot_records for a search", %{
ammo_type: ammo_type, type: type,
pack: pack, pack: pack,
container: container, container: container,
current_user: current_user current_user: current_user
} do } do
shot_record_a = shot_record_fixture(%{notes: "amazing"}, current_user, pack) shot_record_a = shot_record_fixture(%{notes: "amazing"}, current_user, pack)
{1, [another_pack]} = {1, [another_pack]} = pack_fixture(%{notes: "stupendous"}, type, container, current_user)
pack_fixture(%{notes: "stupendous"}, ammo_type, container, current_user)
shot_record_b = shot_record_fixture(current_user, another_pack) 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) shot_record_c = shot_record_fixture(current_user, yet_another_pack)
another_user = user_fixture() another_user = user_fixture()
another_container = container_fixture(another_user) 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) _shouldnt_return = shot_record_fixture(another_user, another_pack)
@ -431,7 +425,7 @@ defmodule Cannery.ActivityLogTest do
# pack attributes # pack attributes
assert ActivityLog.list_shot_records("stupendous", :all, current_user) == [shot_record_b] 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] assert ActivityLog.list_shot_records("fabulous", :all, current_user) == [shot_record_c]
end end
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] setup [:register_and_log_in_user]
defp add_data(%{current_user: current_user}) do 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) container = container_fixture(current_user)
tag = tag_fixture(current_user) tag = tag_fixture(current_user)
Containers.add_tag!(container, tag, 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) shot_record = shot_record_fixture(current_user, pack)
pack = pack |> Repo.reload!() pack = pack |> Repo.reload!()
%{ %{
ammo_type: ammo_type, type: type,
pack: pack, pack: pack,
container: container, container: container,
shot_record: shot_record, shot_record: shot_record,
@ -35,7 +35,7 @@ defmodule CanneryWeb.ExportControllerTest do
conn: conn, conn: conn,
current_user: current_user, current_user: current_user,
container: container, container: container,
ammo_type: ammo_type, type: type,
pack: pack, pack: pack,
shot_record: shot_record, shot_record: shot_record,
tag: tag tag: tag
@ -43,7 +43,7 @@ defmodule CanneryWeb.ExportControllerTest do
conn = get(conn, Routes.export_path(conn, :export, :json)) conn = get(conn, Routes.export_path(conn, :export, :json))
ideal_pack = %{ ideal_pack = %{
"ammo_type_id" => pack.ammo_type_id, "type_id" => pack.type_id,
"container_id" => pack.container_id, "container_id" => pack.container_id,
"count" => pack.count, "count" => pack.count,
"id" => pack.id, "id" => pack.id,
@ -56,34 +56,34 @@ defmodule CanneryWeb.ExportControllerTest do
"percentage_remaining" => pack |> Ammo.get_percentage_remaining(current_user) "percentage_remaining" => pack |> Ammo.get_percentage_remaining(current_user)
} }
ideal_ammo_type = %{ ideal_type = %{
"blank" => ammo_type.blank, "blank" => type.blank,
"bullet_core" => ammo_type.bullet_core, "bullet_core" => type.bullet_core,
"bullet_type" => ammo_type.bullet_type, "bullet_type" => type.bullet_type,
"caliber" => ammo_type.caliber, "caliber" => type.caliber,
"cartridge" => ammo_type.cartridge, "cartridge" => type.cartridge,
"case_material" => ammo_type.case_material, "case_material" => type.case_material,
"corrosive" => ammo_type.corrosive, "corrosive" => type.corrosive,
"desc" => ammo_type.desc, "desc" => type.desc,
"firing_type" => ammo_type.firing_type, "firing_type" => type.firing_type,
"grains" => ammo_type.grains, "grains" => type.grains,
"id" => ammo_type.id, "id" => type.id,
"incendiary" => ammo_type.incendiary, "incendiary" => type.incendiary,
"jacket_type" => ammo_type.jacket_type, "jacket_type" => type.jacket_type,
"manufacturer" => ammo_type.manufacturer, "manufacturer" => type.manufacturer,
"muzzle_velocity" => ammo_type.muzzle_velocity, "muzzle_velocity" => type.muzzle_velocity,
"name" => ammo_type.name, "name" => type.name,
"powder_grains_per_charge" => ammo_type.powder_grains_per_charge, "powder_grains_per_charge" => type.powder_grains_per_charge,
"powder_type" => ammo_type.powder_type, "powder_type" => type.powder_type,
"pressure" => ammo_type.pressure, "pressure" => type.pressure,
"primer_type" => ammo_type.primer_type, "primer_type" => type.primer_type,
"tracer" => ammo_type.tracer, "tracer" => type.tracer,
"upc" => ammo_type.upc, "upc" => type.upc,
"average_cost" => ammo_type |> Ammo.get_average_cost_for_ammo_type(current_user), "average_cost" => type |> Ammo.get_average_cost_for_type(current_user),
"round_count" => ammo_type |> Ammo.get_round_count_for_ammo_type(current_user), "round_count" => type |> Ammo.get_round_count_for_type(current_user),
"used_count" => ammo_type |> ActivityLog.get_used_count_for_ammo_type(current_user), "used_count" => type |> ActivityLog.get_used_count_for_type(current_user),
"pack_count" => ammo_type |> Ammo.get_packs_count_for_type(current_user), "pack_count" => type |> Ammo.get_packs_count_for_type(current_user),
"total_pack_count" => ammo_type |> Ammo.get_packs_count_for_type(current_user, true) "total_pack_count" => type |> Ammo.get_packs_count_for_type(current_user, true)
} }
ideal_container = %{ ideal_container = %{
@ -125,7 +125,7 @@ defmodule CanneryWeb.ExportControllerTest do
json_resp = conn |> json_response(200) json_resp = conn |> json_response(200)
assert %{"packs" => [^ideal_pack]} = json_resp 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 %{"containers" => [^ideal_container]} = json_resp
assert %{"shot_records" => [^ideal_shot_record]} = json_resp assert %{"shot_records" => [^ideal_shot_record]} = json_resp
assert %{"user" => ^ideal_user} = json_resp assert %{"user" => ^ideal_user} = json_resp

View File

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

View File

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

View File

@ -29,10 +29,10 @@ defmodule CanneryWeb.PackLiveTest do
} }
defp create_pack(%{current_user: current_user}) 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) container = container_fixture(current_user)
{1, [pack]} = pack_fixture(@create_attrs, ammo_type, container, current_user) {1, [pack]} = pack_fixture(@create_attrs, type, container, current_user)
[ammo_type: ammo_type, pack: pack, container: container] [type: type, pack: pack, container: container]
end end
defp create_shot_record(%{current_user: current_user, pack: pack}) do defp create_shot_record(%{current_user: current_user, pack: pack}) do
@ -43,10 +43,10 @@ defmodule CanneryWeb.PackLiveTest do
defp create_empty_pack(%{ defp create_empty_pack(%{
current_user: current_user, current_user: current_user,
ammo_type: ammo_type, type: type,
container: container container: container
}) do }) 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) shot_record = shot_record_fixture(@shot_record_attrs, current_user, pack)
pack = pack |> Repo.reload!() pack = pack |> Repo.reload!()
[empty_pack: pack, shot_record: shot_record] [empty_pack: pack, shot_record: shot_record]
@ -57,92 +57,92 @@ defmodule CanneryWeb.PackLiveTest do
test "lists all packs", %{conn: conn, pack: pack} do test "lists all packs", %{conn: conn, pack: pack} do
{:ok, _index_live, html} = live(conn, Routes.pack_index_path(conn, :index)) {: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 =~ "Ammo"
assert html =~ pack.ammo_type.name assert html =~ pack.type.name
end end
test "can sort by type", test "can sort by type",
%{conn: conn, container: container, current_user: current_user} do %{conn: conn, container: container, current_user: current_user} do
rifle_type = ammo_type_fixture(%{class: :rifle}, current_user) rifle_type = type_fixture(%{class: :rifle}, current_user)
{1, [rifle_pack]} = pack_fixture(rifle_type, container, 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) {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) {1, [pistol_pack]} = pack_fixture(pistol_type, container, current_user)
{:ok, index_live, html} = live(conn, Routes.pack_index_path(conn, :index)) {:ok, index_live, html} = live(conn, Routes.pack_index_path(conn, :index))
assert html =~ "All" assert html =~ "All"
assert html =~ rifle_pack.ammo_type.name assert html =~ rifle_pack.type.name
assert html =~ shotgun_pack.ammo_type.name assert html =~ shotgun_pack.type.name
assert html =~ pistol_pack.ammo_type.name assert html =~ pistol_pack.type.name
html = html =
index_live index_live
|> form(~s/form[phx-change="change_class"]/) |> 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 assert html =~ rifle_pack.type.name
refute html =~ shotgun_pack.ammo_type.name refute html =~ shotgun_pack.type.name
refute html =~ pistol_pack.ammo_type.name refute html =~ pistol_pack.type.name
html = html =
index_live index_live
|> form(~s/form[phx-change="change_class"]/) |> 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 refute html =~ rifle_pack.type.name
assert html =~ shotgun_pack.ammo_type.name assert html =~ shotgun_pack.type.name
refute html =~ pistol_pack.ammo_type.name refute html =~ pistol_pack.type.name
html = html =
index_live index_live
|> form(~s/form[phx-change="change_class"]/) |> 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 =~ rifle_pack.type.name
refute html =~ shotgun_pack.ammo_type.name refute html =~ shotgun_pack.type.name
assert html =~ pistol_pack.ammo_type.name assert html =~ pistol_pack.type.name
html = html =
index_live index_live
|> form(~s/form[phx-change="change_class"]/) |> 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 =~ rifle_pack.type.name
assert html =~ shotgun_pack.ammo_type.name assert html =~ shotgun_pack.type.name
assert html =~ pistol_pack.ammo_type.name assert html =~ pistol_pack.type.name
end end
test "can search for packs", %{conn: conn, pack: pack} do test "can search for packs", %{conn: conn, pack: pack} do
{:ok, index_live, html} = live(conn, Routes.pack_index_path(conn, :index)) {: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 assert index_live
|> form(~s/form[phx-change="search"]/) |> form(~s/form[phx-change="search"]/)
|> render_change(search: %{search_term: pack.ammo_type.name}) =~ |> render_change(search: %{search_term: pack.type.name}) =~
pack.ammo_type.name pack.type.name
assert_patch( assert_patch(
index_live, index_live,
Routes.pack_index_path(conn, :search, pack.ammo_type.name) Routes.pack_index_path(conn, :search, pack.type.name)
) )
refute index_live refute index_live
|> form(~s/form[phx-change="search"]/) |> form(~s/form[phx-change="search"]/)
|> render_change(search: %{search_term: "something_else"}) =~ |> 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_patch(index_live, Routes.pack_index_path(conn, :search, "something_else"))
assert index_live assert index_live
|> form(~s/form[phx-change="search"]/) |> 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)) assert_patch(index_live, Routes.pack_index_path(conn, :index))
end end
@ -366,9 +366,9 @@ defmodule CanneryWeb.PackLiveTest do
test "displays pack", %{conn: conn, pack: pack} do test "displays pack", %{conn: conn, pack: pack} do
{:ok, _show_live, html} = live(conn, Routes.pack_show_path(conn, :show, pack)) {: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 =~ "Show Ammo"
assert html =~ pack.ammo_type.name assert html =~ pack.type.name
end end
test "updates pack within modal", %{conn: conn, pack: pack} do 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 defp create_shot_record(%{current_user: current_user}) do
container = container_fixture(%{staged: true}, current_user) container = container_fixture(%{staged: true}, current_user)
ammo_type = ammo_type_fixture(current_user) 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 = shot_record =
%{count: 5, date: ~N[2022-02-13 03:17:00], notes: "some notes"} %{count: 5, date: ~N[2022-02-13 03:17:00], notes: "some notes"}
@ -24,7 +24,7 @@ defmodule CanneryWeb.RangeLiveTest do
[ [
container: container, container: container,
ammo_type: ammo_type, type: type,
pack: pack, pack: pack,
shot_record: shot_record shot_record: shot_record
] ]
@ -42,18 +42,18 @@ defmodule CanneryWeb.RangeLiveTest do
test "can sort by type", test "can sort by type",
%{conn: conn, container: container, current_user: current_user} do %{conn: conn, container: container, current_user: current_user} do
rifle_ammo_type = ammo_type_fixture(%{class: :rifle}, current_user) rifle_type = type_fixture(%{class: :rifle}, current_user)
{1, [rifle_pack]} = pack_fixture(rifle_ammo_type, container, 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) rifle_shot_record = shot_record_fixture(%{notes: "group_one"}, current_user, rifle_pack)
shotgun_ammo_type = ammo_type_fixture(%{class: :shotgun}, current_user) shotgun_type = type_fixture(%{class: :shotgun}, current_user)
{1, [shotgun_pack]} = pack_fixture(shotgun_ammo_type, container, 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) shotgun_shot_record = shot_record_fixture(%{notes: "group_two"}, current_user, shotgun_pack)
pistol_ammo_type = ammo_type_fixture(%{class: :pistol}, current_user) pistol_type = type_fixture(%{class: :pistol}, current_user)
{1, [pistol_pack]} = pack_fixture(pistol_ammo_type, container, 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) pistol_shot_record = shot_record_fixture(%{notes: "group_three"}, current_user, pistol_pack)
@ -68,7 +68,7 @@ defmodule CanneryWeb.RangeLiveTest do
html = html =
index_live index_live
|> form(~s/form[phx-change="change_class"]/) |> form(~s/form[phx-change="change_class"]/)
|> render_change(ammo_type: %{class: :rifle}) |> render_change(type: %{class: :rifle})
assert html =~ rifle_shot_record.notes assert html =~ rifle_shot_record.notes
refute html =~ shotgun_shot_record.notes refute html =~ shotgun_shot_record.notes
@ -77,7 +77,7 @@ defmodule CanneryWeb.RangeLiveTest do
html = html =
index_live index_live
|> form(~s/form[phx-change="change_class"]/) |> form(~s/form[phx-change="change_class"]/)
|> render_change(ammo_type: %{class: :shotgun}) |> render_change(type: %{class: :shotgun})
refute html =~ rifle_shot_record.notes refute html =~ rifle_shot_record.notes
assert html =~ shotgun_shot_record.notes assert html =~ shotgun_shot_record.notes
@ -86,7 +86,7 @@ defmodule CanneryWeb.RangeLiveTest do
html = html =
index_live index_live
|> form(~s/form[phx-change="change_class"]/) |> 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 =~ rifle_shot_record.notes
refute html =~ shotgun_shot_record.notes refute html =~ shotgun_shot_record.notes
@ -95,7 +95,7 @@ defmodule CanneryWeb.RangeLiveTest do
html = html =
index_live index_live
|> form(~s/form[phx-change="change_class"]/) |> 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 =~ rifle_shot_record.notes
assert html =~ shotgun_shot_record.notes assert html =~ shotgun_shot_record.notes

View File

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