parent
dec12b5576
commit
390ae57747
@ -96,7 +96,7 @@ class JournalHandler(BaseHandler):
|
||||
await update.message.reply_text("Please enter the date in the format DDMMYYYY")
|
||||
return DATE_ENTRY
|
||||
|
||||
if context.chat_data.get("delete", True):
|
||||
if context.chat_data.get("delete", False): # if not set, delete was not chosen
|
||||
with self.models.db:
|
||||
self.current_model = self.models.JournalEntry.get_or_none(
|
||||
date = date
|
||||
@ -105,6 +105,7 @@ class JournalHandler(BaseHandler):
|
||||
return DELETE_ENTRY
|
||||
else:
|
||||
await update.message.reply_text("No entry found for this date")
|
||||
context.chat_data["delete"] = False
|
||||
return ConversationHandler.END
|
||||
else:
|
||||
with self.models.db:
|
||||
@ -154,5 +155,6 @@ class JournalHandler(BaseHandler):
|
||||
async def delete_entry(self, update, context):
|
||||
with self.models.db:
|
||||
self.current_model.delete_instance()
|
||||
context.chat_data["delete"] = False
|
||||
await update.callback_query.edit_message_text(text="Entry deleted ✅")
|
||||
return ConversationHandler.END
|
||||
|
Loading…
x
Reference in New Issue
Block a user