diff --git a/src/routers/dashboard.py b/src/routers/dashboard.py index 5147b7f..43aa3fe 100644 --- a/src/routers/dashboard.py +++ b/src/routers/dashboard.py @@ -101,15 +101,17 @@ async def projects_overview( to_date: date | None = Query(default=None, alias="to"), db: AsyncSession = Depends(get_db), ): - from_date, to_date = _date_range(from_date, to_date) + date_clauses = [] + if from_date is not None or to_date is not None: + from_date, to_date = _date_range(from_date, to_date) + date_clauses = [DailyStat.date >= from_date, DailyStat.date <= to_date] result = await db.execute( select(DailyStat, Project) .join(Project, DailyStat.project_id == Project.id) .where( DailyStat.user_id == user.id, - DailyStat.date >= from_date, - DailyStat.date <= to_date, + *date_clauses, ) ) rows = result.all()