diff options
Diffstat (limited to 'question.py')
-rw-r--r-- | question.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/question.py b/question.py index e7494bc..96673c2 100644 --- a/question.py +++ b/question.py @@ -4,9 +4,13 @@ import db_actions as D def validate_answer(ans): + if len(ans)<1: + return False return True def validate_question(question): + if len(question)<2: + return False return True @app.route("/new_question",methods=["POST"]) @@ -18,9 +22,9 @@ def new_question(): if not validate_question(question): msg = "Kysymys on virheellinen" elif not validate_answer(neg_ans): - msg = "Vasen selite virheellinen" + msg = "Vasen selite on virheellinen" elif not validate_answer(pos_ans): - msg = "Oikea selite virheellinen" + msg = "Oikea selite on virheellinen" elif "id" not in session.keys(): msg = "Tarvitaan nimimerkki" elif "quiz_id" not in session.keys(): @@ -34,5 +38,3 @@ def new_question(): return redirect("/#create") session["alert"]="Kysymystä ei luotu: "+msg return redirect("/#create") - - |