12-09-2021 13:21
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

12-09-2021 13:21
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
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.

Accepted Solutions
12-09-2021 13:34
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


12-09-2021 13:34
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
distance should work equivalently to steps. Check your code carefully.
Gondwana Software
12-09-2021 13:34
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


12-09-2021 13:34
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
distance should work equivalently to steps. Check your code carefully.
Gondwana Software
12-14-2021 11:33
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

12-14-2021 11:33
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
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";
}
