add search to range index

This commit is contained in:
shibao 2022-12-03 21:27:39 -05:00
parent 3ea4b77b67
commit 45da547f62
20 changed files with 342 additions and 110 deletions

View File

@ -1,6 +1,7 @@
# v0.8.0 # v0.8.0
- Add search to catalog, ammo, container and tag index - Add search to catalog, ammo, container, tag and range index pages
- Tweak urls for catalog, ammo, containers and tags - Tweak urls for catalog, ammo, containers, tags and shot records
- Fix bug with shot group chart not drawing lines between days correctly
# v0.7.2 # v0.7.2
- Code improvements - Code improvements

View File

@ -80,6 +80,27 @@ export default {
} }
}) })
}, },
mounted () { this.initalizeChart(this.el) }, updateChart (el) {
updated () { this.initalizeChart(this.el) } const data = JSON.parse(el.dataset.chartData)
this.el.chart.data = {
datasets: [{
label: el.dataset.label,
data: data.map(({ date, count, label }) => ({
label,
x: date,
y: count
})),
backgroundColor: `${el.dataset.color}77`,
borderColor: el.dataset.color,
fill: true,
borderWidth: 3,
pointBorderWidth: 1
}]
}
this.el.chart.update()
},
mounted () { this.initalizeChart(this.el) },
updated () { this.updateChart(this.el) }
} }

View File

@ -15,10 +15,50 @@ defmodule Cannery.ActivityLog do
iex> list_shot_groups(%User{id: 123}) iex> list_shot_groups(%User{id: 123})
[%ShotGroup{}, ...] [%ShotGroup{}, ...]
iex> list_shot_groups("cool", %User{id: 123})
[%ShotGroup{notes: "My cool shot group"}, ...]
""" """
@spec list_shot_groups(User.t()) :: [ShotGroup.t()] @spec list_shot_groups(User.t()) :: [ShotGroup.t()]
def list_shot_groups(%User{id: user_id}) do @spec list_shot_groups(search :: nil | String.t(), User.t()) :: [ShotGroup.t()]
Repo.all(from(sg in ShotGroup, where: sg.user_id == ^user_id)) def list_shot_groups(search \\ nil, user)
def list_shot_groups(search, %{id: user_id}) when search |> is_nil() or search == "",
do: Repo.all(from sg in ShotGroup, where: sg.user_id == ^user_id)
def list_shot_groups(search, %{id: user_id}) when search |> is_binary() do
trimmed_search = String.trim(search)
Repo.all(
from sg in ShotGroup,
left_join: ag in assoc(sg, :ammo_group),
left_join: at in assoc(ag, :ammo_type),
where: sg.user_id == ^user_id,
where:
fragment(
"? @@ websearch_to_tsquery('english', ?)",
sg.search,
^trimmed_search
) or
fragment(
"? @@ websearch_to_tsquery('english', ?)",
ag.search,
^trimmed_search
) or
fragment(
"? @@ websearch_to_tsquery('english', ?)",
at.search,
^trimmed_search
),
order_by: {
:desc,
fragment(
"ts_rank_cd(?, websearch_to_tsquery('english', ?), 4)",
sg.search,
^trimmed_search
)
}
)
end end
@doc """ @doc """

View File

@ -10,7 +10,13 @@ defmodule CanneryWeb.RangeLive.Index do
alias Phoenix.LiveView.Socket alias Phoenix.LiveView.Socket
@impl true @impl true
def mount(_params, _session, socket), do: {:ok, socket |> display_shot_groups()} def mount(%{"search" => search}, _session, socket) do
{:ok, socket |> assign(search: search) |> display_shot_groups()}
end
def mount(_params, _session, socket) do
{:ok, socket |> assign(search: nil) |> display_shot_groups()}
end
@impl true @impl true
def handle_params(params, _url, %{assigns: %{live_action: live_action}} = socket) do def handle_params(params, _url, %{assigns: %{live_action: live_action}} = socket) do
@ -23,26 +29,46 @@ defmodule CanneryWeb.RangeLive.Index do
%{"id" => id} %{"id" => id}
) do ) do
socket socket
|> assign(:page_title, gettext("Record Shots")) |> assign(
|> assign(:ammo_group, Ammo.get_ammo_group!(id, current_user)) page_title: gettext("Record Shots"),
ammo_group: Ammo.get_ammo_group!(id, current_user)
)
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
socket socket
|> assign(:page_title, gettext("Edit Shot Records")) |> assign(
|> assign(:shot_group, ActivityLog.get_shot_group!(id, current_user)) page_title: gettext("Edit Shot Records"),
shot_group: ActivityLog.get_shot_group!(id, current_user)
)
end end
defp apply_action(socket, :new, _params) do defp apply_action(socket, :new, _params) do
socket socket
|> assign(:page_title, gettext("New Shot Records")) |> assign(
|> assign(:shot_group, %ShotGroup{}) page_title: gettext("New Shot Records"),
shot_group: %ShotGroup{}
)
end end
defp apply_action(socket, :index, _params) do defp apply_action(socket, :index, _params) do
socket socket
|> assign(:page_title, gettext("Shot Records")) |> assign(
|> assign(:shot_group, nil) page_title: gettext("Shot Records"),
search: nil,
shot_group: nil
)
|> display_shot_groups()
end
defp apply_action(socket, :search, %{"search" => search}) do
socket
|> assign(
page_title: gettext("Shot Records"),
search: search,
shot_group: nil
)
|> display_shot_groups()
end end
@impl true @impl true
@ -55,6 +81,7 @@ defmodule CanneryWeb.RangeLive.Index do
{:noreply, socket |> put_flash(:info, prompt) |> display_shot_groups()} {:noreply, socket |> put_flash(:info, prompt) |> display_shot_groups()}
end end
@impl true
def handle_event( def handle_event(
"toggle_staged", "toggle_staged",
%{"ammo_group_id" => ammo_group_id}, %{"ammo_group_id" => ammo_group_id},
@ -69,10 +96,20 @@ defmodule CanneryWeb.RangeLive.Index do
{:noreply, socket |> put_flash(:info, prompt) |> display_shot_groups()} {:noreply, socket |> put_flash(:info, prompt) |> display_shot_groups()}
end end
@impl true
def handle_event("search", %{"search" => %{"search_term" => ""}}, socket) do
{:noreply, socket |> push_patch(to: Routes.range_index_path(Endpoint, :index))}
end
def handle_event("search", %{"search" => %{"search_term" => search_term}}, socket) do
{:noreply, socket |> push_patch(to: Routes.range_index_path(Endpoint, :search, search_term))}
end
@spec display_shot_groups(Socket.t()) :: Socket.t() @spec display_shot_groups(Socket.t()) :: Socket.t()
defp display_shot_groups(%{assigns: %{current_user: current_user}} = socket) do defp display_shot_groups(%{assigns: %{search: search, current_user: current_user}} = socket) do
shot_groups = shot_groups =
ActivityLog.list_shot_groups(current_user) |> Repo.preload(ammo_group: :ammo_type) ActivityLog.list_shot_groups(search, current_user)
|> Repo.preload(ammo_group: :ammo_type)
ammo_groups = Ammo.list_staged_ammo_groups(current_user) ammo_groups = Ammo.list_staged_ammo_groups(current_user)
@ -114,7 +151,7 @@ defmodule CanneryWeb.RangeLive.Index do
label: gettext("Rounds shot: %{count}", count: sum) label: gettext("Rounds shot: %{count}", count: sum)
} }
end) end)
|> Enum.sort_by(fn %{date: date} -> date end) |> Enum.sort_by(fn %{date: date} -> date end, Date)
end end
@spec get_row_data_for_shot_group(ShotGroup.t(), [map()]) :: map() @spec get_row_data_for_shot_group(ShotGroup.t(), [map()]) :: map()

