From 0a8136dfb5fd6ce8b71b133f97d17aa5d338c6db Mon Sep 17 00:00:00 2001 From: furtest Date: Fri, 5 Dec 2025 01:51:51 +0100 Subject: [PATCH 1/4] Start of the quizz on the backend --- Quiz/test.html | 18 ------------------ Quiz/test.php | 0 flask_base/app.py | 8 +++++++- flask_base/data/leaderboard.json | 11 +---------- flask_base/data/quizz.json | 12 ++++++++++++ .../static}/logo_n2i_color_moon.jpg | 0 .../static}/logo_n2i_color_moon.png | 0 .../static}/logo_n2i_color_moon.svg | 0 Quiz/test.css => flask_base/static/quiz.css | 0 Quiz/test.js => flask_base/static/quizz.js | 0 {Quiz => flask_base/templates}/question.html | 0 {Quiz => flask_base/templates}/quiz.html | 0 12 files changed, 20 insertions(+), 29 deletions(-) delete mode 100644 Quiz/test.html delete mode 100644 Quiz/test.php create mode 100644 flask_base/data/quizz.json rename {Quiz => flask_base/static}/logo_n2i_color_moon.jpg (100%) rename {Quiz => flask_base/static}/logo_n2i_color_moon.png (100%) rename {Quiz => flask_base/static}/logo_n2i_color_moon.svg (100%) rename Quiz/test.css => flask_base/static/quiz.css (100%) rename Quiz/test.js => flask_base/static/quizz.js (100%) rename {Quiz => flask_base/templates}/question.html (100%) rename {Quiz => flask_base/templates}/quiz.html (100%) diff --git a/Quiz/test.html b/Quiz/test.html deleted file mode 100644 index 451cff5..0000000 --- a/Quiz/test.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - Nuit de l'info tkt - - - - - - -

Nuit de l'Info

-

hello world!

- - - - - - \ No newline at end of file diff --git a/Quiz/test.php b/Quiz/test.php deleted file mode 100644 index e69de29..0000000 diff --git a/flask_base/app.py b/flask_base/app.py index fcfc691..b3b49a9 100644 --- a/flask_base/app.py +++ b/flask_base/app.py @@ -1,4 +1,4 @@ -from flask import Flask, jsonify, request +from flask import Flask, jsonify, request, render_template import json import os @@ -36,6 +36,12 @@ def get_leaderboard(): leaderboard_sorted = sorted(leaderboard, key=lambda x: x['score'], reverse=True) return jsonify({'leaderboard': leaderboard_sorted}) +@app.route('/questions') +def show_questions(): + with open('./data/quizz.json', 'r') as file: + questions = json.load(file) + return render_template('question.html', questions=questions) + if __name__ == '__main__': app.run(debug=True, port=8080) diff --git a/flask_base/data/leaderboard.json b/flask_base/data/leaderboard.json index a1e83b5..0637a08 100644 --- a/flask_base/data/leaderboard.json +++ b/flask_base/data/leaderboard.json @@ -1,10 +1 @@ -[ - { - "name": "Alice", - "score": 100 - }, - { - "name": "salut", - "score": 30 - } -] \ No newline at end of file +[] \ No newline at end of file diff --git a/flask_base/data/quizz.json b/flask_base/data/quizz.json new file mode 100644 index 0000000..79b2b49 --- /dev/null +++ b/flask_base/data/quizz.json @@ -0,0 +1,12 @@ +[ + { + "question" : "coucou", + "nb" : 1, + "answer" : [ + { + "answer" : "salut", + "nb" : 1 + } + ] + } +] diff --git a/Quiz/logo_n2i_color_moon.jpg b/flask_base/static/logo_n2i_color_moon.jpg similarity index 100% rename from Quiz/logo_n2i_color_moon.jpg rename to flask_base/static/logo_n2i_color_moon.jpg diff --git a/Quiz/logo_n2i_color_moon.png b/flask_base/static/logo_n2i_color_moon.png similarity index 100% rename from Quiz/logo_n2i_color_moon.png rename to flask_base/static/logo_n2i_color_moon.png diff --git a/Quiz/logo_n2i_color_moon.svg b/flask_base/static/logo_n2i_color_moon.svg similarity index 100% rename from Quiz/logo_n2i_color_moon.svg rename to flask_base/static/logo_n2i_color_moon.svg diff --git a/Quiz/test.css b/flask_base/static/quiz.css similarity index 100% rename from Quiz/test.css rename to flask_base/static/quiz.css diff --git a/Quiz/test.js b/flask_base/static/quizz.js similarity index 100% rename from Quiz/test.js rename to flask_base/static/quizz.js diff --git a/Quiz/question.html b/flask_base/templates/question.html similarity index 100% rename from Quiz/question.html rename to flask_base/templates/question.html diff --git a/Quiz/quiz.html b/flask_base/templates/quiz.html similarity index 100% rename from Quiz/quiz.html rename to flask_base/templates/quiz.html From 6dc6df60c689bf17b6d837530aaa7837e8772f5a Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 5 Dec 2025 02:11:00 +0100 Subject: [PATCH 2/4] inclusion question dans quiz --- flask_base/app.py | 2 +- flask_base/templates/quiz.html | 15 +-------------- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/flask_base/app.py b/flask_base/app.py index b3b49a9..79ab7f0 100644 --- a/flask_base/app.py +++ b/flask_base/app.py @@ -40,7 +40,7 @@ def get_leaderboard(): def show_questions(): with open('./data/quizz.json', 'r') as file: questions = json.load(file) - return render_template('question.html', questions=questions) + return render_template('quiz.html', questions=questions) if __name__ == '__main__': app.run(debug=True, port=8080) diff --git a/flask_base/templates/quiz.html b/flask_base/templates/quiz.html index 23bd702..dd5bbfd 100644 --- a/flask_base/templates/quiz.html +++ b/flask_base/templates/quiz.html @@ -10,19 +10,6 @@

page du quiz

-
-

Question

-
-
- -



-
-
-

Question

-
-
- -



-
+ {% include 'question.html' %} From 0a95a72cbb66696efb887aef5f2b433a915fe2e2 Mon Sep 17 00:00:00 2001 From: furtest Date: Fri, 5 Dec 2025 02:16:50 +0100 Subject: [PATCH 3/4] Ajoute les routes statiques pour le quizz --- flask_base/data/quizz.json | 14 ++++++++++++++ flask_base/templates/quiz.html | 8 ++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/flask_base/data/quizz.json b/flask_base/data/quizz.json index 79b2b49..1d8db8a 100644 --- a/flask_base/data/quizz.json +++ b/flask_base/data/quizz.json @@ -8,5 +8,19 @@ "nb" : 1 } ] + }, + { + "question" : "hello", + "nb" : 2, + "answer" : [ + { + "answer" : "salut", + "nb" : 1 + }, + { + "answer" : "deux", + "nb" : 2 + } + ] } ] diff --git a/flask_base/templates/quiz.html b/flask_base/templates/quiz.html index dd5bbfd..91d105e 100644 --- a/flask_base/templates/quiz.html +++ b/flask_base/templates/quiz.html @@ -2,12 +2,12 @@ Nuit de l'info quiz - - - + + + - +

page du quiz

{% include 'question.html' %} From 25fe475cfb2f3050861727d4b2f767ecdebce69e Mon Sep 17 00:00:00 2001 From: serguei Date: Fri, 5 Dec 2025 01:39:32 +0000 Subject: [PATCH 4/4] =?UTF-8?q?Mise=20=C3=A0=20jour=20de=20'flask=5Fbase/a?= =?UTF-8?q?pp.py'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- flask_base/app.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/flask_base/app.py b/flask_base/app.py index 79ab7f0..8ff22c0 100644 --- a/flask_base/app.py +++ b/flask_base/app.py @@ -41,6 +41,12 @@ def show_questions(): with open('./data/quizz.json', 'r') as file: questions = json.load(file) return render_template('quiz.html', questions=questions) + +@app.route('/softwares_data') +def show_questions(): + with open('./data/softwares.json', 'r') as file: + softwares = json.load(file) + return render_template('pokemon.html', data=softwares) if __name__ == '__main__': app.run(debug=True, port=8080)