comaparison code optimization and cal sum/total mh dc and laying
This commit is contained in:
@@ -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)
|
||||
),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user