summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSenni Heidari <sheidar2@local>2023-11-21 11:36:12 +0200
committerSenni Heidari <sheidar2@local>2023-11-21 11:36:12 +0200
commitb868d0ba58384fce5a9a45ae153dee9815327d55 (patch)
tree2d73e810cad9eba76121f28b07eeb49bf3f9e573
parent2ebfcf29c84b84999b76ff13150ba5a13fd3cac1 (diff)
Update directory hierarchy
-rw-r--r--app.py10
-rw-r--r--routes/base.py (renamed from routes.py)0
-rw-r--r--routes/get/quiz.py (renamed from get_questions.py)2
-rw-r--r--routes/set/nick.py (renamed from nick.py)2
-rw-r--r--routes/set/question.py (renamed from question.py)2
-rw-r--r--routes/set/quiz.py (renamed from quiz.py)2
-rw-r--r--static/create.js2
-rw-r--r--templates/nick.html2
-rw-r--r--templates/question.html2
-rw-r--r--templates/quiz.html2
10 files changed, 13 insertions, 13 deletions
diff --git a/app.py b/app.py
index 7124bd6..996be9b 100644
--- a/app.py
+++ b/app.py
@@ -7,8 +7,8 @@ app.secret_key = getenv("SECRET_KEY")
app.config["SQLALCHEMY_DATABASE_URI"] = getenv("SQLALCHEMY_DATABASE_URI")
db.init_app(app)
-import routes
-import nick
-import quiz
-import question
-import get_questions
+import routes.base
+import routes.set.nick
+import routes.set.quiz
+import routes.set.question
+import routes.get.quiz
diff --git a/routes.py b/routes/base.py
index 144eeef..144eeef 100644
--- a/routes.py
+++ b/routes/base.py
diff --git a/get_questions.py b/routes/get/quiz.py
index 496b99a..69e2613 100644
--- a/get_questions.py
+++ b/routes/get/quiz.py
@@ -3,7 +3,7 @@ from flask import render_template, session, request, redirect, jsonify
import db_actions as D
-@app.route("/get_questions",methods=["GET"])
+@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"
diff --git a/nick.py b/routes/set/nick.py
index f476d29..67ddeea 100644
--- a/nick.py
+++ b/routes/set/nick.py
@@ -3,7 +3,7 @@ from flask import render_template, session, request, redirect
import db_actions as D
-@app.route("/new_nick",methods=["POST"])
+@app.route("/set/nick",methods=["POST"])
def new_nick():
nick = request.form["nick"]
if "id" in session.keys():
diff --git a/question.py b/routes/set/question.py
index 96673c2..deaf9be 100644
--- a/question.py
+++ b/routes/set/question.py
@@ -13,7 +13,7 @@ def validate_question(question):
return False
return True
-@app.route("/new_question",methods=["POST"])
+@app.route("/set/question",methods=["POST"])
def new_question():
question = request.form["question"]
neg_ans = request.form["neg_ans"]
diff --git a/quiz.py b/routes/set/quiz.py
index a136209..9ad13da 100644
--- a/quiz.py
+++ b/routes/set/quiz.py
@@ -3,7 +3,7 @@ from flask import render_template, session, request, redirect
import db_actions as D
-@app.route("/new_quiz",methods=["POST"])
+@app.route("/set/quiz",methods=["POST"])
def new_quiz():
if not "id" in session.keys():
session["alert"]="Tarvitset nimimerkin loudaksesi"
diff --git a/static/create.js b/static/create.js
index 6c25659..d64073f 100644
--- a/static/create.js
+++ b/static/create.js
@@ -50,7 +50,7 @@ createQuestions = () => {
}
loadQuestions = async() => {
- await fetch( 'get_questions' )
+ await fetch( 'get/quiz_creator' )
.then( response => response.json() )
.then( json => questions = json )
.catch( error => {
diff --git a/templates/nick.html b/templates/nick.html
index f3e1696..fe4a50a 100644
--- a/templates/nick.html
+++ b/templates/nick.html
@@ -1,5 +1,5 @@
<div id="alertbox">{{ alert }}</div>
-<form action="/new_nick" method="POST">
+<form action="/set/nick" method="POST">
Anna itsellesi nimimerkki ensin:
<input type="text" name="nick" rows="1" cols="40"></textarea>
<input type="submit" value="Lähetä">
diff --git a/templates/question.html b/templates/question.html
index 6d0dca1..016a1ac 100644
--- a/templates/question.html
+++ b/templates/question.html
@@ -1,5 +1,5 @@
<div id="kysAlert">{{ alert }}</div>
-<form action="/new_question" method="POST">
+<form action="/set/question" method="POST">
<div class="kysQuestion">
<div class="kysCreateText">Kysymys:</div>
<div class="kysCreateText"><input type="text" name="question"></div>
diff --git a/templates/quiz.html b/templates/quiz.html
index 4c1871d..b2083ae 100644
--- a/templates/quiz.html
+++ b/templates/quiz.html
@@ -1,4 +1,4 @@
<div id="alertbox">{{ alert }}</div>
-<form action="/new_quiz" method="POST">
+<form action="/set/quiz" method="POST">
<input type="submit" value="Aloita uusi kyselmä">
</form>