Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use same rounding logic between Rewards panels and Ads panel #20128

Closed
dodieboy opened this issue Dec 16, 2021 · 2 comments · Fixed by brave/brave-core#11828
Closed

Use same rounding logic between Rewards panels and Ads panel #20128

dodieboy opened this issue Dec 16, 2021 · 2 comments · Fixed by brave/brave-core#11828

Comments

@dodieboy
Copy link

Description

The estimated earning found earning found in brave://rewards/ show to different value. Most likely cause by the different rounding off method use

Actual result:

image

Reproduces how often:

Easily reproduced

Brave version (brave://version info)

Brave | 1.33.106 Chromium: 96.0.4664.110 (Official Build) (64-bit)
Revision | d5ef0e8214bc14c9b5bbf69a1515e431394c62a6-refs/branch-heads/4664@{#1283}
OS | Windows 10 Version 21H2 (Build 19044.1348)

@zenparsing zenparsing self-assigned this Dec 22, 2021
@zenparsing zenparsing added the priority/P3 The next thing for us to work on. It'll ride the trains. label Dec 22, 2021
@Miyayes Miyayes changed the title Incorrect estimated brave reward current earnings Use same rounding logic between Rewards panels and Ads panel Dec 29, 2021
@Miyayes Miyayes added polish Nice to have — usually related to front-end/visual tasks and removed polish Nice to have — usually related to front-end/visual tasks labels Dec 29, 2021
@zenparsing
Copy link

Note that floating point rounding can differ between Intl.NumberFormat and Number.prototype.toFixed. (See examples at here.)

@stephendonner
Copy link

stephendonner commented Jan 19, 2022

Verified PASSED using

Brave 1.36.47 Chromium: 97.0.4692.71 (Official Build) nightly (x86_64)
Revision adefa7837d02a07a604c1e6eff0b3a09422ab88d-refs/branch-heads/4692@{#1247}
OS macOS Version 11.6.1 (Build 20G224)

Steps:

  1. new profile
  2. clicked on Skip welcome tour
  3. clicked on Start using Rewards
  4. changed 5 ads per hour to 10 ads per hour on brave://rewards/
  5. waited for 1st ad
  6. opened brave://rewards
  7. checked that the Current earnings this month (estimated) and Estimated Earnings match up
  8. repeated steps 5-7 for ads 2-15

Confirmed that both estimated earnings numbers matched and are rounded

1 2 3 4 5 6 7 8
Screen Shot 2022-01-19 at 12 13 06 PM Screen Shot 2022-01-19 at 12 19 32 PM Screen Shot 2022-01-19 at 12 20 06 PM Screen Shot 2022-01-19 at 12 20 42 PM Screen Shot 2022-01-19 at 12 25 44 PM Screen Shot 2022-01-19 at 12 33 09 PM Screen Shot 2022-01-19 at 12 39 31 PM Screen Shot 2022-01-19 at 12 48 12 PM
9 10 11 12 13 14 15
Screen Shot 2022-01-19 at 12 54 25 PM Screen Shot 2022-01-19 at 1 01 22 PM Screen Shot 2022-01-19 at 1 16 57 PM Screen Shot 2022-01-19 at 1 19 17 PM Screen Shot 2022-01-19 at 1 25 34 PM Screen Shot 2022-01-19 at 1 31 51 PM Screen Shot 2022-01-19 at 1 38 08 PM

NOTE: I also checked the new-tab page widget; just didn't screenshot it each time 👍


Verified with

Brave	1.36.93 Chromium: 98.0.4758.87 (Official Build) beta (64-bit) 
Revision	e4cd00f135fb4d8edc64c8aa6ecbe7cc79ebb3b2-refs/branch-heads/4758@{#1002}
OS	Linux
  1. new profile
  2. clicked on Skip welcome tour
  3. clicked on Start using Rewards
  4. changed 5 ads per hour to 10 ads per hour on brave://rewards/
  5. waited for 1st ad
  6. opened brave://rewards
  7. checked that the Current earnings this month (estimated) and Estimated Earnings match up
  8. repeated steps 5-7 for additional ads
Example Example Example
prd1 prd2 prd3

Additionally, modified ad value in DB to ensure rounding was invoked.
Confirmed that rounded value was shown on brave://rewards, on panel, and on NTP widget.

Example Example
prd4 prd4a

Verified PASSED using

Brave | 1.36.90 Chromium: 98.0.4758.87 (Official Build) beta (64-bit)
Revision | e4cd00f135fb4d8edc64c8aa6ecbe7cc79ebb3b2-refs/branch-heads/4758@{#1002}
OS | Windows 11 Version 21H2 (Build 22000.493)

New profile
Launch brave browser
clicked on Skip welcome tour
clicked on Start using Rewards
waited for 1st ad
opened brave://rewards
Verified that the Current earnings this month (estimated) and Estimated Earnings match up
changed 5 ads per hour to 10 ads per hour on brave://rewards/
Waited for ads 2-5
Opened brave://rewards
Verified Current earnings this month (estimated) and Estimated Earnings match up for Ads 2-5
Switched location "State level ad targeting" = CA
Waited for ads 6-15
Opened brave://rewards
Verified Current earnings this month (estimated) and Estimated Earnings match up for Ads 6-15

1 2 3 4 5 6 7 8 9
ad 1 ad 2- 10 ads per hours ad 3- 10 ads per hour ad 4- 10 ads per hour ad 5- 10 ads per hour ad 6 ad 7 ad 8 ad 9- 10 ads per hour
11 12 13 14
ad 11 ad 12 ad 13 ad 14

Brave | 1.37.46 Chromium: 98.0.4758.87 (Official Build) nightly (64-bit)
Revision | e4cd00f135fb4d8edc64c8aa6ecbe7cc79ebb3b2-refs/branch-heads/4758@{#1002}
OS | Windows 11 Version 21H2 (Build 22000.493)

New profile
Launch brave browser (Nightly)
clicked on Skip welcome tour
Enabled rewards
waited for 1st ad
opened brave://rewards
Verified that the Current earnings this month (estimated) and Estimated Earnings match up
changed 5 ads per hour to 10 ads per hour on brave://rewards/
Waited for ads 2-5
Opened brave://rewards
Veried Current earnings this month (estimated) and Estimated Earnings match up for Ads 2-5
Switched location "State level ad targeting" = CA
Waited for ads 6-15
Opened brave://rewards
Verified Current earnings this month (estimated) and Estimated Earnings match up for Ads 6-15

1 2 3 4 5 6 7 8 9
ad 1 ad 2 ad 3 ad 4 ad 5 ad 6 ad 7 ad 8 ad 9
10 11
ad 10 ad 11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment