Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -945,10 +945,12 @@ def handle_calculation():
|
|
| 945 |
'N (NH4+)': 0.0
|
| 946 |
}
|
| 947 |
|
| 948 |
-
|
| 949 |
-
|
| 950 |
-
|
|
|
|
| 951 |
|
|
|
|
| 952 |
total_parts = no3_ratio + nh4_ratio
|
| 953 |
calculator.target_profile['N (NO3-)'] = total_n * (no3_ratio / total_parts)
|
| 954 |
calculator.target_profile['N (NH4+)'] = total_n * (nh4_ratio / total_parts)
|
|
@@ -988,7 +990,6 @@ def handle_calculation():
|
|
| 988 |
|
| 989 |
|
| 990 |
|
| 991 |
-
|
| 992 |
|
| 993 |
|
| 994 |
if __name__ == '__main__':
|
|
|
|
| 945 |
'N (NH4+)': 0.0
|
| 946 |
}
|
| 947 |
|
| 948 |
+
# Извлечение значений для азотов
|
| 949 |
+
total_n = float(data['profileSettings'].get('TOTAL_NITROG', 125.0))
|
| 950 |
+
no3_ratio = float(data['profileSettings'].get('NO3_RAT', 8.25)) # Берем значение из запроса
|
| 951 |
+
nh4_ratio = 1.0 # Фиксированное значение для NH4
|
| 952 |
|
| 953 |
+
# Расчет соотношения азотов
|
| 954 |
total_parts = no3_ratio + nh4_ratio
|
| 955 |
calculator.target_profile['N (NO3-)'] = total_n * (no3_ratio / total_parts)
|
| 956 |
calculator.target_profile['N (NH4+)'] = total_n * (nh4_ratio / total_parts)
|
|
|
|
| 990 |
|
| 991 |
|
| 992 |
|
|
|
|
| 993 |
|
| 994 |
|
| 995 |
if __name__ == '__main__':
|