fix shot records table disappearing after selecting an empty ammo class

This commit is contained in:
2023-03-30 19:59:53 -04:00
parent 6ed3312ea8
commit 32801828fa
11 changed files with 50 additions and 8 deletions

View File

@ -127,6 +127,7 @@ defmodule CanneryWeb.RangeLive.Index do
original_counts = packs |> Ammo.get_original_counts(current_user)
cprs = packs |> Ammo.get_cprs(current_user)
last_used_dates = packs |> ActivityLog.get_last_used_dates(current_user)
shot_record_count = ActivityLog.get_shot_record_count!(current_user)
socket
|> assign(
@ -135,7 +136,8 @@ defmodule CanneryWeb.RangeLive.Index do
cprs: cprs,
last_used_dates: last_used_dates,
chart_data: chart_data,
shot_groups: shot_groups
shot_groups: shot_groups,
shot_record_count: shot_record_count
)
end

View File

@ -50,7 +50,7 @@
<hr class="hr" />
<%= if @shot_groups |> Enum.empty?() and @search |> is_nil() do %>
<%= if @shot_record_count == 0 do %>
<h1 class="title text-xl text-primary-600">
<%= gettext("No shots recorded") %>
<%= display_emoji("😔") %>