You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
added new conditions
1. if irrigation_app is not None and irrigation_app != 'NA'
2. if (phic is not None and phit is not None and phic >= phit and irrigation_need != 'NA'
3. if row get_irrigation_data is none
_("❌ I am sorry, you have already registered your irrigation. Please contact support.")
177
+
)
178
+
returnFalse# here bot exits
179
+
except (ValueError, TypeError):
180
+
pass
181
+
182
+
if (phicisnotNoneandphitisnotNoneandphic>=phitandirrigation_need!='NA'and
183
+
f"no_irrigation_msg_{chat_id}"notinuser_states):
184
+
awaitsend_message_safe(
185
+
chat_id,
186
+
_("🌤 Your plot does not require irrigation today. If you want to irrigate nevertheless, press 'Start irrigation'. Otherwise simply come back tomorrow.")
187
+
)
188
+
user_states[f"no_irrigation_msg_{chat_id}"] =True# Помечаем как отправленное
189
+
190
+
# IMPORTANT: DO NOT return, continue working!
191
+
# The message is just informative, the bot continues to work
192
+
pass
193
+
returnrow
162
194
exceptExceptionase:
163
195
print(f"Database error for chat_id {chat_id}: {str(e)}")
print(f"[DEBUG] check_irrigation: row = {row}, type = {type(row)}")
264
+
265
+
ifrowisFalse:
266
+
return# The error has already been processed in get_irrigation_data
267
+
268
+
269
+
ifisinstance(row, bool):
270
+
ifrowisTrue:
271
+
# If True is returned, it means "no irrigation required"
272
+
returnTrue# Just finishing
273
+
else:
274
+
returnFalse# Error
231
275
232
276
# Handling a special case where irrigation is not required
233
277
ifrowisNone:
234
278
awaitsend_message_safe(
235
279
chat_id,
236
-
_("🌤 Your plot does not require irrigation today. If you want to irrigate nevertheless, press ‘Start irrigation’. Otherwise simply come back tomorrow.")
280
+
_("🌤 I am sorry, I have a technical problem and cannot provide you with a recommendation. Please contact support. Otherwise simply come back tomorrow.")
237
281
)
238
282
returnTrue
239
283
240
-
# Error handling (when False is returned)
241
-
ifrowisFalse:
242
-
returnFalse
243
-
284
+
# # Error handling (when False is returned)
285
+
# if row is False:
286
+
# return False
244
287
245
288
ifnotrowor'type'notinrowor'device'notinrow:
246
289
print(f"[ERROR] Invalid row data for chat_id: {chat_id}")
247
-
awaitsend_message_safe(chat_id, "❌ Your data was not found in the system. Please check if you have registered correctly and filled in all required fields. If the problem persists, please contact support.")
290
+
awaitsend_message_safe(chat_id,
291
+
"❌ Your data was not found in the system. Please check if you have registered correctly and filled in all required fields. If the problem persists, please contact support.")
print(f"[ERROR] Missing required fields in row data for chat_id: {chat_id}")
256
-
awaitsend_message_safe(chat_id, "❌ Configuration error: required data is missing. Please check your profile and fill in all required fields or contact support.")
300
+
awaitsend_message_safe(chat_id,
301
+
"❌ Configuration error: required data is missing. Please check your profile and fill in all required fields or contact support.")
0 commit comments