cleanup the model layout
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:
@@ -1,15 +1,14 @@
|
||||
import os
|
||||
from telegram.ext import ConversationHandler, CommandHandler, MessageHandler, filters, CallbackQueryHandler, CallbackContext
|
||||
from telegram import InlineKeyboardButton, InlineKeyboardMarkup, Update, InputMediaPhoto
|
||||
# ACTION_CHOICE, DATE_ENTRY, ADD_CONTENT = range(3)
|
||||
import models
|
||||
MEMORY_CHOICE = range(1)
|
||||
|
||||
|
||||
from .basehandler import BaseHandler
|
||||
|
||||
class MemoryHandler(BaseHandler):
|
||||
def __init__(self, entry_string, models):
|
||||
self.models = models
|
||||
def __init__(self, entry_string):
|
||||
self.entry_string = entry_string
|
||||
self.handler = ConversationHandler(
|
||||
entry_points=[CommandHandler(entry_string, self.entry_point, )],
|
||||
@@ -34,13 +33,13 @@ class MemoryHandler(BaseHandler):
|
||||
search_string = " ".join(context.args)
|
||||
|
||||
if search_string == '~photo':
|
||||
matching_models = self.models.JournalEntry.select().where(self.models.JournalEntry.media_path != "").order_by(self.models.JournalEntry.date)
|
||||
matching_models = models.JournalEntry.select().where(models.JournalEntry.media_path != "").order_by(models.JournalEntry.date)
|
||||
else: # searching for text
|
||||
matching_models = self.models.JournalEntry.select().where(
|
||||
self.models.JournalEntry.text.contains(
|
||||
matching_models = models.JournalEntry.select().where(
|
||||
models.JournalEntry.text.contains(
|
||||
search_string
|
||||
)
|
||||
).order_by(self.models.JournalEntry.date)
|
||||
).order_by(models.JournalEntry.date)
|
||||
|
||||
|
||||
# exit if no memory matches the string
|
||||
|
Reference in New Issue
Block a user