diff options
author | Senni Heidari <sheidar2@local> | 2023-11-21 11:36:12 +0200 |
---|---|---|
committer | Senni Heidari <sheidar2@local> | 2023-11-21 11:36:12 +0200 |
commit | b868d0ba58384fce5a9a45ae153dee9815327d55 (patch) | |
tree | 2d73e810cad9eba76121f28b07eeb49bf3f9e573 /routes/get | |
parent | 2ebfcf29c84b84999b76ff13150ba5a13fd3cac1 (diff) |
Update directory hierarchy
Diffstat (limited to 'routes/get')
-rw-r--r-- | routes/get/quiz.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/routes/get/quiz.py b/routes/get/quiz.py new file mode 100644 index 0000000..69e2613 --- /dev/null +++ b/routes/get/quiz.py @@ -0,0 +1,18 @@ +from app import app +from flask import render_template, session, request, redirect, jsonify +import db_actions as D + + +@app.route("/get/quiz_creator",methods=["GET"]) +def get_questions_by_id(): + if "quiz_id" not in session.keys(): + return "KUOLETTAVA: Sessiota / kyselmä id:tä ei ole" + + results = D.get_questions(session['quiz_id']) + r={} + names=['i','q','n','p','a'] + for i in range(len(results)): + r[i]={} + for j in range(len(results[i])): + r[i][names[j]]=results[i][j] + return (jsonify(r)) |