WeatherXM / -DEPRECATED-issue-tracker

[DEPRECATED] The old Issue Tracker for WeatherXM beta testers.
16 stars 1 forks source link

7D and 30D reward totals are slightly off #145

Closed Greg15 closed 2 years ago

Greg15 commented 2 years ago

WeatherXM Related Element

Please pick one of the following WeatherXM elements that are applicable for this bug:

Describe the bug

In the app, the 7D and 30D reward totals are off. They do NOT equal round(sum(rewardTransactions),2) They also do NOT equal sum(round(rewardTransactions,2))

During the last 30 days, 2 days had double rewards. Even when considering double transaction variations, the values don't equal either of the above formulas, even when first applying the rounding per transaction or per day, or per 7D/30D total at the end.

Even using ceil() or floor() at any step of the process, I cannot derive the values shown.

The amounts in the app are slightly higher than any of those methods, and are inaccurate.

For the station in question (Recumbent Tangelo Weather), it has a reward scale of 1 for all days of the last 30D.

The analysis was done as of today, 19 October 2022, and Rewards have already been sent today.

30 DAYS:

30D reward total in app = 342.34

During those last 30 Days, 2 of those days had double rewards, so I show the info both by day and by transaction:

BY DAYS: Days, rounded rewards, actual rewards 4 days, 10.68, 10.679535232383808 1 day, 10.69, 10.69155722326454 23 days, 10.70, 10.69557057057057 2 days (double rewards), 21.39, 21.39114114114114

4 10.68 + 1 10.69 + 23 10.70 + 2 21.39= 342.29

' 4 10.679535232383808 ' + 1 10.69155722326454 ' + 23 10.69557057057057 ' + 2 21.39114114114114 ' = 342.190103558205162

Round(342.190103558205162) = 342.19

BY TRANSACTIONS: Transactions, rounded rewards, actual rewards 4 transactions, 10.68, 10.679535232383808 1 transaction, 10.69, 10.69155722326454 27 transactions, 10.70, 10.69557057057057

4 10.68 + 1 10.69 + 27 * 10.7 = 342.31

' 4 10.679535232383808 ' + 1 10.69155722326454 ' + 27 * 10.69557057057057 ' = 342.190103558205162

Round(342.190103558205162) = 342.19

Even an extreme example: ' 4 ceil(10.679535232383808,2) ' + 1 ceil(10.69155722326454,2) ' + 27 ceil(10.69557057057057,2) ' = ' 4 10.68 ' + 1 10.70 ' + 27 10.70 ' = 342.32

30D total in app (342.34) is higher than all of these, and is incorrect.

7 DAYS: The double transaction days are not part of the 7 day window, so by-day and by-transaction are the same: Count, rounded rewards, actual rewards 7 days/transactions, 10.70, 10.69557057057057

7 day reward total in app = 74.91

7 * 10.70 = 74.90

7 * 10.69557057057057 = 74.86899399399399

Even an extreme example:

7 ceil(10.69557057057057,2) = 7 10.7=74.90

7D total in app (74.91) is higher than all of these and is incorrect.

How To Reproduce

Steps to reproduce the behavior:

  1. Go to station details page. Observe rewards totals and compare to actual transactions and rounded transactions in detailed rewards history.

Expected behavior

Reward totals should be accurate. I believe it should add up all reward transactions and only then round to 2 decimal places: round(sum(rewardTransactions),2)

In this case, I would expect: 30D = 342.19 (compared to the 342.34 shown in app) 7D = 74.87 (compared to 74.91 shown in app)

Screenshots

Screenshot_20221019-085037.png

If Applicable: Smartphone (please complete the following information that are needed for this bug):

Additional context

I believe I have thoroughly checked this before for 7D and 30D, so I think this is a new or reintroduced issue. Something similar also existed in issue #43 for the ALL-TIME rewards total, but was resolved a long time ago.

When I add up all my ALL-time totals as shown in the app for each station in each account and compare to the rounded sum of what is in my testnet wallets, those numbers match, so this particular issue appears to only apply to 7D and 30D totals, although a separate issue #146 appears to exist for Total Rewards.

PavlosTze commented 2 years ago

@Greg15 This is a rounding issue we have, as mentioned here also at issue #107 . We plan to fix it in the future but it is a low priority UI bug at the moment.

Greg15 commented 2 years ago

Sorry. I didn't realize I had submitted basically the same thing before.