I go to Challengs and enter in any challenge (ex: October Ride to 400) and no value are show:
this is happening in Safari and Chrome, and in challenges like October rundown,
I go to Challengs and enter in any challenge (ex: October Ride to 400) and no value are show:
this is happening in Safari and Chrome, and in challenges like October rundown,
Your challenges display correct number, because you are using decimal point separator.
Yes, that's a workaround. Change Number Format in Settings.
But rounding function on Connect website is just…
Yes, challenges with distance units, like KM, show 0.
Only steps challenges show correct number.
Values can be read from JSON:
October Ride to 400:
https://connect.garmin.com/modern/proxy/badgechallenge…
Did that, and the error persists. I looked at the Inspect/Console and it gives me a bunch of errors
Apart from that string problem,
I was curious if that algorithm with separated rounding do something better in a matter of a result value.
So I made a test loop to check random numbers in both functions.
It compares: o.a.roundDecimal(num, true) - with - Math.ceil(nums*10)/10
and: o.a.roundDecimal(num, false) - with - Math.floor(nums*10)/10
and as a reference: Math.round(nume*10)/10
There is if() check to show only not matching results, to show all it can be removed.
It can be run in console when rounding function from the website is loaded.
Then just enter: test(20, 100) (repeat count, max number).
test = function(repeat=1, max_num=10) { var toNum = function(str_num) { return parseFloat(str_num.slice(0,-2).replace(/[,\.]/g,'') + '.' + str_num.slice(-1)); }; var num, nume, nums, i, n0, n1, n2, n3, n4; for(i=0; i<repeat; i++) { num = Math.random()*max_num; nume = num+Number.EPSILON; nums = Math.round(nume*100)/100; n0 = Math.round(nume*10)/10; n1 = o.a.roundDecimal(num, true); n2 = Math.ceil(nums*10)/10; n3 = o.a.roundDecimal(num, false); n4 = Math.floor(nums*10)/10; if(toNum(n1)!==n2 || toNum(n3)!==n4) { console.dir('rand:', num, 'round:', n0); console.dir('rDceil:', n1, 'ceil:', n2); console.dir('rDfloor:', n3, 'floor:', n4); } } }
And if I checked correctly, there is no difference in results.
So I would just use those build-in Math functions.