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") |             await update.message.reply_text("Please enter the date in the format DDMMYYYY") | ||||||
|             return DATE_ENTRY |             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: |             with self.models.db: | ||||||
|                 self.current_model = self.models.JournalEntry.get_or_none( |                 self.current_model = self.models.JournalEntry.get_or_none( | ||||||
|                     date = date |                     date = date | ||||||
| @@ -105,6 +105,7 @@ class JournalHandler(BaseHandler): | |||||||
|                 return DELETE_ENTRY |                 return DELETE_ENTRY | ||||||
|             else: |             else: | ||||||
|                 await update.message.reply_text("No entry found for this date") |                 await update.message.reply_text("No entry found for this date") | ||||||
|  |                 context.chat_data["delete"] = False | ||||||
|                 return ConversationHandler.END |                 return ConversationHandler.END | ||||||
|         else: |         else: | ||||||
|             with self.models.db: |             with self.models.db: | ||||||
| @@ -154,5 +155,6 @@ class JournalHandler(BaseHandler): | |||||||
|     async def delete_entry(self, update, context): |     async def delete_entry(self, update, context): | ||||||
|         with self.models.db: |         with self.models.db: | ||||||
|             self.current_model.delete_instance() |             self.current_model.delete_instance() | ||||||
|  |         context.chat_data["delete"] = False | ||||||
|         await update.callback_query.edit_message_text(text="Entry deleted ✅") |         await update.callback_query.edit_message_text(text="Entry deleted ✅") | ||||||
|         return ConversationHandler.END |         return ConversationHandler.END | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user