diff --git a/CHANGELOG.md b/CHANGELOG.md index fea5c07..a6a1983 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -140,6 +140,9 @@ по дням с выбором года и подсказками. - Рекомендации учитывают последние запуски и завершённость: бонус недавним `playing`/`backlog`, штраф `played`, причины «Недавно играли»/«Уже пройдена». +- `played` и `ignore` больше не попадают в рекомендации по умолчанию; вернуть + пройденные можно флажком «учитывать пройденные» / `include_played` / + `--include-played`. - Сортировка таблицы по жанру и избранному; опции в селекторе сортировки. - Демо-скриншоты текущего UI в README. diff --git a/docs/HANDOFF.md b/docs/HANDOFF.md index cae3990..4ab189e 100644 --- a/docs/HANDOFF.md +++ b/docs/HANDOFF.md @@ -97,6 +97,8 @@ «недавно играли/запускали», «уже пройдена». - Рекомендации учитывают `last_played` и завершённость: бонус недавним `playing`/`backlog`, штраф `played`. +- `played` и `ignore` исключены из рекомендаций по умолчанию; пройденные можно + вернуть флажком/`include_played`/`--include-played`. - Разнообразие выдачи: штраф за одну серию и сильное пересечение тегов. - Избранное и оценки 8+/10 дают бонус похожим по тегам играм. - Оценка длительности (`estimated_hours`) по жанрам/тегам; фильтр `duration` и сортировка. @@ -302,6 +304,7 @@ Invoke-RestMethod http://127.0.0.1:8765/api/meta 52. Профили вкуса `solo`/`coop` (UI, CLI, API). 53. Тепловая карта активности по дням. 54. Последние запуски и завершённость в рекомендациях. +55. Исключение `played`/`ignore` по умолчанию с флажком для повторов. Дальше — ручной screen reader, Steam API, новые версии appinfo. diff --git a/docs/ROADMAP.md b/docs/ROADMAP.md index 3b416c8..8913590 100644 --- a/docs/ROADMAP.md +++ b/docs/ROADMAP.md @@ -162,7 +162,7 @@ - [x] Больше профилей настроений (21 вместо 15). - [x] Редактор пользовательских профилей (API + UI). - [x] Профиль вкуса по часам, избранному и оценкам (веса тегов). -- [ ] Исключать уже пройденные и `ignore` без напоминаний. +- [x] Исключать уже пройденные и `ignore` без напоминаний (флажок для повторов). - [x] Холодный старт: вопросы о жанре, компании и времени при малом числе сигналов. **Критерии готовности** diff --git a/docs/api.md b/docs/api.md index 0d76507..f67f8fe 100644 --- a/docs/api.md +++ b/docs/api.md @@ -298,6 +298,7 @@ DELETE → `{"deleted": true}`. "preset": "adventure-rpg-party", "mood": null, "unplayed_only": true, + "include_played": false, "include_tribute": false, "include_nostalgia": false, "min_review": 65, @@ -309,6 +310,9 @@ DELETE → `{"deleted": true}`. } ``` +`include_played`: по умолчанию `played`-игры исключаются; `true` возвращает их +(с штрафом за завершённость). `ignore` не попадает в выдачу никогда. + `taste_profile`: `solo` (игры с `Singleplayer` без кооп-тегов), `coop` (кооп/мультиплеер) или `null`. Профиль фильтрует кандидатов и считает веса вкуса только по играм соответствующего контекста; неизвестное значение → 400. diff --git a/docs/manual.md b/docs/manual.md index 8cbd6c2..cfb160f 100644 --- a/docs/manual.md +++ b/docs/manual.md @@ -160,8 +160,9 @@ python web/server.py --port 9000 - «экспорт» сохраняет свои профили в JSON, «импорт» загружает их обратно: новые добавляются, существующие обновляются, встроенные имена пропускаются; - фильтры: только неигранное, учитывать `tribute`, учитывать `nostalgia`, - минимальный процент отзывов, доступное время (30 минут / вечер / выходные), - время суток (утро/день/вечер/ночь), профиль вкуса (весь / соло / с друзьями); + учитывать пройденные (по умолчанию `played` и `ignore` исключены), минимальный + процент отзывов, доступное время (30 минут / вечер / выходные), время суток + (утро/день/вечер/ночь), профиль вкуса (весь / соло / с друзьями); - профиль вкуса фильтрует игры по контексту (`Singleplayer` без коопа или кооп/мультиплеер) и считает веса тегов только по этому контексту; - последние запуски и завершённость: недавние `playing`/`backlog` получают бонус, diff --git a/tests/test_reco.py b/tests/test_reco.py index 0fcda46..cedce5a 100644 --- a/tests/test_reco.py +++ b/tests/test_reco.py @@ -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"]) diff --git a/tools/reco.py b/tools/reco.py index aad35a2..628fd5d 100644 --- a/tools/reco.py +++ b/tools/reco.py @@ -247,9 +247,9 @@ def load_mood(con, preset=None, text=None): def recommend(con, mood, allowed_statuses=None, unplayed_only=False, min_review=65, allow_unknown=False, limit=20, feedback_key=None, session=None, time_of_day=None, taste_profile=None): - allowed = set(allowed_statuses or {"backlog", "playing", "played"}) + allowed = set(allowed_statuses or {"backlog", "playing"}) if not allowed: - allowed = {"backlog", "playing", "played"} + allowed = {"backlog", "playing"} if taste_profile and taste_profile not in TASTE_PROFILES: raise ValueError(f"unknown taste profile: {taste_profile}") context_appids = taste_profile_appids(con, taste_profile) if taste_profile else None diff --git a/tools/recommend.py b/tools/recommend.py index 2ab62ee..b88837c 100644 --- a/tools/recommend.py +++ b/tools/recommend.py @@ -33,6 +33,8 @@ def main(): help="skip games below this Steam review percentage (default 65)") ap.add_argument("--db", default=db.DEFAULT_DB) ap.add_argument("--unplayed-only", action="store_true", help="only games with 0 minutes") + ap.add_argument("--include-played", action="store_true", + help="include games marked as completed (status=played)") ap.add_argument("--include-tribute", action="store_true", help="include games you played outside Steam (status=tribute)") ap.add_argument("--include-nostalgia", action="store_true", @@ -63,7 +65,9 @@ def main(): if not mood["tags"] and not mood["genres"]: raise SystemExit("Could not understand the mood; try different words") - allowed = {"backlog", "playing", "played"} + allowed = {"backlog", "playing"} + if args.include_played: + allowed.add("played") if args.include_tribute: allowed.add("tribute") if args.include_nostalgia: diff --git a/web/server.py b/web/server.py index 89f5e66..2cce679 100644 --- a/web/server.py +++ b/web/server.py @@ -1505,7 +1505,9 @@ class Handler(BaseHTTPRequestHandler): except (KeyError, ValueError): self._error(400, "unknown mood") return - allowed = {"backlog", "playing", "played"} + allowed = {"backlog", "playing"} + if body.get("include_played"): + allowed.add("played") if body.get("include_tribute"): allowed.add("tribute") if body.get("include_nostalgia"): diff --git a/web/static/app.js b/web/static/app.js index 95aaddc..36a9843 100644 --- a/web/static/app.js +++ b/web/static/app.js @@ -1186,6 +1186,7 @@ async function runRecommend(scroll = true) { preset: state.preset, mood: state.preset ? null : text, unplayed_only: $("#optUnplayed").checked, + include_played: $("#optPlayed").checked, include_tribute: $("#optTribute").checked, include_nostalgia: $("#optNostalgia").checked, min_review: Number($("#optReview").value), diff --git a/web/static/index.html b/web/static/index.html index 198e44f..f7eef05 100644 --- a/web/static/index.html +++ b/web/static/index.html @@ -291,6 +291,7 @@ try { +