fix(wheel): stop showing fake wins in the browser

After a Stars payment the wheel matched its landing sector to the won prize
by display_name/emoji and, on any miss, span to Math.random()*360 — which
often pointed at a winning slot. The poll result also carried the SPIN id in
prize_id (not the WheelPrize id), so it never matched and always hit that
random fallback. In a backgrounded browser tab the poll often times out,
so the wheel 'landed' on месяц/50₽ while the real result was Ничего; the
Mini App was fine because it gets the result inline.

- Match the sector by prize_id (exact), with name/emoji only as a defensive
  fallback for old payloads.
- Never land on a random angle: when the prize can't be resolved (poll
  timeout/error) land on the neutral 'Nothing' sector instead.
- Carry the real WheelPrize id (now exposed by the bot history endpoint)
  through the poll result.
This commit is contained in:
c0mrade
2026-06-04 22:15:43 +03:00
parent 3224320095
commit 73ee42a0ef
2 changed files with 61 additions and 37 deletions

View File

@@ -60,6 +60,9 @@ export interface SpinResult {
export interface SpinHistoryItem {
id: number;
// WheelPrize id of the won prize (null if that prize was later deleted). Used to
// land the wheel animation on the exact winning sector after a Stars payment.
prize_id: number | null;
payment_type: string;
payment_amount: number;
prize_type: string;