12-09-2021 13:21
12-09-2021 13:21
Hello,
I am trying to add a small icon only when DISTANCE goal is reached during a day.
I tried comparing today.adjusted.distance with goals.distance and goals.adjusted.distance, but none of them works.
I tested for steps and it's working using goals.steps, in the below code:
import { goals, today } from "user-activity";
let icon_steps = document.getElementById("icon_steps");
if (today.adjusted.steps >= goals.steps)
{
icon_steps.style.visibility = "visible";
}
else {
icon_steps .style.visibility = "hidden";
}
}
Can anyone help me?
Thank you!
Answered! Go to the Best Answer.
12-09-2021 13:34
12-09-2021 13:34
distance should work equivalently to steps. Check your code carefully.
12-09-2021 13:34
12-09-2021 13:34
distance should work equivalently to steps. Check your code carefully.
12-14-2021 11:33
12-14-2021 11:33
Yes. You are correct, Peter.
I used the below code and it's working. Thank for your help:
if (today.adjusted.distance >= goals.distance)
{
icon_distance.style.visibility = "visible";
}
else {
icon_distance.style.visibility = "hidden";
}