Commit Graph

5 Commits

Author SHA1 Message Date
Cal Corum
c5e1fb44a6 Simplify and deduplicate codebase (-261 lines)
Consolidate shared helpers (format_rating, format_swar, tier_style,
format_relative_time) into widgets/mod.rs and screens/mod.rs. Replace
heap allocations with stack arrays and HashSets, parallelize DB queries
with tokio::try_join, wrap schema init in transactions, use OnceLock for
invariant hashes, and fix clippy warnings. Auto-sync on dashboard mount
when last sync >24h ago. All 105 tests pass.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 20:07:23 -06:00
Cal Corum
3e736442c7 Redesign dashboard with roster health, card coverage, and sync refresh
- Add position coverage, IL players, missing card warnings, and detailed
  sync status sections to the dashboard
- Fix team sync to include IL/MiL teams (active_only=false), matching
  Python behavior so get_my_roster() finds WVIL/WVMiL teams
- Re-fetch all dashboard data after successful sync so changes reflect
  immediately without navigating away
- Add sWAR budget bar (90-100% range) with color thresholds from
  Team.salary_cap
- Add team-scoped missing card queries and bulk sync status query
- Mark Phase 2 and Phase 3 project plans as complete

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 11:52:38 -06:00
Cal Corum
60b397b529 Fix sync errors: string move_id, FK constraints on connection pool
API returns move_id as string ("Season-013-Week-11-1772073335"), not
i64. Also disable foreign_keys at pool level via SqliteConnectOptions
since transactions reference players/teams that may not exist locally.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 10:50:27 -06:00
Cal Corum
a18c0431d1 Fix sync JSON parse error: Discord snowflake IDs are strings, not i64
The API returns gmid/gmid2 as quoted strings ("258104532423147520")
to avoid JavaScript precision loss. Changed types to Option<String>.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 08:07:03 -06:00
Cal Corum
3c70ecc71a Implement Phase 2: API client, sync pipeline, and CSV card importers
Port the full data ingestion layer from Python to Rust:
- Typed API client with 10 endpoints, serde response types, and error handling
- Team/player/transaction sync with proper upsert semantics (preserves hand field)
- Batter and pitcher CSV importers with 40+ column mappings each
- Parse helpers for float/int/endurance with 21 unit tests

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 22:56:50 -06:00