@@ -411,6 +411,11 @@ def category(update, context) -> int:
411
411
update .callback_query .edit_message_text (
412
412
f"Category type: { reply } " , reply_markup = None
413
413
)
414
+ payment_list = get_payment_text (sheet_id )
415
+ update .callback_query .message .reply_text (
416
+ DEFAULT_PAYMENT_TEXT ,
417
+ reply_markup = create_inline_markup (payment_list ),
418
+ )
414
419
return CS .PAYMENT
415
420
except Exception as e :
416
421
update .callback_query .reply_text (ERROR_TEXT )
@@ -457,6 +462,14 @@ def payment(update, context) -> int:
457
462
DEFAULT_PAYMENT_TEXT , reply_markup = create_inline_markup (sub_markup_list )
458
463
)
459
464
return CS .SUBPAYMENT
465
+ # This won't be called as there will always be a subpayment, but just in case
466
+ else :
467
+ update .callback_query .edit_message_text (
468
+ f'Payment type: { context .user_data ["payment" ]} ' , reply_markup = None
469
+ )
470
+ log_transaction (context .user_data , update )
471
+ update .callback_query .message .reply_text ("Transaction logged." )
472
+ return ConversationHandler .END
460
473
except Exception as e :
461
474
update .callback_query .message .reply_text (ERROR_TEXT )
462
475
return ConversationHandler .END
@@ -514,12 +527,13 @@ def log_transaction(user_data, update):
514
527
if day_tracker != day :
515
528
msg = f"New entry for { day } { month } "
516
529
prev_month = month
517
- if day == 1 :
530
+ # this should fix the bug regarding if first day of month not keyed in, but not tested
531
+ if day == 1 | day < day_tracker :
518
532
prev_month = (current_datetime - dt .timedelta (days = 1 )).strftime ("%b" )
519
533
# update prev day
520
534
msg = f"{ msg } \n Creating sum for day { day_tracker } "
521
535
gs .update_prev_day (sheet_id , prev_month , first_row )
522
- if day == 1 :
536
+ if day == 1 | day < day_tracker :
523
537
new_row = 4
524
538
first_row = 5
525
539
gs .update_rows (sheet_id , 1 , new_row , first_row )
0 commit comments