feat(web): add fan date range modes and delta column

This commit is contained in:
kairee committed 2026-11-01 02:36:48 +08:00
1 parent 998d0fd0c0
commit 274eccba93
6 files changed
+253 -22

No files matched your search

+20
View File
@@ -110,6 +110,26 @@ def test_readonly_routes_and_static():
point["stat_date"] >= "2026-10-18"
for point in fans["recent_points"]
)
assert all("delta" in point for point in fans["recent_points"])
status, _, payload = running.request(
"/api/fans?start=2026-10-29&end=2026-10-31"
)
assert status == 200
data = json.loads(payload)["data"]
assert data["mode"] == "daily"
assert data["dates"] == ["2026-10-29", "2026-10-30", "2026-10-31"]
running.db.write(lambda conn: conn.execute(
"INSERT OR REPLACE INTO up_stat"
"(stat_date, mid, follower, following, captured_at, ok) "
"VALUES ('2025-01-01', 37754047, 500, NULL, 1, 1)"
))
status, _, payload = running.request(
"/api/fans?start=2025-01-01&end=2026-10-31"
)
assert status == 200
assert json.loads(payload)["data"]["mode"] == "monthly"
status, headers, payload = running.request("/api/videos", method="HEAD")
assert status == 200 and payload == b""