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:
parent
bc6fbbe3de
commit
521aeea3c5
1 changed files with 15 additions and 2 deletions
|
|
@ -62,8 +62,21 @@ defmodule AprsmeWeb.MapLive.PacketUtils do
|
||||||
@spec has_weather_packets?(String.t()) :: boolean()
|
@spec has_weather_packets?(String.t()) :: boolean()
|
||||||
# Get recent packets for this callsign and check if any are weather packets
|
# Get recent packets for this callsign and check if any are weather packets
|
||||||
def has_weather_packets?(callsign) when is_binary(callsign) do
|
def has_weather_packets?(callsign) when is_binary(callsign) do
|
||||||
# Use cached query for better performance
|
# Direct query without caching
|
||||||
Aprsme.CachedQueries.has_weather_packets_cached?(callsign)
|
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
|
rescue
|
||||||
_ -> false
|
_ -> false
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue