actually wal is reuqired?
	
		
			
	
		
	
	
		
	
		
			Some checks reported errors
		
		
	
	
		
			
				
	
				continuous-integration/drone/push Build was killed
				
			
		
		
	
	
				
					
				
			
		
			Some checks reported errors
		
		
	
	continuous-integration/drone/push Build was killed
				
			This commit is contained in:
		| @@ -70,6 +70,11 @@ class JournalHandler(BaseHandler): | |||||||
|         date = update.message.text |         date = update.message.text | ||||||
|         try: |         try: | ||||||
|             date = datetime.datetime.strptime(date, "%d%m%Y").date() |             date = datetime.datetime.strptime(date, "%d%m%Y").date() | ||||||
|  |         except ValueError: | ||||||
|  |             await update.message.reply_text("Please enter the date in the format DDMMYYYY") | ||||||
|  |             return DATE_ENTRY | ||||||
|  |         self.logger.info(f"Date: {date}") | ||||||
|  |          | ||||||
|         with self.models.db: |         with self.models.db: | ||||||
|             self.current_model, new = self.models.JournalEntry.get_or_create( |             self.current_model, new = self.models.JournalEntry.get_or_create( | ||||||
|                 date = date |                 date = date | ||||||
| @@ -77,15 +82,13 @@ class JournalHandler(BaseHandler): | |||||||
|         if not new: |         if not new: | ||||||
|             await update.message.reply_text("An entry already exists for this date") |             await update.message.reply_text("An entry already exists for this date") | ||||||
|             return ConversationHandler.END |             return ConversationHandler.END | ||||||
|         except ValueError: |         else: | ||||||
|             await update.message.reply_text("Please enter the date in the format DDMMYYYY") |  | ||||||
|             return DATE_ENTRY |  | ||||||
|  |  | ||||||
|             await update.message.reply_text("Please enter the content for the entry") |             await update.message.reply_text("Please enter the content for the entry") | ||||||
|             return CONTENT |             return CONTENT | ||||||
|  |  | ||||||
|  |  | ||||||
|     async def content_save(self, update, context): |     async def content_save(self, update, context): | ||||||
|  |         with self.models.db: | ||||||
|             self.current_model.author_id = update.message.from_user.id |             self.current_model.author_id = update.message.from_user.id | ||||||
|  |  | ||||||
|             if update.message.text: |             if update.message.text: | ||||||
| @@ -103,5 +106,6 @@ class JournalHandler(BaseHandler): | |||||||
|                 self.current_model.text = update.message.caption |                 self.current_model.text = update.message.caption | ||||||
|              |              | ||||||
|             self.current_model.save() |             self.current_model.save() | ||||||
|  |  | ||||||
|         await update.message.reply_text(f"Saved entry for {self.current_model.date.strftime('%A, %-d. %B %Y')}") |         await update.message.reply_text(f"Saved entry for {self.current_model.date.strftime('%A, %-d. %B %Y')}") | ||||||
|         return ConversationHandler.END |         return ConversationHandler.END | ||||||
|   | |||||||
| @@ -25,6 +25,6 @@ class ListModel(BaseModel): | |||||||
|  |  | ||||||
|  |  | ||||||
| def set_db(db_path): | def set_db(db_path): | ||||||
|     db.initialize(SqliteDatabase(db_path)) |     db.initialize(SqliteDatabase(db_path, pragmas={'journal_mode': 'wal'})) | ||||||
|     db.connect() |     db.connect() | ||||||
|     db.create_tables([ListModel], safe=True) |     db.create_tables([ListModel], safe=True) | ||||||
|   | |||||||
| @@ -54,6 +54,6 @@ class JournalEntry(BaseModel): | |||||||
|  |  | ||||||
|  |  | ||||||
| def set_db(db_path): | def set_db(db_path): | ||||||
|     db.initialize(SqliteDatabase(db_path)) |     db.initialize(SqliteDatabase(db_path, pragmas={'journal_mode': 'wal'})) | ||||||
|     db.connect() |     db.connect() | ||||||
|     db.create_tables([JournalEntry], safe=True) |     db.create_tables([JournalEntry], safe=True) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user