View File

@ -43,7 +43,7 @@
<hr class="hr" /> <hr class="hr" />
<%= if @shot_groups |> Enum.empty?() do %> <%= if @shot_groups |> Enum.empty?() and @search |> is_nil() do %>
<h1 class="title text-xl text-primary-600"> <h1 class="title text-xl text-primary-600">
<%= gettext("No shots recorded") %> <%= gettext("No shots recorded") %>
<%= display_emoji("😔") %> <%= display_emoji("😔") %>
@ -67,6 +67,30 @@
<%= dgettext("errors", "Your browser does not support the canvas element.") %> <%= dgettext("errors", "Your browser does not support the canvas element.") %>
</canvas> </canvas>
<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-xl">
<.form
:let={f}
for={:search}
phx-change="search"
phx-submit="search"
class="grow self-stretch flex flex-col items-stretch"
data-qa="shot_group_search"
>
<%= text_input(f, :search_term,
class: "input input-primary",
value: @search,
phx_debounce: 300,
placeholder: gettext("Search shot records")
) %>
</.form>
</div>
<%= if @shot_groups |> Enum.empty?() do %>
<h1 class="title text-xl text-primary-600">
<%= gettext("No shots recorded") %>
<%= display_emoji("😔") %>
</h1>
<% else %>
<.live_component <.live_component
module={CanneryWeb.Components.TableComponent} module={CanneryWeb.Components.TableComponent}
id="shot_groups_index_table" id="shot_groups_index_table"
@ -76,6 +100,7 @@
initial_sort_mode={:desc} initial_sort_mode={:desc}
/> />
<% end %> <% end %>
<% end %>
</div> </div>
<%= if @live_action in [:edit] do %> <%= if @live_action in [:edit] do %>

View File

@ -103,8 +103,9 @@ defmodule CanneryWeb.Router do
live "/ammo/show/:id/edit/:shot_group_id", AmmoGroupLive.Show, :edit_shot_group live "/ammo/show/:id/edit/:shot_group_id", AmmoGroupLive.Show, :edit_shot_group
live "/range", RangeLive.Index, :index live "/range", RangeLive.Index, :index
live "/range/:id/edit", RangeLive.Index, :edit live "/range/edit/:id", RangeLive.Index, :edit
live "/range/:id/add_shot_group", RangeLive.Index, :add_shot_group live "/range/add_shot_group/:id", RangeLive.Index, :add_shot_group
live "/range/search/:search", RangeLive.Index, :search
end end
scope "/", CanneryWeb do scope "/", CanneryWeb do

View File

@ -49,7 +49,7 @@ msgstr "Admins:"
#: lib/cannery_web/live/ammo_group_live/index.ex:70 #: lib/cannery_web/live/ammo_group_live/index.ex:70
#: lib/cannery_web/live/ammo_group_live/index.ex:79 #: lib/cannery_web/live/ammo_group_live/index.ex:79
#: lib/cannery_web/live/ammo_group_live/index.html.heex:3 #: lib/cannery_web/live/ammo_group_live/index.html.heex:3
#: lib/cannery_web/live/range_live/index.ex:80 #: lib/cannery_web/live/range_live/index.ex:117
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Ammo" msgid "Ammo"
msgstr "Munition" msgstr "Munition"
@ -316,7 +316,7 @@ msgstr "Keine Tags"
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:49 #: lib/cannery_web/live/ammo_group_live/form_component.html.heex:49
#: lib/cannery_web/live/ammo_group_live/show.ex:93 #: lib/cannery_web/live/ammo_group_live/show.ex:93
#: lib/cannery_web/live/range_live/form_component.html.heex:29 #: lib/cannery_web/live/range_live/form_component.html.heex:29
#: lib/cannery_web/live/range_live/index.ex:82 #: lib/cannery_web/live/range_live/index.ex:119
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Notes" msgid "Notes"
msgstr "Bemerkungen" msgstr "Bemerkungen"
@ -480,7 +480,7 @@ msgstr "Range Day"
#: lib/cannery_web/components/add_shot_group_component.html.heex:45 #: lib/cannery_web/components/add_shot_group_component.html.heex:45
#: lib/cannery_web/live/ammo_group_live/show.ex:94 #: lib/cannery_web/live/ammo_group_live/show.ex:94
#: lib/cannery_web/live/range_live/form_component.html.heex:36 #: lib/cannery_web/live/range_live/form_component.html.heex:36
#: lib/cannery_web/live/range_live/index.ex:83 #: lib/cannery_web/live/range_live/index.ex:120
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Date" msgid "Date"
msgstr "Datum" msgstr "Datum"
@ -502,17 +502,18 @@ msgid "Record shots"
msgstr "Schüsse dokumentieren" msgstr "Schüsse dokumentieren"
#: lib/cannery_web/live/ammo_group_live/show.ex:42 #: lib/cannery_web/live/ammo_group_live/show.ex:42
#: lib/cannery_web/live/range_live/index.ex:32 #: lib/cannery_web/live/range_live/index.ex:41
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Edit Shot Records" msgid "Edit Shot Records"
msgstr "Schießkladde editieren" msgstr "Schießkladde editieren"
#: lib/cannery_web/live/range_live/index.ex:38 #: lib/cannery_web/live/range_live/index.ex:49
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "New Shot Records" msgid "New Shot Records"
msgstr "Neue Schießkladde" msgstr "Neue Schießkladde"
#: lib/cannery_web/live/range_live/index.html.heex:48 #: lib/cannery_web/live/range_live/index.html.heex:48
#: lib/cannery_web/live/range_live/index.html.heex:90
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "No shots recorded" msgid "No shots recorded"
msgstr "Keine Schüsse dokumentiert" msgstr "Keine Schüsse dokumentiert"
@ -524,13 +525,14 @@ msgid "Rounds left"
msgstr "Patronen verbleibend" msgstr "Patronen verbleibend"
#: lib/cannery_web/live/ammo_group_live/show.ex:92 #: lib/cannery_web/live/ammo_group_live/show.ex:92
#: lib/cannery_web/live/range_live/index.ex:81 #: lib/cannery_web/live/range_live/index.ex:118
#: lib/cannery_web/live/range_live/index.html.heex:62 #: lib/cannery_web/live/range_live/index.html.heex:62
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Rounds shot" msgid "Rounds shot"
msgstr "Patronen abgefeuert" msgstr "Patronen abgefeuert"
#: lib/cannery_web/live/range_live/index.ex:44 #: lib/cannery_web/live/range_live/index.ex:57
#: lib/cannery_web/live/range_live/index.ex:67
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Shot Records" msgid "Shot Records"
msgstr "Schießkladde" msgstr "Schießkladde"
@ -722,7 +724,7 @@ msgid "Reset your password"
msgstr "Passwort zurücksetzen" msgstr "Passwort zurücksetzen"
#: lib/cannery_web/live/ammo_group_live/show.ex:41 #: lib/cannery_web/live/ammo_group_live/show.ex:41
#: lib/cannery_web/live/range_live/index.ex:26 #: lib/cannery_web/live/range_live/index.ex:33
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Record Shots" msgid "Record Shots"
msgstr "Schüsse dokumentieren" msgstr "Schüsse dokumentieren"
@ -860,7 +862,7 @@ msgstr ""
msgid "%{percentage}%" msgid "%{percentage}%"
msgstr "" msgstr ""
#: lib/cannery_web/live/range_live/index.ex:114 #: lib/cannery_web/live/range_live/index.ex:151
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "Rounds shot: %{count}" msgid "Rounds shot: %{count}"
msgstr "Patronen abgefeuert" msgstr "Patronen abgefeuert"
@ -1139,3 +1141,8 @@ msgstr ""
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "Search tags" msgid "Search tags"
msgstr "" msgstr ""
#: lib/cannery_web/live/range_live/index.html.heex:83
#, elixir-autogen, elixir-format
msgid "Search shot records"
msgstr ""

