fix: projects page shows all-time data, not just last 30 days

When /api/dashboard/projects is called without date params (as the
Projects page does), remove the date filter so all 36 projects appear
regardless of last activity date. Explicit date params still filter
as before (dashboard summary tab).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Vadym Samoilenko 2026-04-24 11:57:07 +01:00
parent 474e35c0ea
commit 2eee1a7c02

View file

@ -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()