fix: calendar bounds and habit stats query
ci / docker (push) Successful in 4m36s

This commit is contained in:
2026-09-05 20:08:52 +08:00
parent 2987a787d3
commit 2e7c572af2
5 changed files with 72 additions and 26 deletions
+33
View File
@@ -64,6 +64,39 @@ def test_recurring_calendar_exceptions_and_scopes(client):
assert any(row.get("id") == normal_task["id"] for row in remaining)
def test_calendar_respects_timezone_boundaries_and_moved_occurrences(client):
inbox = boot(client)
inside = client.post(
"/api/v1/tasks",
json={"title": "上海九月第一刻", "list_id": inbox["id"], "due_at": "2026-08-31T16:30:00Z"},
).json()
client.post(
"/api/v1/tasks",
json={"title": "上海十月第一刻", "list_id": inbox["id"], "due_at": "2026-09-30T16:30:00Z"},
)
recurring = client.post(
"/api/v1/tasks",
json={"title": "跨月重复任务", "list_id": inbox["id"], "due_at": "2026-10-01T09:00:00Z"},
).json()
recurrence = client.post(
"/api/v1/recurrences", json={"task_id": recurring["id"], "rrule": "FREQ=WEEKLY;COUNT=2"}
).json()
client.patch(
f"/api/v1/recurrences/{recurrence['id']}",
params={"scope": "this", "occurrence_at": "2026-10-01T09:00:00Z"},
json={"due_at": "2026-09-20T09:00:00Z"},
)
calendar = client.get(
"/api/v1/calendar",
params={"start": "2026-09-01", "end": "2026-09-30", "timezone_offset": 480},
).json()
assert any(row.get("id") == inside["id"] for row in calendar)
assert not any(row["title"] == "上海十月第一刻" for row in calendar)
assert any(row.get("recurrence_id") == recurrence["id"] and row["due_at"].startswith("2026-09-20") for row in calendar)
def test_habit_logs_support_date_range_filter(client):
boot(client)
habit = client.post("/api/v1/habits", json={"name": "跑步", "kind": "boolean", "schedule_type": "daily"}).json()