View File

@ -209,13 +209,13 @@ msgid "Are you sure you want to unstage this ammo?"
msgstr "Sind sie sicher, dass Sie diese Munition demarkieren möchten?" msgstr "Sind sie sicher, dass Sie diese Munition demarkieren möchten?"
#: lib/cannery_web/live/ammo_group_live/show.ex:137 #: lib/cannery_web/live/ammo_group_live/show.ex:137
#: lib/cannery_web/live/range_live/index.ex:159 #: lib/cannery_web/live/range_live/index.ex:196
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Are you sure you want to delete this shot record?" msgid "Are you sure you want to delete this shot record?"
msgstr "Sind sie sicher, dass sie die Schießkladde löschen möchten?" msgstr "Sind sie sicher, dass sie die Schießkladde löschen möchten?"
#: lib/cannery_web/live/ammo_group_live/show.ex:83 #: lib/cannery_web/live/ammo_group_live/show.ex:83
#: lib/cannery_web/live/range_live/index.ex:54 #: lib/cannery_web/live/range_live/index.ex:80
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Shot records deleted succesfully" msgid "Shot records deleted succesfully"
msgstr "Schießkladde erfolgreich gelöscht" msgstr "Schießkladde erfolgreich gelöscht"
@ -272,7 +272,7 @@ msgstr "Spracheinstellung gespeichert."
msgid "Ammo deleted succesfully" msgid "Ammo deleted succesfully"
msgstr "Munitionsgruppe erfolgreich gelöscht" msgstr "Munitionsgruppe erfolgreich gelöscht"
#: lib/cannery_web/live/range_live/index.ex:68 #: lib/cannery_web/live/range_live/index.ex:95
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "Ammo unstaged succesfully" msgid "Ammo unstaged succesfully"
msgstr "Munition erfolgreich demarkiert" msgstr "Munition erfolgreich demarkiert"

View File

@ -34,7 +34,7 @@ msgstr ""
#: lib/cannery_web/live/ammo_group_live/index.ex:70 #: lib/cannery_web/live/ammo_group_live/index.ex:70
#: lib/cannery_web/live/ammo_group_live/index.ex:79 #: lib/cannery_web/live/ammo_group_live/index.ex:79
#: lib/cannery_web/live/ammo_group_live/index.html.heex:3 #: lib/cannery_web/live/ammo_group_live/index.html.heex:3
#: lib/cannery_web/live/range_live/index.ex:80 #: lib/cannery_web/live/range_live/index.ex:117
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Ammo" msgid "Ammo"
msgstr "" msgstr ""
@ -301,7 +301,7 @@ msgstr ""
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:49 #: lib/cannery_web/live/ammo_group_live/form_component.html.heex:49
#: lib/cannery_web/live/ammo_group_live/show.ex:93 #: lib/cannery_web/live/ammo_group_live/show.ex:93
#: lib/cannery_web/live/range_live/form_component.html.heex:29 #: lib/cannery_web/live/range_live/form_component.html.heex:29
#: lib/cannery_web/live/range_live/index.ex:82 #: lib/cannery_web/live/range_live/index.ex:119
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Notes" msgid "Notes"
msgstr "" msgstr ""
@ -463,7 +463,7 @@ msgstr ""
#: lib/cannery_web/components/add_shot_group_component.html.heex:45 #: lib/cannery_web/components/add_shot_group_component.html.heex:45
#: lib/cannery_web/live/ammo_group_live/show.ex:94 #: lib/cannery_web/live/ammo_group_live/show.ex:94
#: lib/cannery_web/live/range_live/form_component.html.heex:36 #: lib/cannery_web/live/range_live/form_component.html.heex:36
#: lib/cannery_web/live/range_live/index.ex:83 #: lib/cannery_web/live/range_live/index.ex:120
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Date" msgid "Date"
msgstr "" msgstr ""
@ -485,17 +485,18 @@ msgid "Record shots"
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_group_live/show.ex:42 #: lib/cannery_web/live/ammo_group_live/show.ex:42
#: lib/cannery_web/live/range_live/index.ex:32 #: lib/cannery_web/live/range_live/index.ex:41
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Edit Shot Records" msgid "Edit Shot Records"
msgstr "" msgstr ""
#: lib/cannery_web/live/range_live/index.ex:38 #: lib/cannery_web/live/range_live/index.ex:49
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "New Shot Records" msgid "New Shot Records"
msgstr "" msgstr ""
#: lib/cannery_web/live/range_live/index.html.heex:48 #: lib/cannery_web/live/range_live/index.html.heex:48
#: lib/cannery_web/live/range_live/index.html.heex:90
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "No shots recorded" msgid "No shots recorded"
msgstr "" msgstr ""
@ -507,13 +508,14 @@ msgid "Rounds left"
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_group_live/show.ex:92 #: lib/cannery_web/live/ammo_group_live/show.ex:92
#: lib/cannery_web/live/range_live/index.ex:81 #: lib/cannery_web/live/range_live/index.ex:118
#: lib/cannery_web/live/range_live/index.html.heex:62 #: lib/cannery_web/live/range_live/index.html.heex:62
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Rounds shot" msgid "Rounds shot"
msgstr "" msgstr ""
#: lib/cannery_web/live/range_live/index.ex:44 #: lib/cannery_web/live/range_live/index.ex:57
#: lib/cannery_web/live/range_live/index.ex:67
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Shot Records" msgid "Shot Records"
msgstr "" msgstr ""
@ -705,7 +707,7 @@ msgid "Reset your password"
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_group_live/show.ex:41 #: lib/cannery_web/live/ammo_group_live/show.ex:41
#: lib/cannery_web/live/range_live/index.ex:26 #: lib/cannery_web/live/range_live/index.ex:33
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Record Shots" msgid "Record Shots"
msgstr "" msgstr ""
@ -843,7 +845,7 @@ msgstr ""
msgid "%{percentage}%" msgid "%{percentage}%"
msgstr "" msgstr ""
#: lib/cannery_web/live/range_live/index.ex:114 #: lib/cannery_web/live/range_live/index.ex:151
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Rounds shot: %{count}" msgid "Rounds shot: %{count}"
msgstr "" msgstr ""
@ -1122,3 +1124,8 @@ msgstr ""
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Search tags" msgid "Search tags"
msgstr "" msgstr ""
#: lib/cannery_web/live/range_live/index.html.heex:83
#, elixir-autogen, elixir-format
msgid "Search shot records"
msgstr ""

