Start of the quizz on the backend
This commit is contained in:
@@ -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>
|
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
from flask import Flask, jsonify, request
|
from flask import Flask, jsonify, request, render_template
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
|
||||||
@@ -36,6 +36,12 @@ def get_leaderboard():
|
|||||||
leaderboard_sorted = sorted(leaderboard, key=lambda x: x['score'], reverse=True)
|
leaderboard_sorted = sorted(leaderboard, key=lambda x: x['score'], reverse=True)
|
||||||
return jsonify({'leaderboard': leaderboard_sorted})
|
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__':
|
if __name__ == '__main__':
|
||||||
app.run(debug=True, port=8080)
|
app.run(debug=True, port=8080)
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1 @@
|
|||||||
[
|
[]
|
||||||
{
|
|
||||||
"name": "Alice",
|
|
||||||
"score": 100
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "salut",
|
|
||||||
"score": 30
|
|
||||||
}
|
|
||||||
]
|
|
||||||
12
flask_base/data/quizz.json
Normal file
12
flask_base/data/quizz.json
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"question" : "coucou",
|
||||||
|
"nb" : 1,
|
||||||
|
"answer" : [
|
||||||
|
{
|
||||||
|
"answer" : "salut",
|
||||||
|
"nb" : 1
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
Reference in New Issue
Block a user