dashboarded added

This commit is contained in:
2026-01-24 13:41:52 +05:30
parent 1dceb640bd
commit 20a5d01f88
19 changed files with 513 additions and 210 deletions

View File

@@ -77,3 +77,34 @@ class TrenchExcavation(db.Model):
def serialize(self):
return {c.name: getattr(self, c.name) for c in self.__table__.columns}
def excavation_category_sums(self):
def safe(val):
return val or 0
return {
"Soft_Murum_Total": (
safe(self.Soft_Murum_0_to_1_5)
+ safe(self.Soft_Murum_1_5_to_3_0)
+ safe(self.Soft_Murum_3_0_to_4_5)
),
"Hard_Murum_Total": (
safe(self.Hard_Murum_0_to_1_5)
+ safe(self.Hard_Murum_1_5_to_3_0)
),
"Soft_Rock_Total": (
safe(self.Soft_Rock_0_to_1_5)
+ safe(self.Soft_Rock_1_5_to_3_0)
),
"Hard_Rock_Total": (
safe(self.Hard_Rock_0_to_1_5)
+ safe(self.Hard_Rock_1_5_to_3_0)
+ safe(self.Hard_Rock_3_0_to_4_5)
+ safe(self.Hard_Rock_4_5_to_6_0)
+ safe(self.Hard_Rock_6_0_to_7_5)
),
}