View File

@ -35,7 +35,7 @@ msgstr ""
#: lib/cannery_web/live/ammo_group_live/index.ex:70 #: lib/cannery_web/live/ammo_group_live/index.ex:70
#: lib/cannery_web/live/ammo_group_live/index.ex:79 #: lib/cannery_web/live/ammo_group_live/index.ex:79
#: lib/cannery_web/live/ammo_group_live/index.html.heex:3 #: lib/cannery_web/live/ammo_group_live/index.html.heex:3
#: lib/cannery_web/live/range_live/index.ex:80 #: lib/cannery_web/live/range_live/index.ex:117
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Ammo" msgid "Ammo"
msgstr "" msgstr ""
@ -302,7 +302,7 @@ msgstr ""
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:49 #: lib/cannery_web/live/ammo_group_live/form_component.html.heex:49
#: lib/cannery_web/live/ammo_group_live/show.ex:93 #: lib/cannery_web/live/ammo_group_live/show.ex:93
#: lib/cannery_web/live/range_live/form_component.html.heex:29 #: lib/cannery_web/live/range_live/form_component.html.heex:29
#: lib/cannery_web/live/range_live/index.ex:82 #: lib/cannery_web/live/range_live/index.ex:119
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Notes" msgid "Notes"
msgstr "" msgstr ""
@ -464,7 +464,7 @@ msgstr ""
#: lib/cannery_web/components/add_shot_group_component.html.heex:45 #: lib/cannery_web/components/add_shot_group_component.html.heex:45
#: lib/cannery_web/live/ammo_group_live/show.ex:94 #: lib/cannery_web/live/ammo_group_live/show.ex:94
#: lib/cannery_web/live/range_live/form_component.html.heex:36 #: lib/cannery_web/live/range_live/form_component.html.heex:36
#: lib/cannery_web/live/range_live/index.ex:83 #: lib/cannery_web/live/range_live/index.ex:120
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Date" msgid "Date"
msgstr "" msgstr ""
@ -486,17 +486,18 @@ msgid "Record shots"
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_group_live/show.ex:42 #: lib/cannery_web/live/ammo_group_live/show.ex:42
#: lib/cannery_web/live/range_live/index.ex:32 #: lib/cannery_web/live/range_live/index.ex:41
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Edit Shot Records" msgid "Edit Shot Records"
msgstr "" msgstr ""
#: lib/cannery_web/live/range_live/index.ex:38 #: lib/cannery_web/live/range_live/index.ex:49
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "New Shot Records" msgid "New Shot Records"
msgstr "" msgstr ""
#: lib/cannery_web/live/range_live/index.html.heex:48 #: lib/cannery_web/live/range_live/index.html.heex:48
#: lib/cannery_web/live/range_live/index.html.heex:90
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "No shots recorded" msgid "No shots recorded"
msgstr "" msgstr ""
@ -508,13 +509,14 @@ msgid "Rounds left"
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_group_live/show.ex:92 #: lib/cannery_web/live/ammo_group_live/show.ex:92
#: lib/cannery_web/live/range_live/index.ex:81 #: lib/cannery_web/live/range_live/index.ex:118
#: lib/cannery_web/live/range_live/index.html.heex:62 #: lib/cannery_web/live/range_live/index.html.heex:62
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Rounds shot" msgid "Rounds shot"
msgstr "" msgstr ""
#: lib/cannery_web/live/range_live/index.ex:44 #: lib/cannery_web/live/range_live/index.ex:57
#: lib/cannery_web/live/range_live/index.ex:67
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Shot Records" msgid "Shot Records"
msgstr "" msgstr ""
@ -706,7 +708,7 @@ msgid "Reset your password"
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_group_live/show.ex:41 #: lib/cannery_web/live/ammo_group_live/show.ex:41
#: lib/cannery_web/live/range_live/index.ex:26 #: lib/cannery_web/live/range_live/index.ex:33
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "Record Shots" msgid "Record Shots"
msgstr "" msgstr ""
@ -844,7 +846,7 @@ msgstr ""
msgid "%{percentage}%" msgid "%{percentage}%"
msgstr "" msgstr ""
#: lib/cannery_web/live/range_live/index.ex:114 #: lib/cannery_web/live/range_live/index.ex:151
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "Rounds shot: %{count}" msgid "Rounds shot: %{count}"
msgstr "" msgstr ""
@ -1123,3 +1125,8 @@ msgstr ""
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "Search tags" msgid "Search tags"
msgstr "" msgstr ""
#: lib/cannery_web/live/range_live/index.html.heex:83
#, elixir-autogen, elixir-format
msgid "Search shot records"
msgstr ""

View File

@ -189,13 +189,13 @@ msgid "Are you sure you want to unstage this ammo?"
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_group_live/show.ex:137 #: lib/cannery_web/live/ammo_group_live/show.ex:137
#: lib/cannery_web/live/range_live/index.ex:159 #: lib/cannery_web/live/range_live/index.ex:196
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Are you sure you want to delete this shot record?" msgid "Are you sure you want to delete this shot record?"
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_group_live/show.ex:83 #: lib/cannery_web/live/ammo_group_live/show.ex:83
#: lib/cannery_web/live/range_live/index.ex:54 #: lib/cannery_web/live/range_live/index.ex:80
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Shot records deleted succesfully" msgid "Shot records deleted succesfully"
msgstr "" msgstr ""
@ -252,7 +252,7 @@ msgstr ""
msgid "Ammo deleted succesfully" msgid "Ammo deleted succesfully"
msgstr "" msgstr ""
#: lib/cannery_web/live/range_live/index.ex:68 #: lib/cannery_web/live/range_live/index.ex:95
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "Ammo unstaged succesfully" msgid "Ammo unstaged succesfully"
msgstr "" msgstr ""

View File

