fix not showing 0 if ammo type with 0 rounds
This commit is contained in:
parent
91cf9d0eb5
commit
ee28de1178
@ -90,7 +90,7 @@ defmodule Cannery.Ammo do
|
|||||||
from ag in AmmoGroup,
|
from ag in AmmoGroup,
|
||||||
where: ag.ammo_type_id == ^ammo_type_id,
|
where: ag.ammo_type_id == ^ammo_type_id,
|
||||||
select: sum(ag.count)
|
select: sum(ag.count)
|
||||||
)
|
) || 0
|
||||||
end
|
end
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
@ -117,7 +117,7 @@ defmodule Cannery.Ammo do
|
|||||||
left_join: sg in assoc(ag, :shot_groups),
|
left_join: sg in assoc(ag, :shot_groups),
|
||||||
where: ag.ammo_type_id == ^ammo_type_id,
|
where: ag.ammo_type_id == ^ammo_type_id,
|
||||||
select: sum(sg.count)
|
select: sum(sg.count)
|
||||||
)
|
) || 0
|
||||||
end
|
end
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
|
@ -100,9 +100,8 @@
|
|||||||
) %>
|
) %>
|
||||||
</span>
|
</span>
|
||||||
<% else %>
|
<% else %>
|
||||||
<h3 class="title text-lg col-span-2">
|
<h3 class="mx-8 my-4 title text-lg text-primary-600 col-span-2">
|
||||||
<%= gettext("No cost information") %>
|
<%= gettext("No cost information") %>
|
||||||
<%= display_emoji("😔") %>
|
|
||||||
</h3>
|
</h3>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
@ -111,8 +110,10 @@
|
|||||||
|
|
||||||
<div>
|
<div>
|
||||||
<%= if @ammo_groups |> Enum.empty?() do %>
|
<%= if @ammo_groups |> Enum.empty?() do %>
|
||||||
|
<h2 class="mx-8 my-4 title text-lg text-primary-600">
|
||||||
<%= gettext("No ammo for this type") %>
|
<%= gettext("No ammo for this type") %>
|
||||||
<%= display_emoji("😔") %>
|
<%= display_emoji("😔") %>
|
||||||
|
</h2>
|
||||||
<% else %>
|
<% else %>
|
||||||
<div class="flex flex-wrap justify-center items-center">
|
<div class="flex flex-wrap justify-center items-center">
|
||||||
<%= for ammo_group <- @ammo_groups do %>
|
<%= for ammo_group <- @ammo_groups do %>
|
||||||
|
Loading…
Reference in New Issue
Block a user