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

fix (#62): tool's trim/conceal negative distance #70

Merged
merged 6 commits into from
Dec 10, 2023
Merged

Conversation

muktihari
Copy link
Member

@muktihari muktihari commented Dec 5, 2023

fix #62

image

@muktihari muktihari added the bug Something isn't working label Dec 5, 2023
@muktihari muktihari self-assigned this Dec 5, 2023
Copy link
Member

@raditzlawliet raditzlawliet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, but there's another issue (i put here before create an issue is it relate with this or not)

@raditzlawliet raditzlawliet self-requested a review December 7, 2023 07:47
@raditzlawliet
Copy link
Member

raditzlawliet commented Dec 7, 2023

Oh wait, I try using one Mat..Loop.fit having 0.01 at start (i think you also already have this file)
image

My personal fit looks good, no problem for now

@muktihari
Copy link
Member Author

lgtm, but there's another issue (i put here before create an issue is it relate with this or not)

how can this be reproduce? Is this issue persist after refreshing the browser-tab? i tried in my local but it seems fine.

issue-62.mov

Oh wait, I try using one Mat..Loop.fit having 0.01 at start (i think you also already have this file)

Ah right, I will push the update after this

@muktihari
Copy link
Member Author

Open Morning_Run.fit > Try to edit > Trim > error

I think I know the cause, before we point to the problem, let me explain the full context:
In Session, there are Fields: start_time and total_elapsed_time, these fields are used to group which record is belong to this session. From these fields, we get EndTime = start_time + total_elapsed_time, so any record.Timestamp between StartTime and EndTime will be included in this session.

However, how total_elapsed_time in fit files retrieved from Strava is not calculated as we expected, example:

  • Session: start_time: "1056157392", total_elapsed_time: "2866.0", we get EndTime = 1056160258. We expect the last record will have timestamp "1056160258", but we got one record that has "1056160259", so there is one record that's not included in the session. And for records that not included in session, we create new session to accommodate that record (this to accommodate truncated fit files). But I forgot to add ses.Records = result.Records that's why ses.Records is null and throw error in JS (there should be no session that has no records).
@@ -144,6 +144,7 @@ func (s *service) convertListenerResultToActivity(result *ListenerResult) *activ
 
                ses := activity.NewSessionFromLaps(laps, sport)
                ses.Laps = laps
+               ses.Records = result.Records
 
                act.Sessions = append(act.Sessions, ses)
        }

I will fix the error by adding the code above, however we still have problem how to handle the anomaly from fit files retrieved from Strava.

@raditzlawliet
Copy link
Member

how can this be reproduce? Is this issue persist after refreshing the browser-tab? i tried in my local but it seems fine.

It's continues without refresh after open.

  • Open Morning_Ride.fit > Try to edit > Select Trim (But no action)
  • (Without refreshing the browser) > Open Morning_Run.fit > Try to edit > Select Trim > Error

@raditzlawliet
Copy link
Member

Open Morning_Run.fit > Try to edit > Trim > error

I think I know the cause, before we point to the problem, let me explain the full context: In Session, there are Fields: start_time and total_elapsed_time, these fields are used to group which record is belong to this session. From these fields, we get EndTime = start_time + total_elapsed_time, so any record.Timestamp between StartTime and EndTime will be included in this session.

However, how total_elapsed_time in fit files retrieved from Strava is not calculated as we expected, example:

  • Session: start_time: "1056157392", total_elapsed_time: "2866.0", we get EndTime = 1056160258. We expect the last record will have timestamp "1056160258", but we got one record that has "1056160259", so there is one record that's not included in the session. And for records that not included in session, we create new session to accommodate that record (this to accommodate truncated fit files). But I forgot to add ses.Records = result.Records that's why ses.Records is null and throw error in JS (there should be no session that has no records).
@@ -144,6 +144,7 @@ func (s *service) convertListenerResultToActivity(result *ListenerResult) *activ
 
                ses := activity.NewSessionFromLaps(laps, sport)
                ses.Laps = laps
+               ses.Records = result.Records
 
                act.Sessions = append(act.Sessions, ses)
        }

I will fix the error by adding the code above, however we still have problem how to handle the anomaly from fit files retrieved from Strava.

Since it's anomaly and rare case, i think we can low prio on this case,
but let take a note (so later we can deal with this)

@muktihari
Copy link
Member Author

Since it's anomaly and rare case, i think we can low prio on this case,
but let take a note (so later we can deal with this)

The anomaly is for all FIT files from Strava, so I think we need to do something about it but just a quick hack is enough.
I just push the quick hack for it, if it doesn't catch the anomaly more that the threshold that I set, so be it, we should not accommodate poorly encoded files more than our threshold.

@muktihari
Copy link
Member Author

muktihari commented Dec 10, 2023

This PR is ready to be reviewed again.

Note: please rebuild the WASM before testing.

@raditzlawliet
Copy link
Member

Since it's anomaly and rare case, i think we can low prio on this case,
but let take a note (so later we can deal with this)

The anomaly is for all FIT files from Strava, so I think we need to do something about it but just a quick hack is enough. I just push the quick hack for it, if it doesn't catch the anomaly more that the threshold that I set, so be it, we should not accommodate poorly encoded files more than our threshold.

all ? 🤔 okay, let's do quick hack for now.

@muktihari
Copy link
Member Author

all ? 🤔 okay, let's do quick hack for now.

In few files that I retrieve from Strava: yes, the files that written by Strava when we do Record activity directly from the app (not what we upload from xoss or bryton for example). We can retrieve it by go to Strava web -> open activity -> Export Original.

I notice other irregular fit procotol messages being written as well, but since this not affecting our app directly we can ignore.

@muktihari muktihari merged commit 3b1e816 into dev Dec 10, 2023
1 check passed
@muktihari muktihari deleted the fix/issue-62 branch December 10, 2023 15:14
@raditzlawliet
Copy link
Member

raditzlawliet commented Dec 10, 2023

Oh wait, I try using one Mat..Loop.fit having 0.01 at start (i think you also already have this file)

This issue is solved on latest,

It's continues without refresh after open.
Open Morning_Ride.fit > Try to edit > Select Trim (But no action)
(Without refreshing the browser) > Open Morning_Run.fit > Try to edit > Select Trim > Error

While this still occur

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Minor bug on tools slider got negative value
2 participants