DmitrMakeev commited on
Commit
ae24f7a
·
verified ·
1 Parent(s): 33829c8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +45 -8
app.py CHANGED
@@ -872,7 +872,7 @@ class NutrientCalculator:
872
  print(f"Ошибка при выводе отчёта: {str(e)}")
873
  raise
874
 
875
- # ... (весь ваш существующий код без изменений)
876
 
877
  def get_web_results(self):
878
  """Возвращает данные в формате для web-интерфейса"""
@@ -902,13 +902,6 @@ class NutrientCalculator:
902
  for k, v in self.actual_profile.items()]
903
 
904
 
905
-
906
-
907
-
908
-
909
-
910
-
911
-
912
  if __name__ == "__main__":
913
  try:
914
  calculator = NutrientCalculator(volume_liters=VOLUME_LITERS)
@@ -916,6 +909,50 @@ if __name__ == "__main__":
916
  calculator.print_report() # Правильный вызов метода класса
917
  except Exception as e:
918
  print(f"Критическая ошибка: {str(e)}")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
919
 
920
 
921
  if __name__ == '__main__':
 
872
  print(f"Ошибка при выводе отчёта: {str(e)}")
873
  raise
874
 
875
+ # Данные на страницу
876
 
877
  def get_web_results(self):
878
  """Возвращает данные в формате для web-интерфейса"""
 
902
  for k, v in self.actual_profile.items()]
903
 
904
 
 
 
 
 
 
 
 
905
  if __name__ == "__main__":
906
  try:
907
  calculator = NutrientCalculator(volume_liters=VOLUME_LITERS)
 
909
  calculator.print_report() # Правильный вызов метода класса
910
  except Exception as e:
911
  print(f"Критическая ошибка: {str(e)}")
912
+
913
+
914
+
915
+
916
+
917
+
918
+
919
+
920
+ @app.route('/calculation', methods=['POST'])
921
+ def handle_calculation():
922
+ data = request.json
923
+ calculator = NutrientCalculator(
924
+ fertilizer_constants=data['fertilizerConstants'],
925
+ profile_settings=data['profileSettings']
926
+ )
927
+ calculator.calculate()
928
+ return jsonify(calculator.get_web_results())
929
+
930
+
931
+
932
+
933
+
934
+
935
+
936
+
937
+
938
+
939
+
940
+
941
+
942
+
943
+
944
+
945
+
946
+
947
+
948
+
949
+
950
+
951
+
952
+
953
+
954
+
955
+
956
 
957
 
958
  if __name__ == '__main__':