summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorstilbruch <stilbruch@protonmail.com>2022-04-30 15:33:54 -0500
committerstilbruch <stilbruch@protonmail.com>2022-04-30 15:33:54 -0500
commitc3badffbc3e3012477831868f72e35bd6cc1fe62 (patch)
tree764ba8c8f0f408027dd910af683fd9195da58dd3 /app
parentf093b46d5ba76faa66a43c95c22f9240f8870902 (diff)
downloadStrengthy-c3badffbc3e3012477831868f72e35bd6cc1fe62.tar.xz
Strengthy-c3badffbc3e3012477831868f72e35bd6cc1fe62.zip
Finally figured out /workout/record was missing rows
Diffstat (limited to 'app')
-rw-r--r--app/routes/workout.py2
-rw-r--r--app/static/js/record.js6
-rw-r--r--app/templates/base/form.html2
3 files changed, 7 insertions, 3 deletions
diff --git a/app/routes/workout.py b/app/routes/workout.py
index 1d46aed..c8adc4e 100644
--- a/app/routes/workout.py
+++ b/app/routes/workout.py
@@ -114,13 +114,13 @@ def workout_record():
# Interate over form exercise entries
for ee in form.exercises.entries:
+
id = ee.data["id"]
# And over that exercise's sets
for se in ee.sets.entries:
lbs = se.data["lbs"]
units = se.data["units"]
- print(id, lbs, units)
if lbs and units:
# Add the set to the workout record
diff --git a/app/static/js/record.js b/app/static/js/record.js
index 6e0f924..3037c2f 100644
--- a/app/static/js/record.js
+++ b/app/static/js/record.js
@@ -3,8 +3,12 @@ allInputs = Array.from(document.getElementsByClassName('input'))
.filter(e => e.type == 'number');
allInputs.forEach(e => e.addEventListener('keydown', handleEnterKey));
+// Register onsubmit handler for form
+document.getElementById("form").addEventListener('submit', (el) => {
+ Array.from(event.target.getElementsByTagName('input')).forEach(i => i.disabled = false);
+});
+
function handleEnterKey(event) {
- console.log(event);
if (event.key === "Enter" || event.key === "Tab") {
event.preventDefault();
diff --git a/app/templates/base/form.html b/app/templates/base/form.html
index 98200c9..aff7227 100644
--- a/app/templates/base/form.html
+++ b/app/templates/base/form.html
@@ -21,7 +21,7 @@
{% endif %}
{% endwith %}
- <form method="POST" class="box">
+ <form method="POST" class="box" id="form">
{{ form.csrf_token }}
{% block form %}{% endblock %}
</form>