Remove caching from has_weather_packets function

Remove Cachex caching from the has_weather_packets function to ensure
real-time data display. The function now queries the database directly
for weather packet information.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Graham McIntire 2025-07-28 15:52:53 -05:00
parent bc6fbbe3de
commit 521aeea3c5
No known key found for this signature in database

View file

@ -62,8 +62,21 @@ defmodule AprsmeWeb.MapLive.PacketUtils do
@spec has_weather_packets?(String.t()) :: boolean()
# Get recent packets for this callsign and check if any are weather packets
def has_weather_packets?(callsign) when is_binary(callsign) do
# Use cached query for better performance
Aprsme.CachedQueries.has_weather_packets_cached?(callsign)
# Direct query without caching
import Ecto.Query
query =
from p in Aprsme.Packet,
where: p.sender == ^callsign,
where:
not is_nil(p.temperature) or not is_nil(p.humidity) or not is_nil(p.pressure) or
not is_nil(p.wind_direction) or not is_nil(p.wind_speed) or not is_nil(p.wind_gust) or
not is_nil(p.rain_1h) or not is_nil(p.rain_24h) or not is_nil(p.rain_midnight) or
not is_nil(p.luminosity) or not is_nil(p.snow_24h),
select: fragment("1"),
limit: 1
Aprsme.Repo.exists?(query)
rescue
_ -> false
end