This commit is contained in:
2026-04-06 23:50:24 +03:30
parent a67236d45c
commit ff464cb4a5
140 changed files with 2061 additions and 2702 deletions
+14 -11
View File
@@ -3,7 +3,7 @@ from django.db import models
class SoilLocation(models.Model):
"""
مختصات جغرافیایی برای داده‌های خاک.
مرکز زمین برای داده‌های خاک و مزرعه.
هر مختصات سه سطر در SoilDepthData دارد (۰–۵، ۵–۱۵، ۱۵–۳۰ سانتی‌متر).
"""
@@ -11,27 +11,20 @@ class SoilLocation(models.Model):
max_digits=9,
decimal_places=6,
db_index=True,
help_text="عرض جغرافیایی (lat)",
help_text="عرض جغرافیایی مرکز زمین (lat)",
)
longitude = models.DecimalField(
max_digits=9,
decimal_places=6,
db_index=True,
help_text="طول جغرافیایی (lon)",
help_text="طول جغرافیایی مرکز زمین (lon)",
)
task_id = models.CharField(
max_length=255,
blank=True,
help_text="شناسه تسک Celery در حال پردازش",
)
ideal_sensor_profile = models.JSONField(
default=dict,
blank=True,
help_text=(
"پروفایل ایده‌آل سنسورها برای این مزرعه/لوکیشن. "
'نمونه: {"moisture": {"ideal": 0.65, "min": 0.50, "max": 0.80}}'
),
)
farm_boundary = models.JSONField(
default=dict,
blank=True,
@@ -51,10 +44,20 @@ class SoilLocation(models.Model):
)
]
ordering = ["-updated_at"]
verbose_name = "مرکز زمین"
verbose_name_plural = "مراکز زمین"
def __str__(self):
return f"SoilLocation({self.latitude}, {self.longitude})"
@property
def center_latitude(self):
return self.latitude
@property
def center_longitude(self):
return self.longitude
@property
def is_complete(self):
"""آیا هر سه عمق ذخیره شده‌اند؟"""