test: make activity index deterministic

This commit is contained in:
ik
2026-09-03 18:20:55 +07:00
parent 121225971d
commit c3ddd71f59
5 changed files with 187 additions and 16 deletions
+3 -1
View File
@@ -18,8 +18,9 @@ def activity_rows(
waterbody: str | None = None,
fish: str | None = None,
method: str | None = None,
now: datetime | None = None,
) -> list[ActivityOut]:
now = datetime.now(timezone.utc)
now = _aware(now or datetime.now(timezone.utc))
query = (
select(CatchReport)
.options(
@@ -28,6 +29,7 @@ def activity_rows(
)
.where(
CatchReport.moderation_status == ModerationStatus.approved,
CatchReport.deleted_at.is_(None),
CatchReport.spot_id.is_not(None),
CatchReport.reported_at >= now - timedelta(hours=hours),
)