This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

JavaScript bug when editing exercise sets and first set is a "REST" ?

I'm not the hottest JS coder, so excuse me if I am misunderstanding this, but when I sync a Strength activity that includes exercise sets where the first set is a REST (I think I did this because I paused the activity before actually starting), the web interface crashes (and so does the Android app);

In https://connect.garmin.com/web-react/static/js/backbone/models/activity/RepCountingActivity.js line 154 -

 getConsolidatedJSON: function() {
var allSets = this.get('exerciseSets'),
restTime = 0,
sets = [],
that = this;

_.each(allSets, function(set) {
if (set.setType === 'REST') {
if (!sets[sets.length - 1].rest) { <====== this is the error line
sets[sets.length - 1].rest = 0;
}

sets[sets.length - 1].rest += set.duration;
} else {
set.exerciseType = that.getExerciseType(set.exercises);
sets.push(set);
}
});

return sets;
},

Then, with this data set (truncated!):

{"activityId":4172875329,"exerciseSets":[{"exercises":[],"duration":4.416,"repetitionCount":null,"weight":null,"setType":"REST","startTime":"2019-10-19T12:46:29.0","wktStepIndex":null},{"exercises":[{"category":"UNKNOWN","name":null,"probability":99.609375},{"category":"CURL","name":null,"probability":0.0},{"category":"BENCH_PRESS","name":null,"probability":0.0}],"duration":26.901,"repetitionCount":20,"weight":39000.0,"setType":"ACTIVE","startTime":"2019-10-19T12:46:33.0","wktStepIndex":null},{"exercises":[],"duration":59.56,"repetitionCount":null,"weight":null,"setType":"REST","startTime":"2019-10-19T12:47:00.0","wktStepIndex":null},{"exercises":[{"category":"UNKNOWN","name":null,"probability":99.609375},{"category":"CURL","name":null,"probability":0.0},{"category":"BENCH_PRESS","name":null,"probability":0.0}],"duration":35.358,"repetitionCount":15,"weight":45000.0,"setType":"ACTIVE","startTime":"2019-10-19T12:47:59.0","wktStepIndex":null},

the when sets[] is empty, sets.length - 1 is < 0 and you get an error:

RepCountingActivity.js:154 Uncaught TypeError: Cannot read property 'rest' of undefined
at RepCountingActivity.js:154
at Function.v.each.v.forEach (underscore.js:153)
at r.getConsolidatedJSON (RepCountingActivity.js:152)
at renderSets (EditRepCountingActivityView.js:83)
at render (EditRepCountingActivityView.js:54)
at r.showRepCountingElements (EditActivityPageView.js:640)
at render (EditActivityPageView.js:507)
at r.<anonymous> (PageView.js:89)
at A (underscore.js:701)
at r.i [as render] (underscore.js:733)

Someone, assuming my JS is not completely mistaken (and it could be) needs to check for the empty set first.

When my activities don't start with a "REST" then all seems OK.

  • The way I create an activity with a Rest at the start is usually in a Multisport activity I change to Strength and then pause while I move around and get ready. I assume what happens (on the FR945) is that the watch then sees a change in the time after the resume and adds a non-empty Rest set to the start. This shows up in the watch as a set with dashes "--" "--" in the list of sets at the top.

    I think this is also whats making a number of my syncs fail with file corruption; The file isn't corrupt, the importer is probably also crashing out on not understanding an initial Rest set.

  • Just curious, does no one else see this problem?

    Does anyone from Garmin even see these, by any chance? (I have reported it via email, but not confirmation there either)

  • Hi, same problem here with Fenix 6x. Started with an abdomen exercise where hands are not moving so the rep count is "--" in the first set - or another time failed to start at the first set so I started / stopped at the second to have the correct set count. Then it failed to sync. Have latest 5.00 firmware but Garmin did not correct this error so far. So until they do we need to pay attention at the first set.

  • I'm having the same issue with Forerunner 245. 

  • I'm having the same issue with Forerunner 245.