DmitrMakeev commited on
Commit
91bee01
·
verified ·
1 Parent(s): b13c927

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -3
app.py CHANGED
@@ -966,12 +966,24 @@ class NutrientCalculator:
966
  try:
967
  actual_composition = Composition('Actual Profile', list(self.actual_profile.values()))
968
  report = actual_composition.table(sparse=True, ref=self.target_composition)
969
- return report
 
 
 
 
 
 
 
 
 
 
 
 
 
 
970
  except Exception as e:
971
  print(f"Ошибка при выводе отчёта: {str(e)}")
972
  raise
973
-
974
-
975
  if __name__ == "__main__":
976
  try:
977
  calculator = NutrientCalculator(volume_liters=VOLUME_LITERS)
 
966
  try:
967
  actual_composition = Composition('Actual Profile', list(self.actual_profile.values()))
968
  report = actual_composition.table(sparse=True, ref=self.target_composition)
969
+
970
+ # Добавляем анализ дефицита элементов
971
+ deficit_report = "\n\nАнализ дефицита элементов:\n"
972
+ for nutrient in nutrients_stencil:
973
+ actual_value = self.actual_profile[nutrient]
974
+ target_value = self.target_profile[nutrient]
975
+ deficit = target_value - actual_value
976
+ if deficit > 0:
977
+ deficit_report += f" - Элемент {nutrient}: не хватает {deficit:.2f} ppm\n"
978
+ elif deficit < 0:
979
+ deficit_report += f" - Элемент {nutrient}: избыток {-deficit:.2f} ppm\n"
980
+ else:
981
+ deficit_report += f" - Элемент {nutrient}: точное совпадение\n"
982
+
983
+ return report + deficit_report
984
  except Exception as e:
985
  print(f"Ошибка при выводе отчёта: {str(e)}")
986
  raise
 
 
987
  if __name__ == "__main__":
988
  try:
989
  calculator = NutrientCalculator(volume_liters=VOLUME_LITERS)