Skip to content

Conversation

@rachelmcr
Copy link
Contributor

@rachelmcr rachelmcr commented Nov 21, 2022

Part of #8149

Description

This PR moves a number of stats data helpers from the StoreStatsPeriodViewModel (used for My Store stats) to a separate StatsV4DataHelper class, so they can be reused in the Analytics Hub.

It also adds a new helper related to the new Average Order Value stat that will be used in Analytics Hub.

Changes

  • Moves the shared helpers and unit tests from StoreStatsPeriodViewModel to StatsV4DataHelper.
  • Adds a new public helper StatsV4DataHelper.createAverageOrderValueText(orderStats:currencyFormatter:currencyCode:).

Testing

This PR refactors the helpers but there should be no change in the current behavior:

  1. Build and run the app.
  2. Confirm your stats (text and chart) appear as expected on the My Store screen.
  3. Confirm you can select different time period or select specific intervals on the stats chart, and the stats text is updated as expected.

Note: This PR removes some redundant view model unit tests, because the logic is now contained in the helper class. However, you can undo the changes from 466c36f and run the tests in StoreStatsPeriodViewModelTests to confirm that all of the previous tests are still passing with these changes.

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 21, 2022
@rachelmcr rachelmcr added this to the 11.4 milestone Nov 21, 2022
@rachelmcr rachelmcr changed the title [Analytics Hub] Create shared set of stats helpers for My Store and Analytics stats [Analytics Hub] Create shared set of stats helpers for My Store and Analytics Hub Nov 21, 2022
@rachelmcr rachelmcr marked this pull request as ready for review November 21, 2022 21:34
@Ecarrion Ecarrion self-assigned this Nov 22, 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.

Looks good! I wonder if we should start calling this just StatsDataHelper and drop the V4 since it seems like the standard by now!

@Ecarrion Ecarrion removed their assignment Nov 22, 2022
@rachelmcr rachelmcr enabled auto-merge November 22, 2022 18:16
@wpmobilebot
Copy link
Collaborator

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 pr8175-d6d6c39 on your iPhone

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

@rachelmcr rachelmcr merged commit 4b4dfa8 into trunk Nov 23, 2022
@rachelmcr rachelmcr deleted the issue/8149-shared-stats-helpers branch November 23, 2022 11:52
@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 Orders Analytics card

4 participants