fix(insights): correct ngettext usage in auto-match flash

ngettext is a macro that already calls dngettext internally. The
previous code was calling dngettext a second time on the result string,
passing nil as the count — causing a FunctionClauseError.
This commit is contained in:
Graham McIntire 2026-05-11 15:07:39 -05:00
parent 3267bb134f
commit 31231d9fad

View file

@ -68,18 +68,14 @@ defmodule ToweropsWeb.Org.GaiiaReconciliationLive do
defp match_flash({:ok, ip_matched, site_matched, remaining}) do
total = ip_matched + site_matched
"Auto-matched %{total} device (%{ip} by IP, %{site} by site). %{remaining} remaining."
|> ngettext(
ngettext(
"Auto-matched %{total} device (%{ip} by IP, %{site} by site). %{remaining} remaining.",
"Auto-matched %{total} devices (%{ip} by IP, %{site} by site). %{remaining} remaining.",
total
)
|> then(
&Gettext.dngettext(ToweropsWeb.Gettext, "", &1, &1,
total: total,
ip: ip_matched,
site: site_matched,
remaining: remaining
)
total,
total: total,
ip: ip_matched,
site: site_matched,
remaining: remaining
)
end