@@ -298,7 +298,18 @@ def config_subpayment(update, context) -> int:
298298
299299
300300def 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 ()
302313 telegram_id = update .effective_user .id
303314 context .user_data ["sheet_id" ] = db .get_user_sheet_id (telegram_id )
304315 update .message .reply_text (
@@ -812,6 +823,15 @@ def cpf(update, context) -> int:
812823 update .callback_query .message .reply_text (ERROR_TEXT )
813824 return ConversationHandler .END
814825
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 )
815835
816836def setup_handlers (dispatcher ):
817837 # Configuration-related states and handlers
@@ -867,6 +887,7 @@ def setup_handlers(dispatcher):
867887 CommandHandler ("addincome" , add_income ),
868888 CommandHandler ("getdaytransaction" , get_day_transaction ),
869889 CommandHandler ("getoverall" , get_overall ),
890+ CommandHandler ("backlog" , backlog ),
870891 ],
871892 states = {
872893 CS .SET_UP : [MessageHandler (Filters .text & ~ Filters .command , set_up )],
0 commit comments