From 032312bfa24f306e84645645f76d40773149ac49 Mon Sep 17 00:00:00 2001
From: Benjamin Auder <benjamin.auder@somewhere>
Date: Thu, 20 Feb 2020 22:12:38 +0100
Subject: [PATCH] Fix problem checking before sending to server

---
 client/src/data/problemCheck.js | 4 ++++
 client/src/translations/en.js   | 2 ++
 client/src/translations/es.js   | 2 ++
 client/src/translations/fr.js   | 2 ++
 4 files changed, 10 insertions(+)

diff --git a/client/src/data/problemCheck.js b/client/src/data/problemCheck.js
index d0978cbc..b9fe04df 100644
--- a/client/src/data/problemCheck.js
+++ b/client/src/data/problemCheck.js
@@ -4,5 +4,9 @@ export function checkProblem(p) {
 
   if (!V.IsGoodFen(p.fen)) return "Errors in FEN";
 
+  if (p.instruction.trim().length == 0) return "Empty instructions";
+
+  if (p.solution.trim().length == 0) return "Empty solution";
+
   return "";
 }
diff --git a/client/src/translations/en.js b/client/src/translations/en.js
index ef9f291e..6d5d0ec2 100644
--- a/client/src/translations/en.js
+++ b/client/src/translations/en.js
@@ -51,7 +51,9 @@ export const translations = {
   Logout: "Logout",
   "Logout successful!": "Logout successful!",
   "Missing email": "Missing email",
+  "Missing instructions": "Missing instructions",
   "Missing name": "Missing name",
+  "Missing solution": "Missing solution",
   "Modifications applied!": "Modifications applied!",
   "Move played:": "Move played:",
   "Mutual agreement": "Mutual agreement",
diff --git a/client/src/translations/es.js b/client/src/translations/es.js
index e51720a4..192c5320 100644
--- a/client/src/translations/es.js
+++ b/client/src/translations/es.js
@@ -51,7 +51,9 @@ export const translations = {
   Logout: "Logout",
   "Logout successful!": "¡Desconexión exitosa!",
   "Missing email": "Email falta",
+  "Missing instructions": "Instrucciones faltan",
   "Missing name": "Nombre falta",
+  "Missing solution": "Solución falta",
   "Modifications applied!": "¡Modificaciones aplicadas!",
   "Move played:": "Movimiento jugado:",
   "Mutual agreement": "Acuerdo mutuo",
diff --git a/client/src/translations/fr.js b/client/src/translations/fr.js
index d3533fcb..e229d0a0 100644
--- a/client/src/translations/fr.js
+++ b/client/src/translations/fr.js
@@ -51,7 +51,9 @@ export const translations = {
   Logout: "Logout",
   "Logout successful!": "Déconnection réussie !",
   "Missing email": "Email manquant",
+  "Missing instructions": "Instructions manquantes",
   "Missing name": "Nom manquant",
+  "Missing solution": "Solution manquante",
   "Modifications applied!": "Modifications effectuées !",
   "Move played:": "Coup joué :",
   "Mutual agreement": "Accord mutuel",
-- 
2.44.0