This commit is contained in:
2026-05-09 16:55:06 +03:30
parent 1679825ae2
commit cead7dafe2
51 changed files with 7514 additions and 1221 deletions
+3 -3
View File
@@ -3,7 +3,7 @@ from datetime import date
def load_farm_context(sensor_id: str) -> dict | None:
from irrigation.models import IrrigationMethod
from location_data.models import SoilDepthData
from location_data.satellite_snapshot import build_location_block_satellite_snapshots
from farm_data.models import SensorData
from farm_data.services import get_farm_plant_snapshots
from weather.models import WeatherForecast
@@ -16,7 +16,7 @@ def load_farm_context(sensor_id: str) -> dict | None:
return None
location = sensor.center_location
depths = list(SoilDepthData.objects.filter(soil_location=location).order_by("depth_label"))
satellite_snapshots = build_location_block_satellite_snapshots(location)
forecasts = list(
WeatherForecast.objects.filter(location=location, forecast_date__gte=date.today()).order_by("forecast_date")[:7]
)
@@ -26,7 +26,7 @@ def load_farm_context(sensor_id: str) -> dict | None:
return {
"sensor": sensor,
"location": location,
"depths": depths,
"satellite_snapshots": satellite_snapshots,
"forecasts": forecasts,
"history": [],
"plants": plants,