diff --git a/brewman/brewman/routers/incentive.py b/brewman/brewman/routers/incentive.py index f28f9836..10e2c6ce 100644 --- a/brewman/brewman/routers/incentive.py +++ b/brewman/brewman/routers/incentive.py @@ -221,10 +221,13 @@ def get_employees( db: Session, ) -> List[schema_in.IncentiveEmployee]: details = [] - employees = db.execute( - select(Employee) - .where(Employee.joining_date <= finish_date, or_(Employee.is_active, Employee.leaving_date >= start_date)) - .order_by(Employee.cost_centre_id, Employee.designation, Employee.name) + employees = ( + db.execute( + select(Employee) + .where(Employee.joining_date <= finish_date, or_(Employee.is_active, Employee.leaving_date >= start_date)) + .order_by(Employee.cost_centre_id, Employee.designation, Employee.name) + ) + .scalars() .all() )