revert: remove ELO rank feature (data source inaccessible)
stat-check.com's ELO data is behind Microsoft auth with no public API or download endpoint available. Removing the sync script, placeholder JSON, CI job, table column, and all related JS. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+1
-35
@@ -60,34 +60,6 @@ const fmtPts = (n) => Number(n || 0).toLocaleString(undefined, { minimumFraction
|
||||
const fmtWpct = (w, l, t) => { const g = (+w||0)+(+l||0)+(+t||0); return g ? ((+w||0)/g*100).toFixed(1)+'%' : '—'; };
|
||||
const fullName = (u = {}) => [u.firstName, u.lastName].filter(Boolean).join(" ").trim();
|
||||
|
||||
/* ---- ELO data ---- */
|
||||
let eloData = null;
|
||||
|
||||
async function loadElo() {
|
||||
try {
|
||||
const r = await fetch('/elo-data.json');
|
||||
if (!r.ok) return;
|
||||
const d = await r.json();
|
||||
if (d && d.byName && d.count > 0) {
|
||||
eloData = d;
|
||||
if (lastState) render(lastState);
|
||||
}
|
||||
} catch (e) { /* ELO is optional — fail silently */ }
|
||||
}
|
||||
|
||||
function lookupElo(r) {
|
||||
if (!eloData) return null;
|
||||
const name = fullName(r.user || {}).toLowerCase().trim();
|
||||
if (eloData.byName[name]) return eloData.byName[name];
|
||||
// Fall back to first + last only (strips middle initials)
|
||||
const parts = name.split(/\s+/).filter(Boolean);
|
||||
if (parts.length > 2) {
|
||||
const short = parts[0] + ' ' + parts[parts.length - 1];
|
||||
if (eloData.byName[short]) return eloData.byName[short];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/* ---- Sort state ---- */
|
||||
let sortState = { col: 'pts', dir: 'desc' };
|
||||
let lastState = null;
|
||||
@@ -98,7 +70,6 @@ const sortCols = {
|
||||
wlt: { key: r => (+r.wins||0) * 10000 - (+r.losses||0) * 100 - (+r.ties||0), defaultDir: 'desc' },
|
||||
wpct: { key: r => { const g=(+r.wins||0)+(+r.losses||0)+(+r.ties||0); return g?(+r.wins||0)/g:-1; }, defaultDir: 'desc' },
|
||||
rank: { key: r => +(r.placing || Infinity), defaultDir: 'asc' },
|
||||
elo: { key: r => { const e = lookupElo(r); return e ? e.rank : Infinity; }, defaultDir: 'asc' },
|
||||
};
|
||||
|
||||
function applySort(rows) {
|
||||
@@ -252,10 +223,7 @@ function render(state) {
|
||||
`<td class="text-right font-mono hidden sm:table-cell">` +
|
||||
`<span class="text-success">${r.wins || 0}</span>–<span class="text-error">${r.losses || 0}</span>–${r.ties || 0}</td>` +
|
||||
`<td class="text-right font-mono hidden sm:table-cell">${fmtWpct(r.wins, r.losses, r.ties)}</td>` +
|
||||
`<td class="text-right font-mono text-base-content/40 hidden sm:table-cell">#${r.placing ?? "—"}</td>` +
|
||||
(eloData
|
||||
? (() => { const e = lookupElo(r); return `<td class="text-right font-mono hidden sm:table-cell">${e ? `#${e.rank.toLocaleString()}` : '<span class="opacity-30">—</span>'}</td>`; })()
|
||||
: `<td class="text-right font-mono text-base-content/20 hidden sm:table-cell">…</td>`);
|
||||
`<td class="text-right font-mono text-base-content/40 hidden sm:table-cell">#${r.placing ?? "—"}</td>`;
|
||||
tb.appendChild(tr);
|
||||
});
|
||||
}
|
||||
@@ -322,7 +290,6 @@ function showSkeleton() {
|
||||
`<td><div class="skeleton h-4 w-12 ml-auto"></div></td>` +
|
||||
`<td class="hidden sm:table-cell"><div class="skeleton h-4 w-14 ml-auto"></div></td>` +
|
||||
`<td class="hidden sm:table-cell"><div class="skeleton h-4 w-12 ml-auto"></div></td>` +
|
||||
`<td class="hidden sm:table-cell"><div class="skeleton h-4 w-10 ml-auto"></div></td>` +
|
||||
`<td class="hidden sm:table-cell"><div class="skeleton h-4 w-10 ml-auto"></div></td>`;
|
||||
tb.appendChild(tr);
|
||||
}
|
||||
@@ -359,4 +326,3 @@ $("refresh").addEventListener("click", () => load(true));
|
||||
initSortHeaders();
|
||||
paintCache();
|
||||
load(false);
|
||||
loadElo();
|
||||
|
||||
Reference in New Issue
Block a user