WordPress-Android icon indicating copy to clipboard operation
WordPress-Android copied to clipboard

Stats traffic by week chart

Open ravishanker opened this issue 1 year ago β€’ 4 comments

Fixes #19951

Adds bar graphs for Week, Month, and Year granularity

Day Week Month Year
Screenshot_20240220_145219 Screenshot_20240220_151925 Screenshot_20240220_151951 Screenshot_20240220_152043

To Test:

Test 1:

  • Enable stats_traffic_tab feature flag (Me -> Debug settings - Remote Features)
  • Go to Stats
  • Verify only Traffic tab, and Insights tabs are shown as in after column
  • Switch to Traffic tab if not on it already
  • Select By day from the drop-down
  • Verify that Today card is shown in the image above
  • Select By week from the drop-down
  • Verify a Bar chart is shown with seven bars for 7 days in a week

[!NOTE] This is still work in progress. Date selector, and graphs need to be in sync You may also check By month, and By year options from the drop-down

Test 2:

  • Disable feature flag
  • Verify Stats tabs all show up, and work as before

Regression Notes

  1. Potential unintended areas of impact

    • Behind feature flag
  2. What I did to test those areas of impact (or what existing automated tests I relied on)

    • Tested
  3. What automated tests I added (or what prevented me from doing so)

    • Updated existing unit tests

PR Submission Checklist:

  • [x] I have completed the Regression Notes.
  • [x] I have considered adding accessibility improvements for my changes.
  • [x] I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

Testing Checklist:

  • [ ] WordPress.com sites and self-hosted Jetpack sites.
  • [ ] Portrait and landscape orientations.
  • [ ] Light and dark modes.
  • [ ] Fonts: Larger, smaller and bold text.
  • [ ] High contrast.
  • [ ] Talkback.
  • [ ] Languages with large words or with letters/accents not frequently used in English.
  • [ ] Right-to-left languages. (Even if translation isn’t complete, formatting should still respect the right-to-left layout)
  • [ ] Large and small screen sizes. (Tablet and smaller phones)
  • [ ] Multi-tasking: Split screen and Pop-up view. (Android 10 or higher)

ravishanker avatar Feb 15 '24 08:02 ravishanker

7 Warnings
:warning: This PR is larger than 300 lines of changes. Please consider splitting it into smaller PRs for easier and faster reviews.
:warning: Class TrafficOverviewMapper is missing tests, but unit-tests-exemption label was set to ignore this.
:warning: Class SelectedType is missing tests, but unit-tests-exemption label was set to ignore this.
:warning: Class TrafficOverviewUseCase is missing tests, but unit-tests-exemption label was set to ignore this.
:warning: Class UiState is missing tests, but unit-tests-exemption label was set to ignore this.
:warning: Class TrafficOverviewUseCaseFactory is missing tests, but unit-tests-exemption label was set to ignore this.
:warning: Class BarChartLabelFormatter is missing tests, but unit-tests-exemption label was set to ignore this.

Generated by :no_entry_sign: Danger

dangermattic avatar Feb 15 '24 08:02 dangermattic

WordPressπŸ“² You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
App NameWordPress WordPress
FlavorJalapeno
Build TypeDebug
Versionpr20188-91312d4
Commit91312d43b152f292530586951f2009e70feb12a5
Direct Downloadwordpress-prototype-build-pr20188-91312d4.apk
Note: Google Login is not supported on these builds.

wpmobilebot avatar Feb 15 '24 08:02 wpmobilebot

JetpackπŸ“² You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
App NameJetpack Jetpack
FlavorJalapeno
Build TypeDebug
Versionpr20188-91312d4
Commit91312d43b152f292530586951f2009e70feb12a5
Direct Downloadjetpack-prototype-build-pr20188-91312d4.apk
Note: Google Login is not supported on these builds.

wpmobilebot avatar Feb 15 '24 08:02 wpmobilebot

Codecov Report

Attention: Patch coverage is 0.67114% with 296 lines in your changes are missing coverage. Please review.

Project coverage is 40.23%. Comparing base (bf356dd) to head (91312d4). Report is 26 commits behind head on trunk.

Files Patch % Lines
...h/lists/sections/traffic/TrafficOverviewUseCase.kt 0.00% 196 Missing :warning:
...sh/lists/sections/traffic/TrafficOverviewMapper.kt 0.00% 70 Missing :warning:
...droid/ui/stats/refresh/utils/StatsDateFormatter.kt 0.00% 20 Missing :warning:
...d/ui/stats/refresh/utils/BarChartLabelFormatter.kt 0.00% 6 Missing :warning:
...ists/sections/granular/usecases/OverviewUseCase.kt 33.33% 2 Missing :warning:
...droid/ui/stats/refresh/lists/StatsListViewModel.kt 0.00% 1 Missing :warning:
.../ui/stats/refresh/utils/LineChartLabelFormatter.kt 0.00% 1 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##            trunk   #20188      +/-   ##
==========================================
- Coverage   40.37%   40.23%   -0.14%     
==========================================
  Files        1469     1472       +3     
  Lines       67691    67912     +221     
  Branches    11209    11244      +35     
==========================================
- Hits        27327    27325       -2     
- Misses      37864    38088     +224     
+ Partials     2500     2499       -1     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Feb 15 '24 08:02 codecov[bot]

LineChartLabelFormatter was crashing on my local. The reason might be the time zone difference between my home and the site. I fixed it: https://github.com/wordpress-mobile/WordPress-Android/pull/20188/commits/82c142dd8c3b08d39300e4c8040be72b8aa9a2de

irfano avatar Feb 21 '24 22:02 irfano

The date selector, overview card, and chart are working as expected after my latest commits. Now, we can see and test all chart types in this PR.

  • I think we can address Andy's comments, and
  • update the UI of the card with the latest design (p1708598484003149/1708374772.289219-slack-C06BR07TJHK),

then close this PR. There is an issue with loading the previous dates; the cards display wrong values for a very short time before showing the correct value. I'll look at it in a separate PR.

irfano avatar Feb 23 '24 01:02 irfano

then close this PR. There is an issue with loading the previous dates; the cards display wrong values for a very short time before showing the correct value. I'll look at it in a separate PR.

Nice work πŸ₯‡ Sounds good πŸ‘. There could also be some stylistic issues that can be fixed in separate PR after Chris review.

ravishanker avatar Feb 23 '24 05:02 ravishanker

The change LGTM! I'm approving the PR, but I removed Fixes #19951 from the description since the issue needs 2 more tasks:

  • [x] Design updates from the notes I explained in the screenshot.

Updated the color, the margin is required, otherwise the Y axis values are being cut of higher value range, probably it's looking better without being edge-to-edge.

ravishanker avatar Feb 26 '24 00:02 ravishanker