Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -894,25 +894,17 @@ def handle_calculation():
|
|
894 |
# 3. Извлекаем дополнительные параметры
|
895 |
liters = profile_settings.get("liters", 100) # Объем раствора (литры)
|
896 |
rounding_precision = profile_settings.get("rounding_precision", 3) # Точность округления
|
897 |
-
activation_cacl = profile_settings.get("activation_cacl", 0) # Активация CaCl
|
898 |
-
enhancement_cacl = profile_settings.get("enhancement_cacl", 0) # Усиление CaCl
|
899 |
|
900 |
-
# 4.
|
901 |
-
if "Кальций хлорид" not in fertilizer_constants:
|
902 |
-
fertilizer_constants["Кальций хлорид"] = {"Ca": 0.18294, "Cl": 0.32366}
|
903 |
-
|
904 |
-
# 5. Создаем и запускаем калькулятор
|
905 |
calculator = NutrientCalculator(
|
906 |
fertilizer_constants=fertilizer_constants,
|
907 |
profile_settings=profile_settings,
|
908 |
liters=liters,
|
909 |
-
rounding_precision=rounding_precision
|
910 |
-
activation_cacl=activation_cacl,
|
911 |
-
enhancement_cacl=enhancement_cacl
|
912 |
)
|
913 |
results = calculator.calculate()
|
914 |
|
915 |
-
#
|
916 |
element_contributions = {}
|
917 |
for fert_name in calculator.fertilizers.keys():
|
918 |
grams = calculator.results[fert_name]['граммы']
|
@@ -921,7 +913,7 @@ def handle_calculation():
|
|
921 |
added_ppm = (grams * percent * 1000) / calculator.volume
|
922 |
element_contributions[fert_name][element] = round(added_ppm, rounding_precision)
|
923 |
|
924 |
-
#
|
925 |
response = {
|
926 |
"fertilizers": results['fertilizers'],
|
927 |
"actual_profile": results['actual_profile'],
|
|
|
894 |
# 3. Извлекаем дополнительные параметры
|
895 |
liters = profile_settings.get("liters", 100) # Объем раствора (литры)
|
896 |
rounding_precision = profile_settings.get("rounding_precision", 3) # Точность округления
|
|
|
|
|
897 |
|
898 |
+
# 4. Создаем и запускаем калькулятор
|
|
|
|
|
|
|
|
|
899 |
calculator = NutrientCalculator(
|
900 |
fertilizer_constants=fertilizer_constants,
|
901 |
profile_settings=profile_settings,
|
902 |
liters=liters,
|
903 |
+
rounding_precision=rounding_precision
|
|
|
|
|
904 |
)
|
905 |
results = calculator.calculate()
|
906 |
|
907 |
+
# 5. Формируем дополнительные данные
|
908 |
element_contributions = {}
|
909 |
for fert_name in calculator.fertilizers.keys():
|
910 |
grams = calculator.results[fert_name]['граммы']
|
|
|
913 |
added_ppm = (grams * percent * 1000) / calculator.volume
|
914 |
element_contributions[fert_name][element] = round(added_ppm, rounding_precision)
|
915 |
|
916 |
+
# 6. Формируем полный ответ
|
917 |
response = {
|
918 |
"fertilizers": results['fertilizers'],
|
919 |
"actual_profile": results['actual_profile'],
|