06-20-2022 11:52
06-20-2022 11:52
I am coding a clockface. I just run into a problem with the new way of writing the active zone minute.
Now this should have a total. (see screenshots). How can I best solve this without having to recode everything.
this is my code:
let dataTypes = [ "steps", "distance", "calories", "activeZoneMinutes"];
// Refresh data, all other logic is in separate files
function refreshData(type) {
let currentType = type.dataType;
let currentDataProg = (userActivity.today.adjusted[currentType] || 0);
let currentDataGoal = userActivity.goals[currentType];
let currentDataArc = (currentDataProg / currentDataGoal) * 360;
if (currentDataArc > 360) {
currentDataArc = 360;
}
if(currentType==="distance") {
currentDataProg = (currentDataProg * 0.000621371192).toFixed(2);
}
type.arcFront.sweepAngle = currentDataArc;
type.dataCount.text = currentDataProg;
}
06-20-2022 22:01
06-20-2022 22:01
Hi @RobbeVanhu - you'll have to put a conditional test in your routine for active zone minutes to retrieve its value.
Author | ch, passion for improvement.