diff --git a/backend/app/schemas/api.py b/backend/app/schemas/api.py index a7c2152..84dcb6b 100644 --- a/backend/app/schemas/api.py +++ b/backend/app/schemas/api.py @@ -331,6 +331,9 @@ class ProfileStats(BaseModel): worst_faction: FactionStat | None = None most_played_faction: FactionStat | None = None recent_form: list[RecentFormItem] = [] + # Порог «Новичков» (MIN_GAMES) — чтобы UI единообразно подсвечивал + # неподтверждённый рейтинг, не дублируя константу на фронте. + min_games: int = 0 class PublicProfile(BaseModel): diff --git a/backend/app/services/stats_service.py b/backend/app/services/stats_service.py index ceec012..66b43d5 100644 --- a/backend/app/services/stats_service.py +++ b/backend/app/services/stats_service.py @@ -206,6 +206,7 @@ def profile_stats(session: Session, user_id: int, group_id: int | None = None) - "worst_faction": worst, "most_played_faction": most_played, "recent_form": _recent_form(session, user_id, group_id), + "min_games": MIN_GAMES, } diff --git a/frontend/src/api/schema.d.ts b/frontend/src/api/schema.d.ts index 553e44e..b3f0f86 100644 --- a/frontend/src/api/schema.d.ts +++ b/frontend/src/api/schema.d.ts @@ -1883,6 +1883,11 @@ export interface components { * @default [] */ recent_form: components["schemas"]["RecentFormItem"][]; + /** + * Min Games + * @default 0 + */ + min_games: number; }; /** ProfileUpdate */ ProfileUpdate: { diff --git a/frontend/src/components/ProfileStatsCard.tsx b/frontend/src/components/ProfileStatsCard.tsx index c287acc..009d565 100644 --- a/frontend/src/components/ProfileStatsCard.tsx +++ b/frontend/src/components/ProfileStatsCard.tsx @@ -12,6 +12,9 @@ export function ProfileStatsCard({ title?: string; }) { const o = stats.overall; + // Серебристый рейтинг — пока игрок «новичок» (меньше min_games партий) или + // не играл вовсе; золотой — только подтверждённый (как в топах). + const provisional = o.score == null || o.games < stats.min_games; return (