summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/routes/api.py12
-rw-r--r--app/static/js/chart.js21
-rw-r--r--app/templates/progress/exercise.html24
3 files changed, 56 insertions, 1 deletions
diff --git a/app/routes/api.py b/app/routes/api.py
index 2373fa3..6a95ca2 100644
--- a/app/routes/api.py
+++ b/app/routes/api.py
@@ -1,5 +1,5 @@
from app import app, db
-from flask import redirect, request
+from flask import redirect, request, jsonify
from flask_login import current_user, login_required
from tables import Workout
@@ -18,3 +18,13 @@ def api_workout_delete():
db.session.commit()
return redirect("/home")
+
+
+@app.route("/api/progress/exercise", methods=["GET"])
+@login_required
+def api_progress_exercise():
+ if "id" not in request.args:
+ return redirect("/home")
+
+ # FIXME
+ return jsonify()
diff --git a/app/static/js/chart.js b/app/static/js/chart.js
new file mode 100644
index 0000000..d72d415
--- /dev/null
+++ b/app/static/js/chart.js
@@ -0,0 +1,21 @@
+
+function fillChart(id) {
+ const ctx = document.getElementById(id)
+ new Chart(document.getElementById('exercise_chart'), {
+ type: 'line',
+ data: {
+ cubicInterpolationMode: 'monotone',
+ tension: 0.4,
+ pointStyle: 'circle',
+ pointRadius: 5,
+ pointHoverRadius: 10,
+ },
+ option: {
+ scales: {
+ y: {
+ beginAtZero: true
+ }
+ }
+ }
+ });
+}
diff --git a/app/templates/progress/exercise.html b/app/templates/progress/exercise.html
index 20f7c9f..51149fc 100644
--- a/app/templates/progress/exercise.html
+++ b/app/templates/progress/exercise.html
@@ -6,7 +6,31 @@
<div class="container">
<div class="columns is-centered">
<div class="column">
+ <div class="box">
+ <canvas id="exercise_chart"></canvas>
+ </div>
</div>
</div>
</div>
+
+<script>
+ new Chart(document.getElementById('exercise_chart'), {
+ type: 'line',
+ data: {
+ cubicInterpolationMode: 'monotone',
+ tension: 0.4,
+ pointStyle: 'circle',
+ pointRadius: 5,
+ pointHoverRadius: 10,
+ },
+ option: {
+ scales: {
+ y: {
+ beginAtZero: true
+ }
+ }
+ }
+ });
+</script>
+
{% endblock %}