From 075309be37de7b230cc455b49e68707c32dd6239 Mon Sep 17 00:00:00 2001 From: wayangalihpratama Date: Tue, 8 Oct 2024 13:05:22 +0800 Subject: [PATCH] [#197] Fix school_information and query --- backend/db/crud_data.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/db/crud_data.py b/backend/db/crud_data.py index a1cbc3d..af6dbe3 100644 --- a/backend/db/crud_data.py +++ b/backend/db/crud_data.py @@ -238,7 +238,7 @@ def get_data_by_school( session: Session, schools: List[str], year_conducted: Optional[int] = None ): data = session.query(Data) - and_query = and_(Data.school_information.contains([v]) for v in schools) + and_query = and_(Data.school_information == schools) data = data.filter(and_query) if year_conducted: data = data.filter(Data.year_conducted == year_conducted) @@ -249,7 +249,7 @@ def get_history_data_by_school( session: Session, schools: List[str], year_conducted: Optional[int] = None ): data = session.query(Data) - and_query = and_(Data.school_information.contains([v]) for v in schools) + and_query = and_(Data.school_information == schools) data = data.filter(and_query).filter(Data.current == false()) if year_conducted: data = data.filter(Data.year_conducted < year_conducted)