UPDATE
This commit is contained in:
+13
-2
@@ -354,7 +354,13 @@ class WaterStressView(APIView):
|
||||
examples=[
|
||||
OpenApiExample(
|
||||
"نمونه درخواست water stress",
|
||||
value={"farm_uuid": "11111111-1111-1111-1111-111111111111"},
|
||||
value={
|
||||
"farm_uuid": "11111111-1111-1111-1111-111111111111",
|
||||
"irrigation_recommendation": {"events": [{"date": "2026-04-25", "amount": 2.5}]},
|
||||
"fertilization_recommendation": {
|
||||
"events": [{"date": "2026-04-20", "N_amount": 45, "N_recovery": 0.7}]
|
||||
},
|
||||
},
|
||||
request_only=True,
|
||||
)
|
||||
],
|
||||
@@ -368,7 +374,12 @@ class WaterStressView(APIView):
|
||||
)
|
||||
service = apps.get_app_config("irrigation").get_water_stress_service()
|
||||
try:
|
||||
data = service.get_water_stress(farm_uuid=serializer.validated_data["farm_uuid"])
|
||||
data = service.get_water_stress(
|
||||
farm_uuid=serializer.validated_data["farm_uuid"],
|
||||
plant_name=serializer.validated_data.get("plant_name"),
|
||||
irrigation_recommendation=serializer.validated_data.get("irrigation_recommendation"),
|
||||
fertilization_recommendation=serializer.validated_data.get("fertilization_recommendation"),
|
||||
)
|
||||
except ValueError as exc:
|
||||
return Response(
|
||||
{"code": 404, "msg": str(exc), "data": None},
|
||||
|
||||
Reference in New Issue
Block a user