Delete functionality not implemented correctly
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				continuous-integration/drone/push Build is passing
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	continuous-integration/drone/push Build is passing
				
			This commit is contained in:
		| @@ -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 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user