postgres related error fixed in filter_ann

This commit is contained in:
DmitryGantimurov 2023-09-12 21:29:55 +03:00
parent 761f48c56f
commit a60ff39c43

View File

@ -52,6 +52,8 @@ async def filter_ann(schema: pydantic_schemas.SortAnnouncements, db: AsyncSessio
# res = await db.execute(statement)
# если фильтр задан
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))
filtered = set(filter_query.scalars().all())
res = res.intersection(filtered)