postgres related error fixed in filter_ann
This commit is contained in:
parent
761f48c56f
commit
a60ff39c43
@ -52,6 +52,8 @@ async def filter_ann(schema: pydantic_schemas.SortAnnouncements, db: AsyncSessio
|
|||||||
# res = await db.execute(statement)
|
# res = await db.execute(statement)
|
||||||
# если фильтр задан
|
# если фильтр задан
|
||||||
if filt_val is not None:
|
if filt_val is not None:
|
||||||
|
if name == "obsolete":
|
||||||
|
filt_val = bool(filt_val)
|
||||||
filter_query = await db.execute(select(orm_models.Announcement).where(literal_column(f"announcements.{name}") == filt_val))
|
filter_query = await db.execute(select(orm_models.Announcement).where(literal_column(f"announcements.{name}") == filt_val))
|
||||||
filtered = set(filter_query.scalars().all())
|
filtered = set(filter_query.scalars().all())
|
||||||
res = res.intersection(filtered)
|
res = res.intersection(filtered)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user