Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion bot/google_sheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,10 @@ def get_trackers(sheet_id):
.execute()
)
values = result.get("values", [])
return values[0]
if values:
return values[0]
else:
return


def update_rows(sheet_id, day, new_row, first_row):
Expand Down
31 changes: 29 additions & 2 deletions bot/telegram_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,35 @@ def set_up(update, context) -> int:
current_datetime = dt.datetime.now(timezone)
day = current_datetime.day
month = current_datetime.strftime("%b")
gs.update_rows(sheet_id, day, 4, 5) # New users start from row 5
gs.create_date(sheet_id, day, month, 5)

# get tracker data to check if got input
trackers = gs.get_trackers(sheet_id)
if trackers: # If got input
day_tracker = int(trackers[0])
first_row = int(trackers[3])
if day_tracker == day:
pass
elif day_tracker < day:
prev_month = (current_datetime - dt.timedelta(days=1)).strftime(
"%b"
)
gs.update_prev_day(sheet_id, prev_month, first_row)
new_row = gs.get_new_row(sheet_id, month)
first_row = new_row + 1
gs.update_rows(sheet_id, day, new_row, first_row)
gs.create_date(sheet_id, day, month, first_row)
elif day == 1:
new_row = 4
first_row = 5
gs.update_rows(sheet_id, day, new_row, first_row)
gs.create_date(sheet_id, day, month, first_row)
else: # New sheet
new_row = 4
first_row = 5
gs.update_rows(
sheet_id, day, new_row, first_row
) # New users start from row 5
gs.create_date(sheet_id, day, month, first_row)
update.message.reply_text(SUCCESS_LINK_TEXT)
return ConversationHandler.END
except Exception as e:
Expand Down
117 changes: 59 additions & 58 deletions release_notes.md
Original file line number Diff line number Diff line change
@@ -1,55 +1,34 @@
# Release Notes

## Version 1.0.0 - Date: 20 May 2023
- Initial Launch

## Version 1.1.0 - Date: 21 May 2023
### New Features 🆕
- Back button
- Added help command

### Bug Fixes 🛠️
- Remove 'Transport' category from others
- Fixed others and transport row tracker
- Fixed first row tracker

### Enhancement 🔥
- Refactor file structure

## Version 1.2.0 - Date: 24 May 2023
### New Features 🆕 (Planned deployment: 27 May 2023)
- Retrieve past transaction with /retrievetransaction command
- Add income with /addincome command

### Enhancement 🔥
- Increase number of options for add others

## Version 2.0.0 - Date 28 May 2023
### Enhancement 🔥
- Cloud hosting w Flask & Vercel 🎉
- Move string to text_str.py
## Version 2.1.5 - Date 30 July 2023
### Bug Fix 🛠️
- Added tracker check when adding google sheet to prevent resetting of (existing) tracker

## Version 2.1.4 - Date 16 July 2023
### Bug Fix 🛠️
- Allow negative price entry
- Added end conversation handler for get day transaction

### To note ❗
- Remove sql functions
- python-telegram-bot library changed to 13.7
- Move services account to environment variable
- Please read the new README for developer
## Version 2.1.3 - Date 16 July 2023
### Enhancement 🔥
- Allows user to add multiple settings for quick transport
- If there is only one settings, that will be used as default (/addtransport only)
- Revamp Google Sheet with new looks

## Version 2.0.1 - Date 1 Jun 2023
### Bug Fix 🛠️
- Fix month abbreviation
- Fix updating of previous month
- Skip empty cells for payment & category

### For Developer 🧑‍💻
- Added a new updates.py file to push updates to all users
- To run updates, call functions in push_updates.py
- Remove firebase codes

## Version 2.0.2 - Date 1 Jun 2023
## Version 2.1.2 - Date 26 Jun 2023
### Bug Fix 🛠️
- Day 1 sum creation bug
- When new users join, new date entry was not created
- Quick add settings not sending proper error message when either transport or others has been configured

## Version 2.1.1 - Date 8 Jun 2023
### Enhancement 🔥
- Migrate to use firestore
- Reformatted get overall transaction

## Version 2.1.0 - Date 1 Jun 2023
### New Features 🆕
Expand All @@ -61,31 +40,53 @@
### For Developer 🧑‍💻
- When you run test.py, ngrok will auto setup with the correct webhook!

## Version 2.0.2 - Date 1 Jun 2023
### Bug Fix 🛠️
- Day 1 sum creation bug

## Version 2.1.1 - Date 8 Jun 2023
## Version 2.0.1 - Date 1 Jun 2023
### Bug Fix 🛠️
- Fix month abbreviation
- Fix updating of previous month

### For Developer 🧑‍💻
- Added a new updates.py file to push updates to all users
- To run updates, call functions in push_updates.py

## Version 2.0.0 - Date 28 May 2023
### Enhancement 🔥
- Migrate to use firestore
- Reformatted get overall transaction
- Cloud hosting w Flask & Vercel 🎉
- Move string to text_str.py

## Version 2.1.2 - Date 26 Jun 2023
### Bug Fix 🛠️
- When new users join, new date entry was not created
- Quick add settings not sending proper error message when either transport or others has been configured
- Allow negative price entry

### To note ❗
- Remove sql functions
- python-telegram-bot library changed to 13.7
- Move services account to environment variable
- Please read the new README for developer

## Version 1.2.0 - Date: 24 May 2023
### New Features 🆕 (Planned deployment: 27 May 2023)
- Retrieve past transaction with /retrievetransaction command
- Add income with /addincome command

## Version 2.1.3 - Date 16 July 2023
### Enhancement 🔥
- Allows user to add multiple settings for quick transport
- If there is only one settings, that will be used as default (/addtransport only)
- Revamp Google Sheet with new looks
- Increase number of options for add others

### Bug Fix 🛠️
- Skip empty cells for payment & category
## Version 1.1.0 - Date: 21 May 2023
### New Features 🆕
- Back button
- Added help command

### For Developer 🧑‍💻
- Remove firebase codes
### Bug Fixes 🛠️
- Remove 'Transport' category from others
- Fixed others and transport row tracker
- Fixed first row tracker

### Enhancement 🔥
- Refactor file structure

## Version 2.1.4 - Date 16 July 2023
### Bug Fix 🛠️
- Added end conversation handler for get day transaction
## Version 1.0.0 - Date: 20 May 2023
- Initial Launch
3 changes: 3 additions & 0 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,7 @@ def index():
if __name__ == "__main__":
public_url = ngrok.connect(5000, "http").public_url
updater.bot.set_webhook(url=f"{public_url}/webhook")
print("#" * 50)
print(f"# Bot is running at @{updater.bot.get_me().username} #")
print("#" * 50)
app.run(host="0.0.0.0", port=int(os.environ.get("PORT", 5000)))