From ef5b707697005914845cfdc47b84284fc157b105 Mon Sep 17 00:00:00 2001 From: Thibaut Valentin Date: Sun, 7 Dec 2025 19:45:09 +0100 Subject: [PATCH] feat: cm table next tree match + lock scores --- .../webapp/src/pages/competition/editor/CMTable.jsx | 13 +++++++++++-- src/main/webapp/src/pages/result/DrawGraph.jsx | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/main/webapp/src/pages/competition/editor/CMTable.jsx b/src/main/webapp/src/pages/competition/editor/CMTable.jsx index f487c09..37a999c 100644 --- a/src/main/webapp/src/pages/competition/editor/CMTable.jsx +++ b/src/main/webapp/src/pages/competition/editor/CMTable.jsx @@ -8,6 +8,7 @@ import {FontAwesomeIcon} from "@fortawesome/react-fontawesome"; import {faCircleQuestion} from "@fortawesome/free-regular-svg-icons"; import {DrawGraph} from "../../result/DrawGraph.jsx"; import {scorePrint, win} from "../../../utils/Tools.js"; +import {toast} from "react-toastify"; function CupImg() { return { - setCurrentMatch({matchSelect: matchId, matchNext: new TreeNode(matchId).nextMatchTree(trees)}); + setCurrentMatch({matchSelect: matchId, matchNext: new TreeNode(matchId).nextMatchTree(trees.reverse())}); } const onClickVoid = () => { @@ -288,7 +289,7 @@ function BuildTree({treeData, matches}) { return
+ matchSelect={currentMatch?.matchSelect} matchNext={currentMatch?.matchNext} size={23}/>
{currentMatch?.matchSelect && } @@ -381,6 +382,14 @@ function ScorePanel({matchId, matches}) { if (!match || match?.end === end) return; + if (end){ + if (win(match?.scores) === 0 && match.categorie_ord === -42){ + toast.error("Impossible de terminer un match nul en tournois."); + setEnd(false); + return; + } + } + setLoading(1) sendRequest('updateMatchEnd', {matchId: matchId, end}) .finally(() => { diff --git a/src/main/webapp/src/pages/result/DrawGraph.jsx b/src/main/webapp/src/pages/result/DrawGraph.jsx index 640fdf5..c518ea7 100644 --- a/src/main/webapp/src/pages/result/DrawGraph.jsx +++ b/src/main/webapp/src/pages/result/DrawGraph.jsx @@ -2,7 +2,6 @@ import {useEffect, useRef} from "react"; import {scorePrint, win} from "../../utils/Tools.js"; const max_x = 500; -const size = 24; function getMousePos(canvas, evt) { const rect = canvas.getBoundingClientRect(); @@ -21,6 +20,7 @@ export function DrawGraph({ }, matchSelect = null, matchNext = null, + size = 24 }) { const canvasRef = useRef(null); const actionCanvasRef = useRef(null);