Профиль: «Основная фракция» — самая игранная с учётом рандома

Под любимой (только ручной выбор) — основная: max по всем партиям,
включая рандомные раздачи. Есть у любого сыгравшего игрока.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-18 21:12:18 +03:00
co-authored by Claude Fable 5
parent e7323cc3c4
commit 9ce501dd11
5 changed files with 14 additions and 0 deletions
+2
View File
@@ -157,6 +157,7 @@ def test_most_played_faction_ignores_random(client: TestClient, engine):
stats = client.get("/api/users/me/stats").json()
assert stats["most_played_faction"]["faction_id"] == fids[2] # B, хоть партий с A больше
assert stats["main_faction"]["faction_id"] == fids[0] # основная — по всем партиям
# У соперника все фракции выбраны вручную — любимая считается как раньше.
login(client, "Партнёр")
@@ -183,3 +184,4 @@ def test_most_played_faction_absent_when_all_random(client: TestClient, engine):
)
stats = client.get("/api/users/me/stats").json()
assert stats["most_played_faction"] is None
assert stats["main_faction"]["faction_id"] == fids[0] # основная есть и у рандомщика