forked from shibao/cannery
improve Ammo.get_round_count
This commit is contained in:
@ -35,7 +35,7 @@
|
||||
|
||||
<span class="rounded-lg title text-lg">
|
||||
<%= gettext("Rounds:") %>
|
||||
<%= @container |> Ammo.get_round_count_for_container!(@current_user) %>
|
||||
<%= Ammo.get_round_count(@current_user, container_id: @container.id) %>
|
||||
</span>
|
||||
<% end %>
|
||||
|
||||
|
@ -59,15 +59,12 @@ defmodule CanneryWeb.ExportController do
|
||||
containers =
|
||||
Containers.list_containers(current_user)
|
||||
|> Enum.map(fn container ->
|
||||
pack_count = Ammo.get_packs_count(current_user, container_id: container.id)
|
||||
round_count = container |> Ammo.get_round_count_for_container!(current_user)
|
||||
|
||||
container
|
||||
|> Jason.encode!()
|
||||
|> Jason.decode!()
|
||||
|> Map.merge(%{
|
||||
"pack_count" => pack_count,
|
||||
"round_count" => round_count
|
||||
"pack_count" => Ammo.get_packs_count(current_user, container_id: container.id),
|
||||
"round_count" => Ammo.get_round_count(current_user, container_id: container.id)
|
||||
})
|
||||
end)
|
||||
|
||||
|
@ -122,7 +122,7 @@ defmodule CanneryWeb.ContainerLive.Show do
|
||||
socket
|
||||
|> assign(
|
||||
container: container,
|
||||
round_count: container |> Ammo.get_round_count_for_container!(current_user),
|
||||
round_count: Ammo.get_round_count(current_user, container_id: container.id),
|
||||
packs_count: Ammo.get_packs_count(current_user, container_id: container.id),
|
||||
packs: packs,
|
||||
original_counts: original_counts,
|
||||
|
@ -95,7 +95,7 @@ defmodule CanneryWeb.TypeLive.Show do
|
||||
cprs: packs |> Ammo.get_cprs(current_user),
|
||||
last_used_dates: packs |> ActivityLog.get_last_used_dates(current_user),
|
||||
avg_cost_per_round: type |> Ammo.get_average_cost_for_type(current_user),
|
||||
rounds: type |> Ammo.get_round_count_for_type(current_user),
|
||||
rounds: Ammo.get_round_count(current_user, type_id: type.id),
|
||||
original_counts: original_counts,
|
||||
used_rounds: used_rounds,
|
||||
historical_round_count: historical_round_count,
|
||||
|
Reference in New Issue
Block a user