fix geolocate error

This commit is contained in:
Graham McIntire 2025-06-21 21:27:29 -05:00
parent e0b89c2c19
commit 318970ff9e
No known key found for this signature in database

View file

@ -3,7 +3,7 @@ defmodule AprsWeb.PacketsLive.CallsignView do
LiveView for displaying packets specific to a single callsign. LiveView for displaying packets specific to a single callsign.
Shows up to 100 packets total (stored + live) for the specified callsign. Shows up to 100 packets total (stored + live) for the specified callsign.
Includes both stored packets from the database (last hour) and live incoming packets. Includes both stored packets from the database and live incoming packets.
""" """
use AprsWeb, :live_view use AprsWeb, :live_view
@ -92,14 +92,11 @@ defmodule AprsWeb.PacketsLive.CallsignView do
# Private helper functions # Private helper functions
# Get recent packets for this callsign from the database (all packets, not just position) # Get recent packets for this callsign from the database (all packets, not just position)
# Returns packets from the last hour, filtered by callsign # Returns the latest packets regardless of age, filtered by callsign
defp get_stored_packets(callsign, limit) do defp get_stored_packets(callsign, limit) do
one_hour_ago = DateTime.add(DateTime.utc_now(), -3600, :second)
# Create query for all packets (not just position packets) for this callsign # Create query for all packets (not just position packets) for this callsign
query = query =
from p in Packet, from p in Packet,
where: p.received_at >= ^one_hour_ago,
order_by: [desc: p.received_at], order_by: [desc: p.received_at],
limit: ^limit limit: ^limit