Skip to content

Conversation

@ThomazFB
Copy link
Contributor

@ThomazFB ThomazFB commented Dec 7, 2022

Closes #8189

Why

The stats request are currently using a fixed granularity of days with an interval size of 31. For better request performance and a correct chart render, we need to use the correct granularity and interval based on the selected time range.

How

Adds to the SelectedType two computed properties: granularity and intervalSize, grouping the response based on the time range nature like days, weeks, months, quarters and years.

How to Test

  1. Open the Analytics Hub
  2. Do an overall test verifying if the stats reflect what is displayed in the Woo Core Analytics section and if the charts are correctly rendered based on the stats response numbers.

Update release notes:

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

@ThomazFB ThomazFB added the feature: stats Related to stats, including Top Performers. label Dec 7, 2022
@ThomazFB ThomazFB marked this pull request as ready for review December 7, 2022 21:55
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Dec 7, 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 pr8341-1ca89c2 on your iPhone

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

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 with one small improvement suggestion! :shipit:

case .monthToDate, .lastMonth:
return 31
case .quarterToDate, .lastQuarter:
return 12
Copy link
Contributor

Choose a reason for hiding this comment

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

For amount of weeks in a quarter should we pick 13 to be more precise?
Year is 52 weeks (+1-2 days), so 52+/4 = 13+

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes perfect sense! Thanks! Fixed here: 1ca89c2

}
}

/// The resopnse interval size that should be used to request stats from the given SelectedType
Copy link
Contributor

Choose a reason for hiding this comment

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

nit:

Suggested change
/// The resopnse interval size that should be used to request stats from the given SelectedType
/// The response interval size that should be used to request stats from the given SelectedType

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! Fixed here: 1ca89c2

@ThomazFB ThomazFB enabled auto-merge December 8, 2022 15:28
@ThomazFB ThomazFB merged commit 87a2046 into trunk Dec 8, 2022
@ThomazFB ThomazFB deleted the issue/8189-handle-range-selection-granularity branch December 8, 2022 15:57
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] Integrate UI and Yosemite layers to fetch real order stats data

4 participants