Start of the quizz on the backend

This commit is contained in:
2025-12-05 01:51:51 +01:00
parent 962e3e61f7
commit 0a8136dfb5
12 changed files with 20 additions and 29 deletions

View File

@@ -1,18 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Nuit de l'info tkt</title>
<link href="test.css" rel="stylesheet">
<link href="logo_n2i_color_moon.svg" rel="icon">
<script src="test.js"></script>
</head>
<body>
<a href="test.html"><img class="logo" src="logo_n2i_color_moon.svg"></a>
<h1 id="demo">Nuit de l'Info</h1>
<p>hello world!</p>
<a href="quiz.html"><button>useless button</button></a>
<a href="https://google.com"><button type = "button">Google</button></a>
</body>
</html>

View File

View File

@@ -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)

View File

@@ -1,10 +1 @@
[
{
"name": "Alice",
"score": 100
},
{
"name": "salut",
"score": 30
}
]
[]

View File

@@ -0,0 +1,12 @@
[
{
"question" : "coucou",
"nb" : 1,
"answer" : [
{
"answer" : "salut",
"nb" : 1
}
]
}
]

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB