From d2c0dcf06d632389d2c451b1d9d37735291d7e62 Mon Sep 17 00:00:00 2001 From: stilbruch Date: Mon, 16 May 2022 15:03:48 -0500 Subject: Fix record.js checking bug --- .gitignore | 1 + app/static/js/record.js | 2 +- app/templates/workout/record.html | 2 +- tools/excel_import.py | 3 +++ 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index c7e9428..ff893bb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ __pycache__/ *.db +*.bak *.xlsx diff --git a/app/static/js/record.js b/app/static/js/record.js index a855ea4..2e99766 100644 --- a/app/static/js/record.js +++ b/app/static/js/record.js @@ -236,7 +236,7 @@ function onKeyDown(event) { if (!targetNode.parentElement.parentElement.isEqualNode(currentNode.parentElement.parentElement)) { // going to new row - if (currentNode.value != "" && allInputs[currentIndex - 1].value && allINputs[currentIndex - 1] != "") { + if (currentNode.value != "" && allInputs[currentIndex - 1].value && allInputs[currentIndex - 1] != "") { onClickSetCheck(currentNode.parentElement.parentElement.children[3].children[0]); } } diff --git a/app/templates/workout/record.html b/app/templates/workout/record.html index 53b2788..1cfeda1 100644 --- a/app/templates/workout/record.html +++ b/app/templates/workout/record.html @@ -42,7 +42,7 @@ {% else %} - {{ set['lbs'](class_='input', onkeydown='onKeyDown(event)') }} + {{ set['lbs'](class_='input', type='number', onkeydown='onKeyDown(event)') }} {{ set['units'](class_='input', onkeydown='onKeyDown(event)') }} {% endif %} diff --git a/tools/excel_import.py b/tools/excel_import.py index 680c2fa..49e25ba 100755 --- a/tools/excel_import.py +++ b/tools/excel_import.py @@ -64,6 +64,9 @@ exercise_ids = {} def insert_workout(cur, workout): + if len(workout["sets"]) == 0: + return + cur.execute( "INSERT INTO workout_records(finished, user_id, workout_id) VALUES (?, ?, ?)", ( -- cgit v1.2.3