Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workout display error when speeds are zero #407

Closed
dkm opened this issue Jul 25, 2023 · 10 comments
Closed

Workout display error when speeds are zero #407

dkm opened this issue Jul 25, 2023 · 10 comments
Labels
api bug client v0.7.x Issues planned in versions 0.7.x
Projects

Comments

@dkm
Copy link
Contributor

dkm commented Jul 25, 2023

I've been importing ~600+ workouts, and apart from little changes, it nearly worked correctly.

But I'm unable to display some of these and am left with a nearly empty page:
image

The console gives:

[Vue warn]: Unhandled error during execution of scheduler flush. This is likely a Vue internals bug. Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/core 
  at <Distance distance=null unitFrom="km" speed=true  ... > 
  at <WorkoutData workoutObject= 
Object { ascent: 0, aveSpeed: null, distance: 0.001, descent: 0, duration: "0:20:00", maxAlt: null, maxSpeed: null, minAlt: null, moving: "0:20:00", nextUrl: "/workouts/hjspVktzTUBguKcv3VoFiL", … }
 useImperialUnits=false displayHARecord=true > 
  at <Card> 
  at <Index workoutData= 
Object { gpx: "", loading: false, workout: {…}, chartData: [] }
 sports= 
Array(15) [ {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, … ]
 authUser= 
Object { accepted_privacy_policy: true, admin: true, bio: null, birth_date: null, created_at: "Mon, 24 Jul 2023 18:57:22 GMT", date_format: "MM/dd/yyyy", display_ascent: true, email: "dkm@kataplop.net", email_to_confirm: null, first_name: null, … }
  ... > 
  at <Workout displaySegment=false onVnodeUnmounted=fn<onVnodeUnmounted> ref=Ref< 
Proxy { <target>: Proxy, <handler>: {…} }
 > > 
  at <RouterView key=0 > 
  at <App> [runtime-core.esm-bundler.js:40](webpack://fittrackee_client/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js?d2dd)
Uncaught (in promise) TypeError: distance.value is null
    convertedDistance Distance.vue:49
    run reactivity.esm-bundler.js:190
    get value reactivity.esm-bundler.js:1171
    unref reactivity.esm-bundler.js:1074
    get reactivity.esm-bundler.js:1077

It looks like the distance is null at some point, but I can see it is 0.001. Is it possible the 0.001, while being a valid float, is too low and got the routines that convert it to produce invalid result? I'm using 0.001 for importing "workouts" that have no GPX files and for which I don't have all the data (except for the duration) as 0 is not valid.

I'm up to date wrt the dev branch (e3bb7e5).

The only local change (used to accommodate larger notes than 500 chars) I have is:

diff --git a/fittrackee/migrations/versions/16_4e8597c50064_rename_activity_with_workout.py b/fittrackee/migrations/versions/16_4e8597c50064_rename_activity_with_workout.py
index bb421be8..3ee1c741 100644
--- a/fittrackee/migrations/versions/16_4e8597c50064_rename_activity_with_workout.py
+++ b/fittrackee/migrations/versions/16_4e8597c50064_rename_activity_with_workout.py
@@ -59,7 +59,7 @@ def upgrade():
         sa.Column('map_id', sa.String(length=50), nullable=True),
         sa.Column('weather_start', sa.JSON(), nullable=True),
         sa.Column('weather_end', sa.JSON(), nullable=True),
-        sa.Column('notes', sa.String(length=500), nullable=True),
+        sa.Column('notes', sa.TEXT(), nullable=True),
         sa.ForeignKeyConstraint(['sport_id'], ['sports.id'], ),
         sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
         sa.PrimaryKeyConstraint('id'),

I've tried to use the debugger but maybe you'll have a better idea of what is going on as web dev is not really my domain...

@SamR1
Copy link
Owner

SamR1 commented Jul 26, 2023

Hi,

Thanks for the bug report.
I'll take a look at the Distance component to better handle this error first (and try to reproduce the same error).

@dkm
Copy link
Contributor Author

dkm commented Jul 26, 2023

Ok thanks for your help. Let me know if I can help. I can probably provide you with the data for the problematic workout.

@SamR1
Copy link
Owner

SamR1 commented Jul 26, 2023

yes, can you provide an example that generates this error? Thanks in advance.

I think the error is due to speeds (Distance component is also used to display speed, I should maybe rename it).
In console log, aveSpeed and maxSpeed are null.

@dkm
Copy link
Contributor Author

dkm commented Jul 26, 2023

Here are the various fields for a GPX less workout (the "notes" field is probably not important)

--sport Paragliding
--ascent 0.0 
--descent 0.0 
--duration 1200 
--distance 0.001
--date "2020-08-06 00:00"
--title "Saint Hilaire - Déco Sud - Vol local"
--notes "some very long text that won't fit in VARCHAR(250) but it's probably not the root cause anyway"

@SamR1
Copy link
Owner

SamR1 commented Jul 26, 2023

thanks!

I reproduce the same error when adding a workout without gpx file and with the same values.
After a fix on API side, it returns 0.00 km/h for average and max speeds (the calculated value is 0.003 km/h, but in database only 2 digits are stored):

fittrackee=> SELECT distance, duration, ascent, descent, ave_speed, max_speed FROM workouts WHERE id = 4;
 distance | duration | ascent | descent | ave_speed | max_speed 
----------+----------+--------+---------+-----------+-----------
    0.001 | 00:20:00 |  0.000 |   0.000 |      0.00 |      0.00
(1 ligne)

just a question: in the example the distance is 0.001km (1m). Unless I'm mistaken, the value seems very low. Is this value correct?

@dkm
Copy link
Contributor Author

dkm commented Jul 27, 2023

As said above, I'm using the smallest value possible as a workaround for being forced to use a non-zero one. When doing paragliding, you really only count the distance when doing cross-country flights. Anything else (hike and fly, acro, ...), you're not counting. So that's me trying to use fittrackee as a flightlog.

@SamR1
Copy link
Owner

SamR1 commented Jul 29, 2023

OK, thanks for the explanation .

@SamR1
Copy link
Owner

SamR1 commented Jul 29, 2023

With the fix, the workout will be displayed as follows (FitTrackee is not really designed to handle workouts without distance):

Screenshot 2023-07-29 at 11-30-16 FitTrackee - Workout

Just for information, ascent and descent are not mandatory when adding a workout without a gpx file.

@SamR1 SamR1 added bug api client v0.7.x Issues planned in versions 0.7.x labels Jul 29, 2023
@SamR1 SamR1 added this to the v0.7 - OAuth 2.0 milestone Jul 29, 2023
@SamR1 SamR1 added this to Done in v0.7.x Jul 29, 2023
@dkm
Copy link
Contributor Author

dkm commented Jul 29, 2023 via email

@SamR1 SamR1 changed the title Error in frontend Workout display error when speeds are zero Jul 30, 2023
@SamR1
Copy link
Owner

SamR1 commented Jul 30, 2023

released in v0.7.21

@SamR1 SamR1 closed this as completed Jul 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api bug client v0.7.x Issues planned in versions 0.7.x
Projects
No open projects
Development

No branches or pull requests

2 participants