Mostra la stagione CSI nell'header di Campionato e divide lo storico per stagione
Il portale CSI non espone il nome della stagione: stagioneDi() la ricava dalla data della gara (l'anno cambia ad agosto), stagioneDaPartite() dà quella del campionato e raggruppaPerStagione() divide lo storico partite. Coperte da test in csi-core.test.ts. Documentato che oggi Campionato mostra 2025/26 mentre Squadra e Calendario mostrano 2026/27: il CSI non ha ancora creato le pagine della nuova stagione. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
33ed2398ab
commit
ae5d790011
5 files changed
+218
-111
No files matched your search
@@ -10,6 +10,9 @@ import {
|
||||
parseClassifica,
|
||||
parseFormazioni,
|
||||
parseInfoPartita,
|
||||
raggruppaPerStagione,
|
||||
stagioneDaPartite,
|
||||
stagioneDi,
|
||||
parsePrecedenti,
|
||||
partiteDaEventi,
|
||||
partiteFormatoSospetto,
|
||||
@@ -368,4 +371,34 @@ if (process.env["CSI_LIVE"]) {
|
||||
);
|
||||
}
|
||||
|
||||
// --- stagioneDi / stagioneDaPartite: l'anno cambia ad agosto ------------------
|
||||
assert.equal(stagioneDi("2025-11-12"), "2025/26");
|
||||
assert.equal(stagioneDi("2026-05-20"), "2025/26");
|
||||
assert.equal(stagioneDi("2026-07-31"), "2025/26");
|
||||
assert.equal(stagioneDi("2026-08-01"), "2026/27");
|
||||
assert.equal(stagioneDi("2099-10-01"), "2099/00");
|
||||
assert.equal(stagioneDaPartite([]), null);
|
||||
assert.equal(
|
||||
stagioneDaPartite([{ data: "2026-03-04" }, { data: "2025-11-12" }, { data: "" }]),
|
||||
"2025/26",
|
||||
);
|
||||
|
||||
assert.deepEqual(
|
||||
raggruppaPerStagione([
|
||||
{ id: "a", data: "2026-04-10" },
|
||||
{ id: "b", data: "2025-10-01" },
|
||||
{ id: "c", data: "2025-05-02" },
|
||||
]),
|
||||
[
|
||||
{
|
||||
stagione: "2025/26",
|
||||
match: [
|
||||
{ id: "a", data: "2026-04-10" },
|
||||
{ id: "b", data: "2025-10-01" },
|
||||
],
|
||||
},
|
||||
{ stagione: "2024/25", match: [{ id: "c", data: "2025-05-02" }] },
|
||||
],
|
||||
);
|
||||
|
||||
console.log("csi-core: ok");
|
||||
Reference in new issue
Block a user