feat: add activity heatmap by day
Aggregate last-played dates via GET /api/activity and render a calendar heatmap with a year selector in the library view.
This commit is contained in:
1 parent
54a7b36aae
commit
4566066f2b
10 files changed
+171
-1
No files matched your search
@@ -487,6 +487,17 @@ class ApiTests(unittest.TestCase):
|
||||
finally:
|
||||
con.close()
|
||||
|
||||
def test_activity_heatmap(self):
|
||||
data = self.get("/api/activity?year=2026")
|
||||
self.assertEqual(data["year"], "2026")
|
||||
self.assertIn("2026", data["years"])
|
||||
day = next(item for item in data["days"] if item["date"] == "2026-01-01")
|
||||
self.assertEqual(day["games"], 1)
|
||||
self.assertEqual(day["hours"], 2.0)
|
||||
self.assertGreaterEqual(data["max_games"], 1)
|
||||
self.assertEqual(self.get("/api/activity?year=20", expect=400)["error"],
|
||||
"invalid year")
|
||||
|
||||
def test_recommend_taste_profile(self):
|
||||
data = self.post("/api/recommend", {
|
||||
"preset": "dark-fantasy", "limit": 5, "taste_profile": "solo"})
|
||||
|
||||
Reference in new issue
Block a user