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:
co-authored by
Claude Opus 5.5
parent
d9604d43ec
commit
ee3f55a515
@@ -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é";
|
||||
|
||||
Reference in New Issue
Block a user