wordpress-mobile / WordPress-Android

WordPress for Android
http://android.wordpress.org
GNU General Public License v2.0
2.92k stars 1.3k forks source link

Fix pull to refresh Stats bug #20524

Closed aditi-bhatia closed 3 weeks ago

aditi-bhatia commented 1 month ago

Fixes https://github.com/wordpress-mobile/WordPress-Android/issues/20397

This PR fixes an issue where pull to refresh wouldn't update Stats. This was happening because statsSection was being set to TRAFFIC with no information on time granularity. This PR maps StatsGranularity to its corresponding StatsSection so that we can refresh the correct useCase. For example, it maps StatsGranularity.DAYS to StatsSection.DAYS so the correct data can be refreshed. Alternatively, we could choose to refresh all granularities on pull to refresh which would remove the need for mapping with the feature flag on, but would also be less efficient.


To Test:

  1. With the Stats feature flag on, navigate to the Stats page.

  2. Turn data off and change the granularity or time period.

  3. You should see There was a problem loading your data, refresh your page to try again:

    Screenshot 2024-03-25 at 2 17 18 PM
  4. Turn data on again. Refresh the page and it should display data.

  5. Repeat steps 1-4 with the feature flag off.


Regression Notes

  1. Potential unintended areas of impact

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

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

    • None

PR Submission Checklist:


Testing Checklist (strike-out the not-applying and unnecessary ones):

sonarcloud[bot] commented 1 month ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

wpmobilebot commented 1 month ago
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
Versionpr20524-2d30d0b
Commit2d30d0b8f44ec4ad724ed8bc5efe52f42ea168e3
Direct Downloadjetpack-prototype-build-pr20524-2d30d0b.apk
Note: Google Login is not supported on these builds.
wpmobilebot commented 1 month ago
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
Versionpr20524-2d30d0b
Commit2d30d0b8f44ec4ad724ed8bc5efe52f42ea168e3
Direct Downloadwordpress-prototype-build-pr20524-2d30d0b.apk
Note: Google Login is not supported on these builds.
codecov[bot] commented 1 month ago

Codecov Report

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

Project coverage is 40.43%. Comparing base (27ad674) to head (2d30d0b). Report is 484 commits behind head on trunk.

Files Patch % Lines
...rdpress/android/ui/stats/refresh/StatsViewModel.kt 0.00% 14 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## trunk #20524 +/- ## ========================================== - Coverage 40.43% 40.43% -0.01% ========================================== Files 1463 1463 Lines 67301 67312 +11 Branches 11186 11190 +4 ========================================== Hits 27216 27216 - Misses 37609 37620 +11 Partials 2476 2476 ```

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

dangermattic commented 4 weeks ago
1 Warning
:warning: PR is not assigned to a milestone.

Generated by :no_entry_sign: Danger