add: data

This commit is contained in:
2025-09-08 08:24:49 +02:00
parent 66ded84720
commit f5f04ec782
2 changed files with 118 additions and 1 deletions

View File

@ -43,7 +43,9 @@ def record():
@app.route("/", methods = ['GET']) @app.route("/", methods = ['GET'])
def normal(): def normal():
return render_template('home.html', longer = record(), dates = wrap(values, 10), total = len(values.split(' ')), days = (datetime.datetime.today().date() - datetime.datetime.strptime(values.split(' ')[-1], "%Y-%m-%d").date()).days) return render_template('home.html', longer = record(), dates = wrap(values, 10), total = len(values.split(' ')), days = (datetime.datetime.today().date() - datetime.datetime.strptime(values.split(' ')[-1], "%Y-%m-%d").date()).days)
@app.route("/data", methods = ['GET'])
def data():
return render_template('data.html')
if __name__ == '__main__': if __name__ == '__main__':
app.run(host='0.0.0.0', port=5000, debug=1) app.run(host='0.0.0.0', port=5000, debug=1)

115
templates/data.html Normal file
View File

@ -0,0 +1,115 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<title>CA42 - Compteur</title>
<link href="https://fonts.googleapis.com/css2?family=Aldrich&family=Roboto&family=Teko&display=swap" rel="stylesheet">
<style>
body {
font-family: 'Roboto', Helvetica, Arial, sans-serif;
font-weight: 400;
}
h1, h2 {
text-transform: uppercase;
}
header {
min-height: 100px;
background: #29AC51;
color: #fff;
text-align: center;
}
header h1 {
padding: 30px;
margin: auto;
font-size: 50px;
}
#desc {
max-width: 550px;
text-align: center;
margin: auto;
padding: 10px 0 15px 0;
}
#counter {
max-width: 500px;
margin: auto;
padding: 10px 0 20px 0;
text-align: center;
}
h2 {
font-size: 50px;
font-family: 'Roboto', Helvetica, Arial, sans-serif;
}
#days {
font-family: 'Aldrich', sans-serif;
font-size: 55px;
padding: 10px 0 50px 0;
color: red;
}
#record {
font-family: 'Teko', sans-serif;
font-size: 30px;
}
#incident-btn {
padding: 35px 45px;
max-width: 150px;
text-align: center;
margin: auto;
color: #fff;
text-transform: uppercase;
font-size: 30px;
background: #B00000;
border-bottom: solid #A20000 4px;
cursor: pointer;
user-select: none;
}
#incident-btn:hover {
background-color: #ff0000;
}
.btn-text {
text-align: center;
padding-top: 15px;
}
</style>
</head>
<body>
<header>
<h1>ca42</h1>
</header>
<div id="desc">
<p>
Data sur les incidents enregistrés
</p>
</div>
<div id="counter">
<h2>Année avec le plus d'incident:</h2>
<p id="days">{{days}}</p>
<div>
<p id="last-incident"></p>
</div>
<div>
<p id="record">
Nombre total de problèmes : {{total}}<br>
Record de jours sans problèmes: {{longer}}
</p>
</div>
</div>
</body>
</html>