feat: exclude completed games from recommendations
Skip played and ignore statuses by default; add an include-played toggle to the API, CLI and UI for replay suggestions.
This commit is contained in:
1 parent
6a1b3aadfc
commit
2f5791d1a3
11 files changed
+40
-10
No files matched your search
+14
-3
@@ -138,7 +138,9 @@ class TasteProfileTests(RecoFixture):
|
||||
self._add_context_tags()
|
||||
_, solo = reco.recommend(self.con, self.mood(), taste_profile="solo", limit=10)
|
||||
self.assertEqual(set(self.names(solo)), {"Alpha", "Beta"})
|
||||
_, coop = reco.recommend(self.con, self.mood(), taste_profile="coop", limit=10)
|
||||
_, coop = reco.recommend(
|
||||
self.con, self.mood(), taste_profile="coop", limit=10,
|
||||
allowed_statuses={"backlog", "playing", "played"})
|
||||
self.assertEqual(set(self.names(coop)), {"Gamma", "Delta"})
|
||||
|
||||
def test_unknown_profile(self):
|
||||
@@ -151,7 +153,8 @@ class RecommendTests(RecoFixture):
|
||||
_, results = reco.recommend(self.con, self.mood(), limit=10)
|
||||
names = self.names(results)
|
||||
self.assertEqual(names[0], "Alpha")
|
||||
self.assertEqual(set(names), {"Alpha", "Beta", "Gamma", "Delta", "NoTags"})
|
||||
self.assertEqual(set(names), {"Alpha", "Beta", "Gamma", "NoTags"})
|
||||
self.assertNotIn("Delta", names)
|
||||
self.assertNotIn("Ignored", names)
|
||||
self.assertNotIn("Unknown", names)
|
||||
self.assertNotIn("Tool", names)
|
||||
@@ -163,6 +166,12 @@ class RecommendTests(RecoFixture):
|
||||
self.assertTrue(any(reason.startswith("Теги:") for reason in alpha["reasons"]))
|
||||
self.assertIn("Ещё не запускали", alpha["reasons"])
|
||||
|
||||
def test_include_played(self):
|
||||
_, results = reco.recommend(
|
||||
self.con, self.mood(), limit=10,
|
||||
allowed_statuses={"backlog", "playing", "played"})
|
||||
self.assertIn("Delta", self.names(results))
|
||||
|
||||
def test_unplayed_only(self):
|
||||
_, results = reco.recommend(self.con, self.mood(), unplayed_only=True)
|
||||
self.assertEqual(set(self.names(results)), {"Alpha", "Beta", "Gamma", "NoTags"})
|
||||
@@ -260,7 +269,9 @@ class RecommendTests(RecoFixture):
|
||||
self.con.execute("UPDATE game_playtime SET last_played = ? WHERE appid = 4",
|
||||
(date.today().isoformat(),))
|
||||
self.con.commit()
|
||||
_, results = reco.recommend(self.con, self.mood(), limit=10)
|
||||
_, results = reco.recommend(
|
||||
self.con, self.mood(), limit=10,
|
||||
allowed_statuses={"backlog", "playing", "played"})
|
||||
delta = next(g for g in results if g["appid"] == 4)
|
||||
self.assertIn("Уже пройдена", delta["reasons"])
|
||||
|
||||
|
||||
Reference in new issue
Block a user