From 213b36e4de3bae2d53d2e9566f10e1aacde1c4fa Mon Sep 17 00:00:00 2001 From: Kenneth Kehl <@kkehl@flexion.us> Date: Tue, 8 Oct 2024 14:34:12 -0700 Subject: [PATCH] fix another --- app/dao/services_dao.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app/dao/services_dao.py b/app/dao/services_dao.py index 1d558be1f..22c0e8395 100644 --- a/app/dao/services_dao.py +++ b/app/dao/services_dao.py @@ -71,11 +71,11 @@ def get_services_by_partial_name(service_name): def dao_count_live_services(): - return Service.query.filter_by( - active=True, - restricted=False, - count_as_live=True, - ).count() + stmt = select(Service).where( + Service.active, Service.count_as_live, Service.restricted is False + ) + result = db.session.execute(stmt) + return result.scalars().count() def dao_fetch_live_services_data(): @@ -228,11 +228,11 @@ def dao_fetch_all_services_by_user(user_id, only_active=False): def dao_fetch_all_services_created_by_user(user_id): - query = Service.query.filter_by(created_by_id=user_id).order_by( - asc(Service.created_at) + stmt = ( + select(Service).where(created_by_id=user_id).order_by(asc(Service.created_at)) ) - - return query.all() + result = db.session.execute(stmt) + return result.scalars.all() @autocommit