Skip to content

Commit 695dc27

Browse files
authored
Merge pull request #2 from Thony-Crz/copilot/update-minima-trail-saison-prochaine
feat: add saison 2026/27 minima + default UI to new season
2 parents 0cb1ed8 + 021c3cc commit 695dc27

3 files changed

Lines changed: 68 additions & 3 deletions

File tree

src/minimas.ts

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export interface MinimaEntry {
1414

1515
const toMin = (m: number, s: number) => m + s / 60;
1616

17-
// Table de base — saison 2025/26 (configurable ultérieurement)
17+
// Saison 2025/26
1818
const MINIMAS_2025_26: MinimaEntry[] = [
1919
// Espoirs / Seniors
2020
{ seasonId: '2025/26', sexe: 'H', categorie: 'ES', vkMinMinPerKm: toMin(4, 10) },
@@ -52,7 +52,47 @@ const MINIMAS_2025_26: MinimaEntry[] = [
5252
{ seasonId: '2025/26', sexe: 'F', categorie: 'M10' }
5353
];
5454

55-
const TABLE: MinimaEntry[] = [...MINIMAS_2025_26];
55+
// Saison 2026/27 — source officielle : https://www.athle.fr/contenu/minima-trail/6271
56+
const MINIMAS_2026_27: MinimaEntry[] = [
57+
// Espoirs / Seniors
58+
{ seasonId: '2026/27', sexe: 'H', categorie: 'ES', vkMinMinPerKm: toMin(4, 10) },
59+
{ seasonId: '2026/27', sexe: 'H', categorie: 'SE', vkMinMinPerKm: toMin(4, 10) },
60+
{ seasonId: '2026/27', sexe: 'F', categorie: 'ES', vkMinMinPerKm: toMin(5, 20) },
61+
{ seasonId: '2026/27', sexe: 'F', categorie: 'SE', vkMinMinPerKm: toMin(5, 20) },
62+
63+
// M0
64+
{ seasonId: '2026/27', sexe: 'H', categorie: 'M0', vkMinMinPerKm: toMin(4, 30) },
65+
{ seasonId: '2026/27', sexe: 'F', categorie: 'M0', vkMinMinPerKm: toMin(5, 40) },
66+
// M1
67+
{ seasonId: '2026/27', sexe: 'H', categorie: 'M1', vkMinMinPerKm: toMin(4, 50) },
68+
{ seasonId: '2026/27', sexe: 'F', categorie: 'M1', vkMinMinPerKm: toMin(5, 50) },
69+
// M2
70+
{ seasonId: '2026/27', sexe: 'H', categorie: 'M2', vkMinMinPerKm: toMin(5, 0) },
71+
{ seasonId: '2026/27', sexe: 'F', categorie: 'M2', vkMinMinPerKm: toMin(6, 0) },
72+
// M3
73+
{ seasonId: '2026/27', sexe: 'H', categorie: 'M3', vkMinMinPerKm: toMin(5, 20) },
74+
{ seasonId: '2026/27', sexe: 'F', categorie: 'M3', vkMinMinPerKm: toMin(6, 10) },
75+
// M4
76+
{ seasonId: '2026/27', sexe: 'H', categorie: 'M4', vkMinMinPerKm: toMin(5, 40) },
77+
{ seasonId: '2026/27', sexe: 'F', categorie: 'M4', vkMinMinPerKm: toMin(6, 20) },
78+
// M5 à M10 — pas de minima: champs absent -> null à la lecture
79+
{ seasonId: '2026/27', sexe: 'H', categorie: 'M5' },
80+
{ seasonId: '2026/27', sexe: 'F', categorie: 'M5' },
81+
{ seasonId: '2026/27', sexe: 'H', categorie: 'M6' },
82+
{ seasonId: '2026/27', sexe: 'F', categorie: 'M6' },
83+
{ seasonId: '2026/27', sexe: 'H', categorie: 'M7' },
84+
{ seasonId: '2026/27', sexe: 'F', categorie: 'M7' },
85+
{ seasonId: '2026/27', sexe: 'H', categorie: 'M8' },
86+
{ seasonId: '2026/27', sexe: 'F', categorie: 'M8' },
87+
{ seasonId: '2026/27', sexe: 'H', categorie: 'M9' },
88+
{ seasonId: '2026/27', sexe: 'F', categorie: 'M9' },
89+
{ seasonId: '2026/27', sexe: 'H', categorie: 'M10' },
90+
{ seasonId: '2026/27', sexe: 'F', categorie: 'M10' }
91+
];
92+
93+
export const CURRENT_SEASON = '2026/27';
94+
95+
const TABLE: MinimaEntry[] = [...MINIMAS_2025_26, ...MINIMAS_2026_27];
5696

5797
export function getMinimaVK(
5898
seasonId: string,

src/ui/App.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { estimateCourse } from '../estimator.js';
33
import type { Format } from '../core.js';
44
import { minPerKmToPaceStr } from '../core.js';
55
import type { Categorie, Sexe } from '../minimas.js';
6+
import { CURRENT_SEASON } from '../minimas.js';
67

78
function toMinutesDisplay(min: number) {
89
const total = Math.round(min);
@@ -16,7 +17,7 @@ export const App: React.FC = () => {
1617
const [dPlusM, setDPlusM] = useState('2000');
1718
const [sexe, setSexe] = useState<Sexe>('H');
1819
const [categorie, setCategorie] = useState<Categorie>('SE');
19-
const [seasonId, setSeasonId] = useState('2025/26');
20+
const [seasonId, setSeasonId] = useState(CURRENT_SEASON);
2021
const [requestedFormat, setRequestedFormat] = useState<Format | 'auto'>('auto');
2122

2223
const parsed = useMemo(() => {
@@ -78,6 +79,7 @@ export const App: React.FC = () => {
7879
<div>
7980
<label>Saison</label>
8081
<select value={seasonId} onChange={(e) => setSeasonId(e.target.value)}>
82+
<option value="2026/27">2026/27</option>
8183
<option value="2025/26">2025/26</option>
8284
</select>
8385
</div>

tests/minimas.test.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,26 @@ describe('minimas lookup (2025/26)', () => {
2020
});
2121
});
2222

23+
describe('minimas lookup (2026/27)', () => {
24+
it('retourne la VK H Senior/ES pour 2026/27', () => {
25+
const vk = getMinimaVK('2026/27', 'H', 'SE');
26+
expect(vk).not.toBeNull();
27+
const vkEs = getMinimaVK('2026/27', 'H', 'ES');
28+
expect(vkEs).not.toBeNull();
29+
});
30+
31+
it('retourne la VK F SE pour 2026/27', () => {
32+
const vk = getMinimaVK('2026/27', 'F', 'SE');
33+
expect(vk).not.toBeNull();
34+
});
35+
36+
it('retourne null pour M5 à M10 en 2026/27 (pas de minima)', () => {
37+
expect(getMinimaVK('2026/27', 'H', 'M5')).toBeNull();
38+
expect(getMinimaVK('2026/27', 'F', 'M8')).toBeNull();
39+
});
40+
41+
it('retourne null pour une saison inconnue', () => {
42+
expect(getMinimaVK('2099/00', 'H', 'SE')).toBeNull();
43+
});
44+
});
45+

0 commit comments

Comments
 (0)