QuantumPhysique / trale

trale – a simple body weight diary app respecting your privacy
GNU Affero General Public License v3.0
60 stars 8 forks source link

Wrong calculation toward Target Weight #93

Open theAkito opened 1 month ago

theAkito commented 1 month ago

Describe the bug The calculation of how many days are needed to reach target weight based on previous data is wrong, if the user sets a weight of for example 66.6 yesterday and today 66.7.

To Reproduce Steps to reproduce the behavior:

  1. Set historical data, from past six months. Historic data is sporadic and not daily.
  2. Notice correct days left calculation.
  3. Set yesterday's weight to 66.6.
  4. Set today's weight to 66.7.
  5. See calculation being completely wrong, saying for example, target weight will never be reached.

Expected behavior Calculations should stay correct, even if providing daily data.

User Information:

Additional context I didn't have the opportunity to double check and definitely reproduce that it works in a faulty way with any number. Maybe it only happens in certain number ranges. I don't have time to check now.

braniii commented 4 weeks ago

Hi @theAkito, thank you for taking the time of opening an issue report :) However, I am not sure if I understand the bug correctly. What is the correct calculation you are expecting? And which interpolation strength are you using?

theAkito commented 4 weeks ago

What is the correct calculation you are expecting?

If historic, nevertheless sporadic, data clearly shows a trend of, for example, losing weight, which the app reflects correctly, but then data for yesterday, for example, 66.6 and data today, for example 66.7, is added, the app shouldn't put 100% weight into the last two data points, but rather keep calculating based on all historic data.

This means, that just because there was a jump by 0.1 from yesterday to today, the app shouldn't tell the user, that the goal of, in this example, losing weight will never be reached, as based on historic data, this 0.1 gain is negligible and irrelevant, based on long-term data.

To be even more precise: the app shouldn't show negative weight loss, just because of 2 data points, when historic data shows, that weight is positively lost, in the long term.

And which interpolation strength are you using?

I am not sure, what you are referring to.

braniii commented 4 weeks ago

signal-2024-06-05-19-09-16-821.jpg

I guess this should be handled by the interpolation strength, so the number of days considered for estimating the smoothed curve and therewith estimating the slope. Did you try if setting a stronger interpolation strength (see image) helps?