- Create economyUtils.ts with team-aware buy type classification (CT has higher thresholds due to M4 cost) - Add Economy Overview toggle to rounds page with charts - Resolve player names/avatars in round economy display - Remove standalone Economy tab (merged into Rounds) - Document missing backend API data (round winner, win reason) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
108 lines
3.1 KiB
Markdown
108 lines
3.1 KiB
Markdown
# Missing Backend API Data
|
|
|
|
This document outlines data that the frontend is ready to display but is not currently provided by the backend API. These features would enhance the match analysis experience.
|
|
|
|
## Round Winner & Win Reason
|
|
|
|
**Endpoint**: `GET /match/{id}/rounds`
|
|
|
|
**Currently Returns**:
|
|
|
|
```json
|
|
{
|
|
"0": { "player_id": [bank, equipment, spent] },
|
|
"1": { "player_id": [bank, equipment, spent] }
|
|
}
|
|
```
|
|
|
|
**Missing Fields Needed**:
|
|
|
|
| Field | Type | Description |
|
|
| ------------ | -------- | -------------------------------------- |
|
|
| `winner` | `number` | Team ID that won the round (1=T, 2=CT) |
|
|
| `win_reason` | `string` | How the round ended |
|
|
|
|
**Win Reason Values**:
|
|
|
|
- `elimination` - All enemies killed
|
|
- `bomb_defused` - CT defused the bomb
|
|
- `bomb_exploded` - Bomb detonated successfully
|
|
- `time` - Round timer expired (CT win)
|
|
- `target_saved` - Hostage rescued (rare mode)
|
|
|
|
**Expected Response Format**:
|
|
|
|
```json
|
|
{
|
|
"0": {
|
|
"winner": 1,
|
|
"win_reason": "elimination",
|
|
"players": {
|
|
"player_id": [bank, equipment, spent]
|
|
}
|
|
}
|
|
}
|
|
```
|
|
|
|
**Implementation**: Demo parser needs to capture `RoundEnd` game events and extract:
|
|
|
|
- `winner` field from the event
|
|
- `reason` field from the event
|
|
|
|
---
|
|
|
|
## Per-Round Player Stats
|
|
|
|
**Missing Fields per Player per Round**:
|
|
|
|
| Field | Type | Description |
|
|
| ------------------ | -------- | -------------------------------------------- |
|
|
| `kills_in_round` | `number` | Kills this player got in this specific round |
|
|
| `damage_in_round` | `number` | Total damage dealt this round |
|
|
| `assists_in_round` | `number` | Assists this round |
|
|
|
|
**Implementation**: During demo parse, aggregate `player_death` and `player_hurt` events per round, grouped by attacking player.
|
|
|
|
---
|
|
|
|
## Loss Bonus Tracking
|
|
|
|
**Missing Fields per Team per Round**:
|
|
|
|
| Field | Type | Description |
|
|
| ------------- | -------- | ------------------------------ |
|
|
| `loss_streak` | `number` | Consecutive round losses (0-4) |
|
|
| `loss_bonus` | `number` | Current loss bonus amount |
|
|
|
|
**CS2 Loss Bonus Scale**:
|
|
| Consecutive Losses | Bonus |
|
|
|-------------------|-------|
|
|
| 0 | $1,400 |
|
|
| 1 | $1,900 |
|
|
| 2 | $2,400 |
|
|
| 3 | $2,900 |
|
|
| 4+ | $3,400 |
|
|
|
|
**Implementation**: Track `RoundEnd` events and maintain loss counter per team, resetting on win.
|
|
|
|
---
|
|
|
|
## Frontend Readiness
|
|
|
|
The frontend already has:
|
|
|
|
- Type definitions for all missing fields (`src/lib/types/RoundStats.ts`)
|
|
- Zod validation schemas (`src/lib/schemas/roundStats.schema.ts`)
|
|
- UI components ready to display win reasons with icons
|
|
- Mock handlers showing expected data structure (`src/mocks/handlers/matches.ts`)
|
|
|
|
Once the backend provides this data, the frontend will automatically display it.
|
|
|
|
---
|
|
|
|
## Priority
|
|
|
|
1. **High**: Round winner & win reason - enables win/loss correlation analysis
|
|
2. **Medium**: Per-round player stats - enables round-by-round performance tracking
|
|
3. **Low**: Loss bonus tracking - nice-to-have for economy analysis
|