Fixed the search result to allow full year/month/day specification.

This commit is contained in:
依瑪貓 2023-04-09 21:03:18 +08:00
parent b19a6e5ffe
commit 650c26036a

View File

@ -151,6 +151,17 @@ class LineItemCollector:
== journal_entry_date.day)) == journal_entry_date.day))
except ValueError: except ValueError:
pass pass
try:
journal_entry_date = datetime.strptime(k, "%Y/%m/%d")
conditions.append(sa.and_(
sa.extract("year", JournalEntry.date)
== journal_entry_date.year,
sa.extract("month", JournalEntry.date)
== journal_entry_date.month,
sa.extract("day", JournalEntry.date)
== journal_entry_date.day))
except ValueError:
pass
return sa.select(JournalEntry.id).filter(sa.or_(*conditions)) return sa.select(JournalEntry.id).filter(sa.or_(*conditions))