feat: weight taste tags by playtime
CI / test (push) Successful in 5m49s

This commit is contained in:
strsv committed 2026-11-06 20:50:19 +03:00
1 parent 88c4beabcd
commit 419bd12dec
8 files changed
+57 -24

No files matched your search

+16 -1
View File
@@ -150,6 +150,7 @@ class RecommendTests(RecoFixture):
def test_taste_boost_from_rating(self):
self.con.execute("UPDATE personal SET rating = NULL WHERE appid = 4")
self.con.execute("UPDATE game_playtime SET minutes = 0 WHERE appid = 4")
self.con.commit()
_, base = reco.recommend(self.con, self.mood(), limit=10)
base_alpha = next(g for g in base if g["appid"] == 1)
@@ -159,7 +160,21 @@ class RecommendTests(RecoFixture):
_, boosted = reco.recommend(self.con, self.mood(), limit=10)
alpha = next(g for g in boosted if g["appid"] == 1)
self.assertGreater(alpha["score"], base_alpha["score"])
self.assertIn("Похоже на избранное и высокие оценки", alpha["reasons"])
self.assertIn("Похоже на ваш вкус", alpha["reasons"])
def test_taste_boost_from_hours(self):
self.con.execute("UPDATE personal SET rating = NULL, favorite = 0 WHERE appid = 4")
self.con.execute("UPDATE game_playtime SET minutes = 0 WHERE appid = 4")
self.con.commit()
_, base = reco.recommend(self.con, self.mood(), limit=10)
base_alpha = next(g for g in base if g["appid"] == 1)
self.con.execute("UPDATE game_playtime SET minutes = 600 WHERE appid = 4")
self.con.commit()
_, boosted = reco.recommend(self.con, self.mood(), limit=10)
alpha = next(g for g in boosted if g["appid"] == 1)
self.assertGreater(alpha["score"], base_alpha["score"])
self.assertIn("Похоже на ваш вкус", alpha["reasons"])
def test_feedback_excludes_and_boosts(self):
key = "preset:test"