@ -49,7 +49,7 @@ msgstr ""
#: lib/cannery_web/live/ammo_group_live/index.ex:70 #: lib/cannery_web/live/ammo_group_live/index.ex:70
#: lib/cannery_web/live/ammo_group_live/index.ex:79 #: lib/cannery_web/live/ammo_group_live/index.ex:79
#: lib/cannery_web/live/ammo_group_live/index.html.heex:3 #: lib/cannery_web/live/ammo_group_live/index.html.heex:3
#: lib/cannery_web/live/range_live/index.ex:80 #: lib/cannery_web/live/range_live/index.ex:117
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Ammo" msgid "Ammo"
msgstr "" msgstr ""
@ -316,7 +316,7 @@ msgstr ""
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:49 #: lib/cannery_web/live/ammo_group_live/form_component.html.heex:49
#: lib/cannery_web/live/ammo_group_live/show.ex:93 #: lib/cannery_web/live/ammo_group_live/show.ex:93
#: lib/cannery_web/live/range_live/form_component.html.heex:29 #: lib/cannery_web/live/range_live/form_component.html.heex:29
#: lib/cannery_web/live/range_live/index.ex:82 #: lib/cannery_web/live/range_live/index.ex:119
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Notes" msgid "Notes"
msgstr "" msgstr ""
@ -478,7 +478,7 @@ msgstr ""
#: lib/cannery_web/components/add_shot_group_component.html.heex:45 #: lib/cannery_web/components/add_shot_group_component.html.heex:45
#: lib/cannery_web/live/ammo_group_live/show.ex:94 #: lib/cannery_web/live/ammo_group_live/show.ex:94
#: lib/cannery_web/live/range_live/form_component.html.heex:36 #: lib/cannery_web/live/range_live/form_component.html.heex:36
#: lib/cannery_web/live/range_live/index.ex:83 #: lib/cannery_web/live/range_live/index.ex:120
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Date" msgid "Date"
msgstr "" msgstr ""
@ -500,17 +500,18 @@ msgid "Record shots"
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_group_live/show.ex:42 #: lib/cannery_web/live/ammo_group_live/show.ex:42
#: lib/cannery_web/live/range_live/index.ex:32 #: lib/cannery_web/live/range_live/index.ex:41
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Edit Shot Records" msgid "Edit Shot Records"
msgstr "" msgstr ""
#: lib/cannery_web/live/range_live/index.ex:38 #: lib/cannery_web/live/range_live/index.ex:49
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "New Shot Records" msgid "New Shot Records"
msgstr "" msgstr ""
#: lib/cannery_web/live/range_live/index.html.heex:48 #: lib/cannery_web/live/range_live/index.html.heex:48
#: lib/cannery_web/live/range_live/index.html.heex:90
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "No shots recorded" msgid "No shots recorded"
msgstr "" msgstr ""
@ -522,13 +523,14 @@ msgid "Rounds left"
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_group_live/show.ex:92 #: lib/cannery_web/live/ammo_group_live/show.ex:92
#: lib/cannery_web/live/range_live/index.ex:81 #: lib/cannery_web/live/range_live/index.ex:118
#: lib/cannery_web/live/range_live/index.html.heex:62 #: lib/cannery_web/live/range_live/index.html.heex:62
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Rounds shot" msgid "Rounds shot"
msgstr "" msgstr ""
#: lib/cannery_web/live/range_live/index.ex:44 #: lib/cannery_web/live/range_live/index.ex:57
#: lib/cannery_web/live/range_live/index.ex:67
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Shot Records" msgid "Shot Records"
msgstr "" msgstr ""
@ -720,7 +722,7 @@ msgid "Reset your password"
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_group_live/show.ex:41 #: lib/cannery_web/live/ammo_group_live/show.ex:41
#: lib/cannery_web/live/range_live/index.ex:26 #: lib/cannery_web/live/range_live/index.ex:33
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Record Shots" msgid "Record Shots"
msgstr "" msgstr ""
@ -858,7 +860,7 @@ msgstr ""
msgid "%{percentage}%" msgid "%{percentage}%"
msgstr "" msgstr ""
#: lib/cannery_web/live/range_live/index.ex:114 #: lib/cannery_web/live/range_live/index.ex:151
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "Rounds shot: %{count}" msgid "Rounds shot: %{count}"
msgstr "" msgstr ""
@ -1137,3 +1139,8 @@ msgstr ""
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "Search tags" msgid "Search tags"
msgstr "" msgstr ""
#: lib/cannery_web/live/range_live/index.html.heex:83
#, elixir-autogen, elixir-format
msgid "Search shot records"
msgstr ""

View File

@ -208,13 +208,13 @@ msgid "Are you sure you want to unstage this ammo?"
msgstr "Está seguro que desea desmontar esta munición?" msgstr "Está seguro que desea desmontar esta munición?"
#: lib/cannery_web/live/ammo_group_live/show.ex:137 #: lib/cannery_web/live/ammo_group_live/show.ex:137
#: lib/cannery_web/live/range_live/index.ex:159 #: lib/cannery_web/live/range_live/index.ex:196
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Are you sure you want to delete this shot record?" msgid "Are you sure you want to delete this shot record?"
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_group_live/show.ex:83 #: lib/cannery_web/live/ammo_group_live/show.ex:83
#: lib/cannery_web/live/range_live/index.ex:54 #: lib/cannery_web/live/range_live/index.ex:80
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Shot records deleted succesfully" msgid "Shot records deleted succesfully"
msgstr "" msgstr ""
@ -271,7 +271,7 @@ msgstr ""
msgid "Ammo deleted succesfully" msgid "Ammo deleted succesfully"
msgstr "" msgstr ""
#: lib/cannery_web/live/range_live/index.ex:68 #: lib/cannery_web/live/range_live/index.ex:95
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "Ammo unstaged succesfully" msgid "Ammo unstaged succesfully"
msgstr "" msgstr ""

View File

