UPDATE
This commit is contained in:
@@ -10,6 +10,7 @@ import logging
|
||||
from django.core.paginator import EmptyPage, Paginator
|
||||
|
||||
from farm_data.models import SensorData
|
||||
from farm_data.services import get_canonical_farm_record, get_runtime_plant_for_farm
|
||||
from plant.gdd import calculate_daily_gdd, resolve_growth_profile
|
||||
from weather.models import WeatherForecast
|
||||
|
||||
@@ -775,14 +776,10 @@ class CurrentFarmChartSimulator:
|
||||
|
||||
resolved_plant_name = plant_name
|
||||
if not resolved_plant_name:
|
||||
sensor = (
|
||||
SensorData.objects.prefetch_related("plants")
|
||||
.filter(farm_uuid=farm_uuid)
|
||||
.first()
|
||||
)
|
||||
sensor = get_canonical_farm_record(farm_uuid)
|
||||
if sensor is None:
|
||||
raise GrowthSimulationError("مزرعه پیدا نشد.")
|
||||
plant = sensor.plants.first()
|
||||
plant = get_runtime_plant_for_farm(sensor)
|
||||
if plant is None:
|
||||
raise GrowthSimulationError("گیاهی برای مزرعه انتخاب شده پیدا نشد.")
|
||||
resolved_plant_name = plant.name
|
||||
|
||||
Reference in New Issue
Block a user