Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Distance goal reached issue

ANSWERED

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:

 

 

Spoiler

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!

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

distance should work equivalently to steps. Check your code carefully.

Peter McLennan
Gondwana Software

View best answer in original post

Best Answer
2 REPLIES 2

distance should work equivalently to steps. Check your code carefully.

Peter McLennan
Gondwana Software
Best Answer

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";

}

Best Answer