Session 47: Name normalization + grade intel + ticker polish (2149 tests)
- Name normalization completed: NICKNAMES table (Matt↔Matthew, Mike↔Michael...)
resolved in nameKey, parenthetical team-tag strip "(STL)", verified accent-fold
(Iván/Ivan, José/Jose). Slate strip now DISPLAYS the normalized de-dotted name
("AJ Ewing" not "A.J. Ewing") via buildPlayerStripsFromProps.
- Complete MLB VYNDR INTELLIGENCE: mlbGameLogFeatures derives rest_days (days off
between latest games; 0=B2B) + ab_per_game (usage). buildIntelFields renders
usage as "X AB/G", rest as B2B/Xd, matchup from bvp_advantage fallback.
- Ticker SCAN dedup: pushTickerItems keeps one SCAN per sport (sport field or
text-prefix parse for legacy); MOVE/GRADE preserved; cap 50.
- BOMBER threshold prorated for mid-season (hr>=15 strong / >=10 mod) so June
sluggers classify BOMBER not FLEX/DRIVER.
Backend 2122 -> 2149 tests (+27), 179 suites. Web build clean (exit 0).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -115,7 +115,7 @@ const isTopGrade = (g) => g === 'A+' || g === 'A';
|
||||
function generateTickerEvents(sport, grades, deltas, ts) {
|
||||
const events = [];
|
||||
events.push({
|
||||
tag: 'SCAN', color: 'var(--g-a)', ts,
|
||||
tag: 'SCAN', color: 'var(--g-a)', ts, sport, // sport tag → dedupe one SCAN per sport
|
||||
text: `${sport.toUpperCase()} slate scanned · ${grades.length} props graded`,
|
||||
});
|
||||
for (const g of grades.filter((x) => isTopGrade(x.grade)).slice(0, 6)) {
|
||||
@@ -136,11 +136,28 @@ function generateTickerEvents(sport, grades, deltas, ts) {
|
||||
return events;
|
||||
}
|
||||
|
||||
// Session 47 — a SCAN event's sport, from the event field or its text prefix
|
||||
// (defends ticker items written before the `sport` field existed).
|
||||
function scanSportOf(e) {
|
||||
if (e.tag !== 'SCAN') return null;
|
||||
if (e.sport) return String(e.sport).toLowerCase();
|
||||
const m = String(e.text || '').match(/^([a-z]+)\s+slate scanned/i);
|
||||
return m ? m[1].toLowerCase() : null;
|
||||
}
|
||||
|
||||
async function pushTickerItems(events, deps) {
|
||||
if (!events || events.length === 0) return;
|
||||
const existing = await deps.cacheGet('ticker:items');
|
||||
const arr = Array.isArray(existing) ? existing : [];
|
||||
const merged = [...events, ...arr].slice(0, TICKER_CAP);
|
||||
// Keep only the LATEST SCAN per sport: drop existing SCAN events for any sport
|
||||
// that has a fresh SCAN in this batch. MOVE/GRADE events are time-specific and
|
||||
// preserved.
|
||||
const freshScanSports = new Set(events.map(scanSportOf).filter(Boolean));
|
||||
const pruned = arr.filter((e) => {
|
||||
const sp = scanSportOf(e);
|
||||
return !(sp && freshScanSports.has(sp));
|
||||
});
|
||||
const merged = [...events, ...pruned].slice(0, TICKER_CAP);
|
||||
await deps.cacheSet('ticker:items', merged, TICKER_TTL);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user