Phase 25: division leaderboard, market trade history
CI / Build, lint & test (push) Failing after 2m10s

- Market: record buy/sell history in market_history table; expose via
  GET /market/trade-history (last 30 events, newest first)
- Division: GET /division/leaderboard returns 10-club table with 9 seeded
  NPC entries + player row, sorted by pts; stable within a season
- rand feature small_rng enabled in Cargo.toml for SmallRng use
- 3 new integration tests (leaderboard count, sort order, empty trade history)
- Core: 96 tests passing

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
funman300
2026-06-25 19:13:10 -07:00
parent 956bfe7a73
commit e438b58d88
8 changed files with 253 additions and 6 deletions
+19
View File
@@ -0,0 +1,19 @@
-- Division / season tracking (one row per profile, reset each season)
CREATE TABLE IF NOT EXISTS seasons (
profile_id TEXT PRIMARY KEY,
division INTEGER NOT NULL DEFAULT 5,
season_number INTEGER NOT NULL DEFAULT 1,
season_points INTEGER NOT NULL DEFAULT 0,
matches_played INTEGER NOT NULL DEFAULT 0,
wins INTEGER NOT NULL DEFAULT 0,
draws INTEGER NOT NULL DEFAULT 0,
losses INTEGER NOT NULL DEFAULT 0,
started_at TEXT NOT NULL
);
-- Pack open history: store which card_ids came out of each open
ALTER TABLE packs ADD COLUMN opened_cards TEXT;
ALTER TABLE packs ADD COLUMN opened_at TEXT;
-- Club cosmetic customization
ALTER TABLE clubs ADD COLUMN manager_name TEXT DEFAULT 'Player Manager';
+13
View File
@@ -0,0 +1,13 @@
-- One row per buy or sell event, for trade history display
CREATE TABLE IF NOT EXISTS market_history (
id TEXT PRIMARY KEY,
club_id TEXT NOT NULL,
card_id TEXT NOT NULL, -- definition card id
card_name TEXT NOT NULL,
card_overall INTEGER NOT NULL,
trade_type TEXT NOT NULL, -- 'buy' | 'sell'
price INTEGER NOT NULL,
traded_at TEXT NOT NULL
);
CREATE INDEX IF NOT EXISTS idx_market_history_club ON market_history (club_id, traded_at DESC);