Conversation
- get_irrigation_data now takes optional chat_id - use job ids to simplify code - minor coding style - remove unused functions - use databases instead of PyMySQL
1. translated all comments from russian into english. 2. Deleted No water button. 3. Changed buttons name to Start Irrigation and Irrigation finished also in message handlers. 4. In get_irrigation_data function in SQL script add new measurement_device as device (in Sites table in fieldproperties column we need to add measurement_device parameter).
1. Added conditions for control and treatment plots with three type of devices 2. Added new save_irrigation_data function (in some places i used this function just to check.) 3. new message handler waiting_for_water_level_control was added 4. Also other message handlers was amended (according to Boris flow that he sent)
fixed save_irrigation_data, check_irrigation function
added function send_message_safe put logging in all steps changed check_irrigation function and get_irrigation_data function
1. Remove the “Select action” message after the /start command 2. Add 0 value in WATER_FLOW_RATES dictionary 3. added a reset of the user_irrigation_data at the beginning of a new irrigation session Line:403
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
Changed /start command text into "The bot has started successfully." #40 issue on Git
in line: 640 msg was edited according to issue #45 on Git
line 516 structured as was required: 'type': 'control', 'device': 'thomson_profile',
New logic was added in start function. Complete clearing of irrigation data with the /start command.
case PHIc > PHIt was moved to check_irrigation function
NA was changed by NULL
round minutes removed None and NULL conditions
Before we converted minutes to hour as float, and then back to hours + minutes in 3 different places. Now we calculate hours + minutes once in the beginning.
Simplify get_irrigation_data: - Consider it's an error when no irigiation data is found (send message to user) - Return None instead of False when there is an error Review calls to get_irrigation_data
Removed finally block that incorrectly reset user state on every execution. State now resets only on successful completion or critical exceptions. Maintains state for logical errors (end <= start) for correct re-entry (in waiting_for_counter_end handler) Also in irrigation_finished handler removed (else condition) in control and treatment type with incremental_meter device
Removed waiting_for_traditional_start and waiting_for_traditional_end handlers
add condition to check for negative numbers in start_irrigation
add conditions in treatment and control types for incremental_meter device if user push Irrigation finished button instead Start irrigation button
changed condition in L396 (set it to if remaining_time >= 0)
In Start irrigation and Irrigation finished handlers for device = incremental_meter for control and treatment types condition was added in one
Also for total_meter device conditions for control and treatment was changed into one
In the beginning for control type with thomson_profile device save message was different then others. Now insert changes and now all save messages are the same
Add condition for negative check numbers in handle_actual_data function.
L:466 return was missed. Now fixed
changed to 24 * 60
The basic idea is to get the data once at the top level and pass it down the call stack, instead of requesting it again each time in save_irrigation data. Callbacks also was changed.
And don't send cryptic message to the user on error
check for 'type' was removed for "incremental_meter" device and also for "total_meter" device was removed check for "type" in handle_recommendation function.
Additional conditions were removed in L702 and L709
Fixed handle_actual_data function. Moved user_states[chat_id]=None after save_irrigation_data. Now even when you type wrong number bot will wait until you type correct number
Removed 'Enough water, stop irrigation' message in handle_water_level function. Now we get only one message when irrigation time is finished
…ed translation files for Uzbekistan
Removed send_recommendation function and also removed else condition where it was calling to this function
changed int type into float type where we requesting users to send counter number
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Merging botreview with main. Main changes in bot.py file