V 1.5.6 fix: tatsächliche Uhrzeit von Min/Max in der Statistikzeile
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+25
-4
@@ -408,19 +408,26 @@ async def get_daily_aggregated_data(
|
||||
"""Gibt täglich aggregierte Wetterdaten zurück (Tagesmittel mit Min/Max-Temperaturen)"""
|
||||
with conn.cursor() as cursor:
|
||||
cursor.execute("""
|
||||
SELECT
|
||||
SELECT
|
||||
date_trunc('day', datetime) as datetime,
|
||||
AVG(temperature)::float as temperature,
|
||||
MIN(temperature)::float as min_temperature,
|
||||
MAX(temperature)::float as max_temperature,
|
||||
(array_agg(datetime ORDER BY temperature ASC NULLS LAST))[1] as min_temperature_time,
|
||||
(array_agg(datetime ORDER BY temperature DESC NULLS LAST))[1] as max_temperature_time,
|
||||
ROUND(AVG(humidity))::int as humidity,
|
||||
MIN(humidity)::int as min_humidity,
|
||||
MAX(humidity)::int as max_humidity,
|
||||
(array_agg(datetime ORDER BY humidity ASC NULLS LAST))[1] as min_humidity_time,
|
||||
(array_agg(datetime ORDER BY humidity DESC NULLS LAST))[1] as max_humidity_time,
|
||||
AVG(pressure)::float as pressure,
|
||||
MIN(pressure)::float as min_pressure,
|
||||
MAX(pressure)::float as max_pressure,
|
||||
(array_agg(datetime ORDER BY pressure ASC NULLS LAST))[1] as min_pressure_time,
|
||||
(array_agg(datetime ORDER BY pressure DESC NULLS LAST))[1] as max_pressure_time,
|
||||
AVG(wind_speed * 1.60934)::float as wind_speed,
|
||||
MAX(wind_gust * 1.60934)::float as wind_gust,
|
||||
(array_agg(datetime ORDER BY wind_gust DESC NULLS LAST))[1] as max_wind_gust_time,
|
||||
AVG(wind_dir)::float as wind_dir,
|
||||
SUM(rain)::float as total_rain
|
||||
FROM weather_data
|
||||
@@ -441,19 +448,26 @@ async def get_daily_with_minmax_data(
|
||||
"""Gibt täglich aggregierte Wetterdaten mit Min/Max-Temperaturen zurück"""
|
||||
with conn.cursor() as cursor:
|
||||
cursor.execute("""
|
||||
SELECT
|
||||
SELECT
|
||||
date_trunc('day', datetime) as datetime,
|
||||
AVG(temperature)::float as temperature,
|
||||
MIN(temperature)::float as min_temperature,
|
||||
MAX(temperature)::float as max_temperature,
|
||||
(array_agg(datetime ORDER BY temperature ASC NULLS LAST))[1] as min_temperature_time,
|
||||
(array_agg(datetime ORDER BY temperature DESC NULLS LAST))[1] as max_temperature_time,
|
||||
ROUND(AVG(humidity))::int as humidity,
|
||||
MIN(humidity)::int as min_humidity,
|
||||
MAX(humidity)::int as max_humidity,
|
||||
(array_agg(datetime ORDER BY humidity ASC NULLS LAST))[1] as min_humidity_time,
|
||||
(array_agg(datetime ORDER BY humidity DESC NULLS LAST))[1] as max_humidity_time,
|
||||
AVG(pressure)::float as pressure,
|
||||
MIN(pressure)::float as min_pressure,
|
||||
MAX(pressure)::float as max_pressure,
|
||||
(array_agg(datetime ORDER BY pressure ASC NULLS LAST))[1] as min_pressure_time,
|
||||
(array_agg(datetime ORDER BY pressure DESC NULLS LAST))[1] as max_pressure_time,
|
||||
AVG(wind_speed * 1.60934)::float as wind_speed,
|
||||
MAX(wind_gust * 1.60934)::float as wind_gust,
|
||||
(array_agg(datetime ORDER BY wind_gust DESC NULLS LAST))[1] as max_wind_gust_time,
|
||||
AVG(wind_dir)::float as wind_dir,
|
||||
SUM(rain)::float as total_rain
|
||||
FROM weather_data
|
||||
@@ -462,7 +476,7 @@ async def get_daily_with_minmax_data(
|
||||
ORDER BY datetime ASC
|
||||
""", (days,))
|
||||
results = cursor.fetchall()
|
||||
|
||||
|
||||
return [dict(row) for row in results]
|
||||
|
||||
|
||||
@@ -561,19 +575,26 @@ async def get_daily_aggregated_range(
|
||||
|
||||
with conn.cursor() as cursor:
|
||||
cursor.execute("""
|
||||
SELECT
|
||||
SELECT
|
||||
date_trunc('day', datetime) as datetime,
|
||||
AVG(temperature)::float as temperature,
|
||||
MIN(temperature)::float as min_temperature,
|
||||
MAX(temperature)::float as max_temperature,
|
||||
(array_agg(datetime ORDER BY temperature ASC NULLS LAST))[1] as min_temperature_time,
|
||||
(array_agg(datetime ORDER BY temperature DESC NULLS LAST))[1] as max_temperature_time,
|
||||
ROUND(AVG(humidity))::int as humidity,
|
||||
MIN(humidity)::int as min_humidity,
|
||||
MAX(humidity)::int as max_humidity,
|
||||
(array_agg(datetime ORDER BY humidity ASC NULLS LAST))[1] as min_humidity_time,
|
||||
(array_agg(datetime ORDER BY humidity DESC NULLS LAST))[1] as max_humidity_time,
|
||||
AVG(pressure)::float as pressure,
|
||||
MIN(pressure)::float as min_pressure,
|
||||
MAX(pressure)::float as max_pressure,
|
||||
(array_agg(datetime ORDER BY pressure ASC NULLS LAST))[1] as min_pressure_time,
|
||||
(array_agg(datetime ORDER BY pressure DESC NULLS LAST))[1] as max_pressure_time,
|
||||
AVG(wind_speed * 1.60934)::float as wind_speed,
|
||||
MAX(wind_gust * 1.60934)::float as wind_gust,
|
||||
(array_agg(datetime ORDER BY wind_gust DESC NULLS LAST))[1] as max_wind_gust_time,
|
||||
AVG(wind_dir)::float as wind_dir,
|
||||
SUM(rain)::float as total_rain
|
||||
FROM weather_data
|
||||
|
||||
Reference in New Issue
Block a user