From a67a38c92fa9114a307c2ec103890f86e7084361 Mon Sep 17 00:00:00 2001 From: adrien Date: Thu, 15 Oct 2020 03:48:10 +0200 Subject: [PATCH] fix validity --- sudoku.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sudoku.js b/sudoku.js index f7bf404..706f45b 100644 --- a/sudoku.js +++ b/sudoku.js @@ -104,7 +104,7 @@ function refresh(box) { for (neighbour1 of box.neighbourhood) { neighbour1.setCustomValidity("") if (neighbour1.value.length) { - if (neighbour1.candidates.size) { + if (neighbour1.value) { for (area of [ {name: "région", neighbours: regions[neighbour1.regionId]}, {name: "ligne", neighbours: rows[neighbour1.rowId]}, @@ -116,9 +116,10 @@ function refresh(box) { neighbour.setCustomValidity(`Il y a un autre ${neighbour.value} dans cette ${area.name}.`) } } - } - } else if (neighbour1.candidates.size == 0) { - neighbour1.setCustomValidity("Aucun value possible !") + } else { + if (neighbour1.candidates.size == 0) + neighbour1.setCustomValidity("Aucun value possible !") + } } }