Skip to content

Conversation

@rachelmcr
Copy link
Contributor

Part of #8150

Description

This PR adds methods to retrieve and format the net revenue value and delta used for the "Net Sales" column on the Revenue Analytics card:

Testing

These methods aren't yet used in the app; confirm the unit tests are checking the correct values and tests pass.

Submitter Checklist

Update release notes:

  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@rachelmcr rachelmcr added the feature: stats Related to stats, including Top Performers. label Nov 24, 2022
@rachelmcr rachelmcr added this to the 11.4 milestone Nov 24, 2022
Base automatically changed from issue/8149-delta-percentage-value to trunk November 24, 2022 14:48
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Nov 24, 2022

You can test the changes from this Pull Request by:
  • Clicking here or scanning the QR code below to access App Center
  • Then installing the build number pr8207-a8fb169 on your iPhone

If you need access to App Center, please ask a maintainer to add you.

@ealeksandrov ealeksandrov self-assigned this Nov 24, 2022
Copy link
Contributor

@Ecarrion Ecarrion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


// If revenue is an integer, no decimal points are shown.
let numberOfDecimals: Int? = revenue.isInteger ? 0 : nil
let currencyFormatter = currencyFormatter ?? CurrencyFormatter(currencySettings: ServiceLocator.currencySettings)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: you can set the formatter as a default parameter to make the code a bit clean.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Updated in a8fb169

Copy link
Contributor

@ealeksandrov ealeksandrov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :shipit:

P.S. I missed other review 😄


// If revenue is an integer, no decimal points are shown.
let numberOfDecimals: Int? = revenue.isInteger ? 0 : nil
let currencyFormatter = currencyFormatter ?? CurrencyFormatter(currencySettings: ServiceLocator.currencySettings)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I feel this is more readable when we declare default value near the non-optional func parameter.
Now passing nil means using default value, but it is not obvious from outside of the function.

@ealeksandrov ealeksandrov removed their assignment Nov 24, 2022
@peril-woocommerce
Copy link

Warnings
⚠️ This PR is assigned to a milestone which is closing in less than 2 days Please, make sure to get it merged by then or assign it to a later expiring milestone

Generated by 🚫 dangerJS

@rachelmcr rachelmcr enabled auto-merge November 25, 2022 10:57
@rachelmcr rachelmcr merged commit db568f9 into trunk Nov 25, 2022
@rachelmcr rachelmcr deleted the issue/8150-revenue-data-formatting branch November 25, 2022 13:33
@rachelmcr rachelmcr linked an issue Dec 5, 2022 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature: stats Related to stats, including Top Performers.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Analytics Hub] Configure Revenue Analytics card

5 participants