@ -49,7 +49,7 @@ msgstr "Administrateur·ices:"
#: lib/cannery_web/live/ammo_group_live/index.ex:70 #: lib/cannery_web/live/ammo_group_live/index.ex:70
#: lib/cannery_web/live/ammo_group_live/index.ex:79 #: lib/cannery_web/live/ammo_group_live/index.ex:79
#: lib/cannery_web/live/ammo_group_live/index.html.heex:3 #: lib/cannery_web/live/ammo_group_live/index.html.heex:3
#: lib/cannery_web/live/range_live/index.ex:80 #: lib/cannery_web/live/range_live/index.ex:117
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Ammo" msgid "Ammo"
msgstr "Munition" msgstr "Munition"
@ -316,7 +316,7 @@ msgstr "Aucun tag"
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:49 #: lib/cannery_web/live/ammo_group_live/form_component.html.heex:49
#: lib/cannery_web/live/ammo_group_live/show.ex:93 #: lib/cannery_web/live/ammo_group_live/show.ex:93
#: lib/cannery_web/live/range_live/form_component.html.heex:29 #: lib/cannery_web/live/range_live/form_component.html.heex:29
#: lib/cannery_web/live/range_live/index.ex:82 #: lib/cannery_web/live/range_live/index.ex:119
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Notes" msgid "Notes"
msgstr "Notes" msgstr "Notes"
@ -482,7 +482,7 @@ msgstr "Journée de stand"
#: lib/cannery_web/components/add_shot_group_component.html.heex:45 #: lib/cannery_web/components/add_shot_group_component.html.heex:45
#: lib/cannery_web/live/ammo_group_live/show.ex:94 #: lib/cannery_web/live/ammo_group_live/show.ex:94
#: lib/cannery_web/live/range_live/form_component.html.heex:36 #: lib/cannery_web/live/range_live/form_component.html.heex:36
#: lib/cannery_web/live/range_live/index.ex:83 #: lib/cannery_web/live/range_live/index.ex:120
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Date" msgid "Date"
msgstr "Date" msgstr "Date"
@ -504,17 +504,18 @@ msgid "Record shots"
msgstr "Tirs enregistrés" msgstr "Tirs enregistrés"
#: lib/cannery_web/live/ammo_group_live/show.ex:42 #: lib/cannery_web/live/ammo_group_live/show.ex:42
#: lib/cannery_web/live/range_live/index.ex:32 #: lib/cannery_web/live/range_live/index.ex:41
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Edit Shot Records" msgid "Edit Shot Records"
msgstr "Modifier les enregistrements de tir" msgstr "Modifier les enregistrements de tir"
#: lib/cannery_web/live/range_live/index.ex:38 #: lib/cannery_web/live/range_live/index.ex:49
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "New Shot Records" msgid "New Shot Records"
msgstr "Nouveaux enregistrements de tir" msgstr "Nouveaux enregistrements de tir"
#: lib/cannery_web/live/range_live/index.html.heex:48 #: lib/cannery_web/live/range_live/index.html.heex:48
#: lib/cannery_web/live/range_live/index.html.heex:90
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "No shots recorded" msgid "No shots recorded"
msgstr "Aucun tir enregistré" msgstr "Aucun tir enregistré"
@ -526,13 +527,14 @@ msgid "Rounds left"
msgstr "Cartouches restantes" msgstr "Cartouches restantes"
#: lib/cannery_web/live/ammo_group_live/show.ex:92 #: lib/cannery_web/live/ammo_group_live/show.ex:92
#: lib/cannery_web/live/range_live/index.ex:81 #: lib/cannery_web/live/range_live/index.ex:118
#: lib/cannery_web/live/range_live/index.html.heex:62 #: lib/cannery_web/live/range_live/index.html.heex:62
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Rounds shot" msgid "Rounds shot"
msgstr "Cartouches tirées" msgstr "Cartouches tirées"
#: lib/cannery_web/live/range_live/index.ex:44 #: lib/cannery_web/live/range_live/index.ex:57
#: lib/cannery_web/live/range_live/index.ex:67
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Shot Records" msgid "Shot Records"
msgstr "Enregistrements de tir" msgstr "Enregistrements de tir"
@ -724,7 +726,7 @@ msgid "Reset your password"
msgstr "Réinitialiser votre mot de passe" msgstr "Réinitialiser votre mot de passe"
#: lib/cannery_web/live/ammo_group_live/show.ex:41 #: lib/cannery_web/live/ammo_group_live/show.ex:41
#: lib/cannery_web/live/range_live/index.ex:26 #: lib/cannery_web/live/range_live/index.ex:33
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Record Shots" msgid "Record Shots"
msgstr "Enregistrer des tirs" msgstr "Enregistrer des tirs"
@ -863,7 +865,7 @@ msgstr ""
msgid "%{percentage}%" msgid "%{percentage}%"
msgstr "" msgstr ""
#: lib/cannery_web/live/range_live/index.ex:114 #: lib/cannery_web/live/range_live/index.ex:151
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "Rounds shot: %{count}" msgid "Rounds shot: %{count}"
msgstr "Cartouches tirées" msgstr "Cartouches tirées"
@ -1142,3 +1144,8 @@ msgstr ""
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "Search tags" msgid "Search tags"
msgstr "" msgstr ""
#: lib/cannery_web/live/range_live/index.html.heex:83
#, elixir-autogen, elixir-format
msgid "Search shot records"
msgstr ""

View File

@ -210,13 +210,13 @@ msgid "Are you sure you want to unstage this ammo?"
msgstr "Êtes-vous certain·e de vouloir désélectionner cette munition?" msgstr "Êtes-vous certain·e de vouloir désélectionner cette munition?"
#: lib/cannery_web/live/ammo_group_live/show.ex:137 #: lib/cannery_web/live/ammo_group_live/show.ex:137
#: lib/cannery_web/live/range_live/index.ex:159 #: lib/cannery_web/live/range_live/index.ex:196
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Are you sure you want to delete this shot record?" msgid "Are you sure you want to delete this shot record?"
msgstr "Êtes-vous certain·e de vouloir supprimer cet enregistrement de tir?" msgstr "Êtes-vous certain·e de vouloir supprimer cet enregistrement de tir?"
#: lib/cannery_web/live/ammo_group_live/show.ex:83 #: lib/cannery_web/live/ammo_group_live/show.ex:83
#: lib/cannery_web/live/range_live/index.ex:54 #: lib/cannery_web/live/range_live/index.ex:80
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Shot records deleted succesfully" msgid "Shot records deleted succesfully"
msgstr "Enregistrements de tir supprimés avec succès" msgstr "Enregistrements de tir supprimés avec succès"
@ -273,7 +273,7 @@ msgstr "Langue mise à jour avec succès."
msgid "Ammo deleted succesfully" msgid "Ammo deleted succesfully"
msgstr "Groupe de munition supprimé avec succès" msgstr "Groupe de munition supprimé avec succès"
#: lib/cannery_web/live/range_live/index.ex:68 #: lib/cannery_web/live/range_live/index.ex:95
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "Ammo unstaged succesfully" msgid "Ammo unstaged succesfully"
msgstr "Groupe de munition désélectionner avec succès" msgstr "Groupe de munition désélectionner avec succès"

View File

