Spaces:
Sleeping
Sleeping
Emily Witko
commited on
Commit
•
f225fc0
1
Parent(s):
b22cd9e
Add application file
Browse files
app.py
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from flask import Flask, render_template, request, redirect, url_for
|
2 |
+
|
3 |
+
app = Flask(__name__)
|
4 |
+
|
5 |
+
# Dummy data for the sake of simplicity
|
6 |
+
# In a real application, you might store this in a database
|
7 |
+
exercises = ["Exercise 1", "Exercise 2", "Exercise 3", "Exercise 4", "Exercise 5", "Exercise 6", "Exercise 7", "Exercise 8"]
|
8 |
+
exercise_counts = {exercise: 0 for exercise in exercises}
|
9 |
+
total_exercises_completed = 0
|
10 |
+
days_completed = 0
|
11 |
+
|
12 |
+
@app.route('/')
|
13 |
+
def home():
|
14 |
+
return render_template('index.html', exercises=exercise_counts, total_exercises_completed=total_exercises_completed, days_completed=days_completed)
|
15 |
+
|
16 |
+
@app.route('/reset', methods=['POST'])
|
17 |
+
def reset():
|
18 |
+
global total_exercises_completed, days_completed
|
19 |
+
all_completed = all(count >= 6 for count in exercise_counts.values())
|
20 |
+
if all_completed:
|
21 |
+
days_completed += 1
|
22 |
+
for exercise in exercises:
|
23 |
+
exercise_counts[exercise] = 0
|
24 |
+
return redirect(url_for('home'))
|
25 |
+
|
26 |
+
if __name__ == '__main__':
|
27 |
+
app.run(debug=True)
|