WOD : séance à format, chrono et score (lot 4b, ADR 0010)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Pierre MARTIN
2026-11-18 14:51:56 +01:00
co-authored by Claude Opus 5.5
parent d9604d43ec
commit ee3f55a515
21 changed files with 887 additions and 13 deletions
+6
View File
@@ -3,6 +3,7 @@
// nouvelle version `v` et une migration testée.
// Glossaire : docs/glossaire/evenement.md
import { wodResultProblem } from "./wod.js";
import { randomId } from "./ids.js";
import { validateProgram } from "./program.js";
import { validateProfile } from "./profile.js";
@@ -51,6 +52,7 @@ export const EVENT_VERSION = 1;
* @property {string} name
* @property {LoggedExercise[]} exercises vide pour un cardio ou une activité
* @property {{done: number, total: number}|null} warmup
* @property {import("./wod.js").WodResult} [wod] score d'une séance WOD (ADR 0010)
*/
/**
@@ -97,6 +99,10 @@ function sessionError(s) {
if (!isText(s.ref) || !isText(s.name)) return "séance sans référence ou sans nom";
if (s.warmup !== null && !(isObject(s.warmup) && Number.isInteger(s.warmup.done) && Number.isInteger(s.warmup.total)))
return "échauffement mal formé";
if (s.wod !== undefined) {
const problem = wodResultProblem(s.wod);
if (problem) return problem;
}
if (!Array.isArray(s.exercises)) return "exercices absents";
for (const x of s.exercises) {
if (!isObject(x) || !isText(x.id) || !isText(x.name) || typeof x.target !== "string") return "exercice mal formé";