@ -45,7 +45,7 @@ msgstr ""
#: lib/cannery_web/live/ammo_group_live/index.ex:70 #: lib/cannery_web/live/ammo_group_live/index.ex:70
#: lib/cannery_web/live/ammo_group_live/index.ex:79 #: lib/cannery_web/live/ammo_group_live/index.ex:79
#: lib/cannery_web/live/ammo_group_live/index.html.heex:3 #: lib/cannery_web/live/ammo_group_live/index.html.heex:3
#: lib/cannery_web/live/range_live/index.ex:80 #: lib/cannery_web/live/range_live/index.ex:117
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Ammo" msgid "Ammo"
msgstr "" msgstr ""
@ -312,7 +312,7 @@ msgstr ""
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:49 #: lib/cannery_web/live/ammo_group_live/form_component.html.heex:49
#: lib/cannery_web/live/ammo_group_live/show.ex:93 #: lib/cannery_web/live/ammo_group_live/show.ex:93
#: lib/cannery_web/live/range_live/form_component.html.heex:29 #: lib/cannery_web/live/range_live/form_component.html.heex:29
#: lib/cannery_web/live/range_live/index.ex:82 #: lib/cannery_web/live/range_live/index.ex:119
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Notes" msgid "Notes"
msgstr "" msgstr ""
@ -474,7 +474,7 @@ msgstr ""
#: lib/cannery_web/components/add_shot_group_component.html.heex:45 #: lib/cannery_web/components/add_shot_group_component.html.heex:45
#: lib/cannery_web/live/ammo_group_live/show.ex:94 #: lib/cannery_web/live/ammo_group_live/show.ex:94
#: lib/cannery_web/live/range_live/form_component.html.heex:36 #: lib/cannery_web/live/range_live/form_component.html.heex:36
#: lib/cannery_web/live/range_live/index.ex:83 #: lib/cannery_web/live/range_live/index.ex:120
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Date" msgid "Date"
msgstr "" msgstr ""
@ -496,17 +496,18 @@ msgid "Record shots"
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_group_live/show.ex:42 #: lib/cannery_web/live/ammo_group_live/show.ex:42
#: lib/cannery_web/live/range_live/index.ex:32 #: lib/cannery_web/live/range_live/index.ex:41
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Edit Shot Records" msgid "Edit Shot Records"
msgstr "" msgstr ""
#: lib/cannery_web/live/range_live/index.ex:38 #: lib/cannery_web/live/range_live/index.ex:49
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "New Shot Records" msgid "New Shot Records"
msgstr "" msgstr ""
#: lib/cannery_web/live/range_live/index.html.heex:48 #: lib/cannery_web/live/range_live/index.html.heex:48
#: lib/cannery_web/live/range_live/index.html.heex:90
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "No shots recorded" msgid "No shots recorded"
msgstr "" msgstr ""
@ -518,13 +519,14 @@ msgid "Rounds left"
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_group_live/show.ex:92 #: lib/cannery_web/live/ammo_group_live/show.ex:92
#: lib/cannery_web/live/range_live/index.ex:81 #: lib/cannery_web/live/range_live/index.ex:118
#: lib/cannery_web/live/range_live/index.html.heex:62 #: lib/cannery_web/live/range_live/index.html.heex:62
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Rounds shot" msgid "Rounds shot"
msgstr "" msgstr ""
#: lib/cannery_web/live/range_live/index.ex:44 #: lib/cannery_web/live/range_live/index.ex:57
#: lib/cannery_web/live/range_live/index.ex:67
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Shot Records" msgid "Shot Records"
msgstr "" msgstr ""
@ -716,7 +718,7 @@ msgid "Reset your password"
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_group_live/show.ex:41 #: lib/cannery_web/live/ammo_group_live/show.ex:41
#: lib/cannery_web/live/range_live/index.ex:26 #: lib/cannery_web/live/range_live/index.ex:33
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Record Shots" msgid "Record Shots"
msgstr "" msgstr ""
@ -854,7 +856,7 @@ msgstr ""
msgid "%{percentage}%" msgid "%{percentage}%"
msgstr "" msgstr ""
#: lib/cannery_web/live/range_live/index.ex:114 #: lib/cannery_web/live/range_live/index.ex:151
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "Rounds shot: %{count}" msgid "Rounds shot: %{count}"
msgstr "" msgstr ""
@ -1133,3 +1135,8 @@ msgstr ""
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "Search tags" msgid "Search tags"
msgstr "" msgstr ""
#: lib/cannery_web/live/range_live/index.html.heex:83
#, elixir-autogen, elixir-format
msgid "Search shot records"
msgstr ""

View File

@ -199,13 +199,13 @@ msgid "Are you sure you want to unstage this ammo?"
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_group_live/show.ex:137 #: lib/cannery_web/live/ammo_group_live/show.ex:137
#: lib/cannery_web/live/range_live/index.ex:159 #: lib/cannery_web/live/range_live/index.ex:196
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Are you sure you want to delete this shot record?" msgid "Are you sure you want to delete this shot record?"
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_group_live/show.ex:83 #: lib/cannery_web/live/ammo_group_live/show.ex:83
#: lib/cannery_web/live/range_live/index.ex:54 #: lib/cannery_web/live/range_live/index.ex:80
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Shot records deleted succesfully" msgid "Shot records deleted succesfully"
msgstr "" msgstr ""
@ -262,7 +262,7 @@ msgstr ""
msgid "Ammo deleted succesfully" msgid "Ammo deleted succesfully"
msgstr "" msgstr ""
#: lib/cannery_web/live/range_live/index.ex:68 #: lib/cannery_web/live/range_live/index.ex:95
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Ammo unstaged succesfully" msgid "Ammo unstaged succesfully"
msgstr "" msgstr ""

View File

@ -188,13 +188,13 @@ msgid "Are you sure you want to unstage this ammo?"
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_group_live/show.ex:137 #: lib/cannery_web/live/ammo_group_live/show.ex:137
#: lib/cannery_web/live/range_live/index.ex:159 #: lib/cannery_web/live/range_live/index.ex:196
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Are you sure you want to delete this shot record?" msgid "Are you sure you want to delete this shot record?"
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_group_live/show.ex:83 #: lib/cannery_web/live/ammo_group_live/show.ex:83
#: lib/cannery_web/live/range_live/index.ex:54 #: lib/cannery_web/live/range_live/index.ex:80
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Shot records deleted succesfully" msgid "Shot records deleted succesfully"
msgstr "" msgstr ""
@ -251,7 +251,7 @@ msgstr ""
msgid "Ammo deleted succesfully" msgid "Ammo deleted succesfully"
msgstr "" msgstr ""
#: lib/cannery_web/live/range_live/index.ex:68 #: lib/cannery_web/live/range_live/index.ex:95
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Ammo unstaged succesfully" msgid "Ammo unstaged succesfully"
msgstr "" msgstr ""

View File

