first reading the start of a map with a 3 minute delay to overcome the transition period from the previous map
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { query } from '@/lib/db';
|
||||
import { parseDbDate } from '@/lib/dates';
|
||||
import { START_BASELINE_MS } from '@/lib/populationBaseline';
|
||||
|
||||
// --- Why this exists ---------------------------------------------------
|
||||
//
|
||||
@@ -120,7 +121,11 @@ async function computeMapImpactStats(): Promise<MapImpactSummary[]> {
|
||||
const durationMs = nextStartMs - startMs;
|
||||
if (durationMs < MIN_REAL_PERIOD_MS) continue; // tickrate-restart artifact, not a real occurrence
|
||||
|
||||
const startPlayers = populationAt(startMs);
|
||||
// Read the starting population START_BASELINE_MS into the map rather than
|
||||
// at the exact change instant, so players still leaving the previous map
|
||||
// aren't counted against this one. Clamped to the occurrence's end (it is
|
||||
// always >= 2 min long here, but may be shorter than the baseline).
|
||||
const startPlayers = populationAt(Math.min(startMs + START_BASELINE_MS, nextStartMs));
|
||||
const endPlayers = populationAt(nextStartMs);
|
||||
const netChange = endPlayers - startPlayers;
|
||||
const retentionPct = startPlayers > 0 ? (endPlayers / startPlayers) * 100 : null;
|
||||
|
||||
Reference in New Issue
Block a user