diff --git a/lib/microwaveprop/radio.ex b/lib/microwaveprop/radio.ex index 58f120f8..68517d55 100644 --- a/lib/microwaveprop/radio.ex +++ b/lib/microwaveprop/radio.ex @@ -129,8 +129,9 @@ defmodule Microwaveprop.Radio do end @doc """ - Returns all contacts where the given callsign appears as either - `station1` or `station2`, newest first. Matching is case-insensitive. + Returns the 100 most recent contacts where the given callsign appears + as either `station1` or `station2`, newest first. Matching is + case-insensitive. """ @spec list_contacts_involving_callsign(String.t() | nil) :: [Contact.t()] def list_contacts_involving_callsign(callsign) when callsign in [nil, ""], do: [] @@ -141,6 +142,7 @@ defmodule Microwaveprop.Radio do Contact |> where([c], fragment("upper(?)", c.station1) == ^upcased or fragment("upper(?)", c.station2) == ^upcased) |> order_by([c], desc: c.qso_timestamp, desc: c.id) + |> limit(100) |> Repo.all() end diff --git a/lib/microwaveprop_web/live/user_profile_live.ex b/lib/microwaveprop_web/live/user_profile_live.ex index b7913c44..7be5f13c 100644 --- a/lib/microwaveprop_web/live/user_profile_live.ex +++ b/lib/microwaveprop_web/live/user_profile_live.ex @@ -159,6 +159,9 @@ defmodule MicrowavepropWeb.UserProfileLive do <%= if @involving == [] do %>
No contacts on file with this callsign yet.
<% else %> ++ Showing the 100 most recent contacts. +