@ -38,17 +38,56 @@ defmodule Cannery.ActivityLogTest do
] ]
end end
test "list_shot_groups/0 returns all shot_groups", test "list_shot_groups/1 returns all shot_groups",
%{shot_group: shot_group, current_user: current_user} do %{shot_group: shot_group, current_user: current_user} do
assert ActivityLog.list_shot_groups(current_user) == [shot_group] assert ActivityLog.list_shot_groups(current_user) == [shot_group]
end end
test "get_shot_group!/1 returns the shot_group with given id", test "list_shot_groups/2 returns relevant shot_groups for a user", %{
ammo_type: ammo_type,
ammo_group: ammo_group,
container: container,
current_user: current_user
} do
shot_group_a = shot_group_fixture(%{"notes" => "amazing"}, current_user, ammo_group)
{1, [another_ammo_group]} =
ammo_group_fixture(%{"notes" => "stupendous"}, ammo_type, container, current_user)
shot_group_b = shot_group_fixture(current_user, another_ammo_group)
another_ammo_type = ammo_type_fixture(%{"name" => "fabulous ammo"}, current_user)
{1, [yet_another_ammo_group]} =
ammo_group_fixture(another_ammo_type, container, current_user)
shot_group_c = shot_group_fixture(current_user, yet_another_ammo_group)
random_user = user_fixture()
random_container = container_fixture(random_user)
random_ammo_type = ammo_type_fixture(random_user)
{1, [random_ammo_group]} =
ammo_group_fixture(random_ammo_type, random_container, random_user)
_shouldnt_return = shot_group_fixture(random_user, random_ammo_group)
# notes
assert ActivityLog.list_shot_groups("amazing", current_user) == [shot_group_a]
# ammo group attributes
assert ActivityLog.list_shot_groups("stupendous", current_user) == [shot_group_b]
# ammo type attributes
assert ActivityLog.list_shot_groups("fabulous", current_user) == [shot_group_c]
end
test "get_shot_group!/2 returns the shot_group with given id",
%{shot_group: shot_group, current_user: current_user} do %{shot_group: shot_group, current_user: current_user} do
assert ActivityLog.get_shot_group!(shot_group.id, current_user) == shot_group assert ActivityLog.get_shot_group!(shot_group.id, current_user) == shot_group
end end
test "get_shot_group!/1 does not return a shot_group of another user", test "get_shot_group!/2 does not return a shot_group of another user",
%{shot_group: shot_group} do %{shot_group: shot_group} do
another_user = user_fixture() another_user = user_fixture()
@ -57,7 +96,7 @@ defmodule Cannery.ActivityLogTest do
end end
end end
test "create_shot_group/1 with valid data creates a shot_group", test "create_shot_group/3 with valid data creates a shot_group",
%{current_user: current_user, ammo_group: ammo_group} do %{current_user: current_user, ammo_group: ammo_group} do
valid_attrs = %{"count" => 10, "date" => ~D[2022-02-13], "notes" => "some notes"} valid_attrs = %{"count" => 10, "date" => ~D[2022-02-13], "notes" => "some notes"}
@ -69,7 +108,7 @@ defmodule Cannery.ActivityLogTest do
assert shot_group.notes == "some notes" assert shot_group.notes == "some notes"
end end
test "create_shot_group/1 removes corresponding count from ammo group", test "create_shot_group/3 removes corresponding count from ammo group",
%{ %{
current_user: current_user, current_user: current_user,
ammo_group: %{id: ammo_group_id, count: org_count} = ammo_group ammo_group: %{id: ammo_group_id, count: org_count} = ammo_group
@ -85,7 +124,7 @@ defmodule Cannery.ActivityLogTest do
assert new_count == 10 assert new_count == 10
end end
test "create_shot_group/1 does not remove more than ammo group amount", test "create_shot_group/3 does not remove more than ammo group amount",
%{current_user: current_user, ammo_group: %{id: ammo_group_id} = ammo_group} do %{current_user: current_user, ammo_group: %{id: ammo_group_id} = ammo_group} do
valid_attrs = %{"count" => 20, "date" => ~D[2022-02-13], "notes" => "some notes"} valid_attrs = %{"count" => 20, "date" => ~D[2022-02-13], "notes" => "some notes"}
@ -100,7 +139,7 @@ defmodule Cannery.ActivityLogTest do
ActivityLog.create_shot_group(%{"count" => 1}, current_user, ammo_group) ActivityLog.create_shot_group(%{"count" => 1}, current_user, ammo_group)
end end
test "create_shot_group/1 with invalid data returns error changeset", test "create_shot_group/3 with invalid data returns error changeset",
%{current_user: current_user, ammo_group: ammo_group} do %{current_user: current_user, ammo_group: ammo_group} do
invalid_params = %{"count" => nil, "date" => nil, "notes" => nil} invalid_params = %{"count" => nil, "date" => nil, "notes" => nil}
@ -108,7 +147,7 @@ defmodule Cannery.ActivityLogTest do
ActivityLog.create_shot_group(invalid_params, current_user, ammo_group) ActivityLog.create_shot_group(invalid_params, current_user, ammo_group)
end end
test "update_shot_group/2 with valid data updates the shot_group and ammo_group", test "update_shot_group/3 with valid data updates the shot_group and ammo_group",
%{ %{
shot_group: shot_group, shot_group: shot_group,
ammo_group: %{id: ammo_group_id}, ammo_group: %{id: ammo_group_id},
@ -149,7 +188,7 @@ defmodule Cannery.ActivityLogTest do
assert ammo_group.count == 0 assert ammo_group.count == 0
end end
test "update_shot_group/2 with invalid data returns error changeset", test "update_shot_group/3 with invalid data returns error changeset",
%{shot_group: shot_group, current_user: current_user} do %{shot_group: shot_group, current_user: current_user} do
assert {:error, %Ecto.Changeset{}} = assert {:error, %Ecto.Changeset{}} =
ActivityLog.update_shot_group( ActivityLog.update_shot_group(
@ -168,7 +207,7 @@ defmodule Cannery.ActivityLogTest do
assert shot_group == ActivityLog.get_shot_group!(shot_group.id, current_user) assert shot_group == ActivityLog.get_shot_group!(shot_group.id, current_user)
end end
test "delete_shot_group/1 deletes the shot_group and adds value back", test "delete_shot_group/2 deletes the shot_group and adds value back",
%{shot_group: shot_group, current_user: current_user, ammo_group: %{id: ammo_group_id}} do %{shot_group: shot_group, current_user: current_user, ammo_group: %{id: ammo_group_id}} do
assert {:ok, %ShotGroup{}} = ActivityLog.delete_shot_group(shot_group, current_user) assert {:ok, %ShotGroup{}} = ActivityLog.delete_shot_group(shot_group, current_user)

View File

@ -37,6 +37,32 @@ defmodule CanneryWeb.RangeLiveTest do
assert html =~ shot_group.notes assert html =~ shot_group.notes
end end
test "can search for shot_group", %{conn: conn, shot_group: shot_group} do
{:ok, index_live, html} = live(conn, Routes.range_index_path(conn, :index))
assert html =~ shot_group.notes
assert index_live
|> form("[data-qa=\"shot_group_search\"]",
search: %{search_term: shot_group.notes}
)
|> render_change() =~ shot_group.notes
assert_patch(index_live, Routes.range_index_path(conn, :search, shot_group.notes))
refute index_live
|> form("[data-qa=\"shot_group_search\"]", search: %{search_term: "something_else"})
|> render_change() =~ shot_group.notes
assert_patch(index_live, Routes.range_index_path(conn, :search, "something_else"))
assert index_live
|> form("[data-qa=\"shot_group_search\"]", search: %{search_term: ""})
|> render_change() =~ shot_group.notes
assert_patch(index_live, Routes.range_index_path(conn, :index))
end
test "saves new shot_group", %{conn: conn, ammo_group: ammo_group} do test "saves new shot_group", %{conn: conn, ammo_group: ammo_group} do
{:ok, index_live, _html} = live(conn, Routes.range_index_path(conn, :index)) {:ok, index_live, _html} = live(conn, Routes.range_index_path(conn, :index))