X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fdata%2FproblemCheck.js;h=8ee101f3aa36b3d06cd1a7984b473ab5c836f993;hb=e50a802531b99829c533f22ecd21e359e7e1e049;hp=3b9ccb4677acbb53dbfb8ad094666f68c45457e9;hpb=89021f181ac0689bbc785ce0ebd9a910e66352b0;p=vchess.git diff --git a/client/src/data/problemCheck.js b/client/src/data/problemCheck.js index 3b9ccb46..8ee101f3 100644 --- a/client/src/data/problemCheck.js +++ b/client/src/data/problemCheck.js @@ -1,9 +1,12 @@ -export function checkProblem(p) -{ - const vid = parseInt(p.vid); - if (isNaN(vid) || vid <= 0) - return "Please select a variant"; - - if (!V.IsGoodFen(p.fen)) - return "Bad FEN string"; +export function checkProblem(p) { + const vid = parseInt(p.vid, 10); + if (isNaN(vid) || vid <= 0) return "Please select a variant"; + + if (!V.IsGoodFen(p.fen)) return "Errors in FEN"; + + if (p.instruction.trim().length == 0) return "Missing instructions"; + + if (p.solution.trim().length == 0) return "Missing solution"; + + return ""; }