@@ -298,7 +298,18 @@ def config_subpayment(update, context) -> int:
298
298
299
299
300
300
def add_entry (update , context ):
301
- context .user_data .clear ()
301
+ print (context .user_data )
302
+ if context .user_data .get ("backlog" ):
303
+ reply = update .callback_query .data
304
+ if utils .check_date_format (reply ):
305
+ day , month = reply .split (" " )
306
+ else :
307
+ update .callback_query .message .reply_text (
308
+ BACKLOG_DATE_TEXT
309
+ )
310
+ return add_entry (update , context )
311
+ else :
312
+ context .user_data .clear ()
302
313
telegram_id = update .effective_user .id
303
314
context .user_data ["sheet_id" ] = db .get_user_sheet_id (telegram_id )
304
315
update .message .reply_text (
@@ -812,6 +823,15 @@ def cpf(update, context) -> int:
812
823
update .callback_query .message .reply_text (ERROR_TEXT )
813
824
return ConversationHandler .END
814
825
826
+ def backlog (update , context ) -> int :
827
+ context .user_data .clear ()
828
+ telegram_id = update .effective_user .id
829
+ context .user_data ["sheet_id" ] = db .get_user_sheet_id (telegram_id )
830
+ update .message .reply_text (
831
+ BACKLOG_DATE_TEXT
832
+ )
833
+ context .user_data ["backlog" ] = True
834
+ return add_entry (update , context )
815
835
816
836
def setup_handlers (dispatcher ):
817
837
# Configuration-related states and handlers
@@ -867,6 +887,7 @@ def setup_handlers(dispatcher):
867
887
CommandHandler ("addincome" , add_income ),
868
888
CommandHandler ("getdaytransaction" , get_day_transaction ),
869
889
CommandHandler ("getoverall" , get_overall ),
890
+ CommandHandler ("backlog" , backlog ),
870
891
],
871
892
states = {
872
893
CS .SET_UP : [MessageHandler (Filters .text & ~ Filters .command , set_up )],
0 commit comments