Skip to content

Conversation

@ravishanker
Copy link
Contributor

This PR fixes data consistencies across Web, Android and iOS on Jetpack app

  • Comparison between this week and last week excludes today's data
  • Labels now read 7-days instead of Week

Fixes #17731

To test:

  • Launch Jetpack app
  • Navigate to Stats
  • Verify the titles on the Views and Visitors card read as Last 7-days and Previous 7-days
  • Verify Information below the graph uses the same like 7-days
  • Verify information on the Total Likes also reads like 7-days
  • Verify information on the Total Comments also reads 7-days and not Week
  • Also verify the Total count of Views, Visitors, Likes and Comments matches on the Web

Note
The Line graph on Views and Visitors card still shows data for today and matches Web
There's a know issue around Unique Visitors, that's not related to this fix

Regression Notes

  1. Potential unintended areas of impact

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

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

PR submission checklist:

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

Take data for last 14 days excluding today
Updated labels to read 7-days instead of Week on Views and Visitors card
Updated labels to 7-days from Week on Total Likes and Total Comments cards
@ravishanker ravishanker added this to the 21.6 milestone Jan 12, 2023
@ravishanker ravishanker requested a review from irfano January 12, 2023 04:53
@ravishanker ravishanker self-assigned this Jan 12, 2023
@wpmobilebot
Copy link
Contributor

wpmobilebot commented Jan 12, 2023

Jetpack📲 You can test these changes on Jetpack by downloading jetpack-installable-build-pr17745-288d882.apk
💡 Scan this QR code with your Android phone to download and install the APK directly on it.
AppJetpack
Build FlavorJalapeno
Build TypeDebug
Commit288d882
Note: This installable build uses the JalapenoDebug build flavor, and does not support Google Login.

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Jan 12, 2023

WordPress📲 You can test these changes on WordPress by downloading wordpress-installable-build-pr17745-288d882.apk
💡 Scan this QR code with your Android phone to download and install the APK directly on it.
AppWordPress
Build FlavorJalapeno
Build TypeDebug
Commit288d882
Note: This installable build uses the JalapenoDebug build flavor, and does not support Google Login.

@ravishanker ravishanker removed the Stats label Jan 12, 2023
@staskus
Copy link
Contributor

staskus commented Jan 12, 2023

Hey, thanks for the changes. I'll soon make an equivalent on iOS. However, I am concerned about the graph.

The Line graph on Views and Visitors card still shows data for today..

I do think that's misleading for users. If we're labeling the data as "Last 7-days" we should be explicit in the representation of which days we're talking about.

..and matches Web

There's no graph for the 7-day highlights elements, which part does it match? I may be missing some context. Thanks!

image

@staskus
Copy link
Contributor

staskus commented Jan 12, 2023

I found one issue:

By going into "Week >" I can see that the numbers don't match the web. Android also adds the view count for one more day (January 8th), although the graph and date are from January 9th.

image

@irfano
Copy link
Member

irfano commented Jan 12, 2023

The Line graph on Views and Visitors card still shows data for today and matches Web

Will we fix it too?

Copy link
Member

@irfano irfano left a comment

Choose a reason for hiding this comment

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

  • We used to fetch 15 days and we don't use 15 days anymore, right? But usecases are still sending 15 days data to the mappers. If they send 14 days, then we wouldn't need dropLast(1).
  • I think previous strings were more proper on the detail screens. Blue line shows "This Week (4 days)", not "Last 7-days". Wdyt?

@ravishanker
Copy link
Contributor Author

ravishanker commented Jan 13, 2023

Hey, thanks for the changes. I'll soon make an equivalent on iOS. However, I am concerned about the graph.

The Line graph on Views and Visitors card still shows data for today..

I do think that's misleading for users. If we're labeling the data as "Last 7-days" we should be explicit in the representation of which days we're talking about.

..and matches Web

There's no graph for the 7-day highlights elements, which part does it match? I may be missing some context. Thanks!

Referring to the bar chart below the highlights section which shows a bar for today

@ravishanker
Copy link
Contributor Author

I found one issue:

By going into "Week >" I can see that the numbers don't match the web. Android also adds the view count for one more day (January 8th), although the graph and date are from January 9th.

Strange but true. The detail view is returning a different range of data. On insights it is returning last 15 days counting from today backwards (30-Dec to 13-Jan) while the Week detail view is returning from 1-Jan to 15-Jan.

Good catch. Fixed now. Thanks

@ravishanker
Copy link
Contributor Author

ravishanker commented Jan 13, 2023

  • We used to fetch 15 days and we don't use 15 days anymore, right? But usecases are still sending 15 days data to the mappers. If they send 14 days, then we wouldn't need dropLast(1).

When you fetch 14 days it returns 14 days including today, whereas we need 14 days excluding today, so need to fetch 15 and drop last

* I think previous strings were more proper on the detail screens. Blue line shows "This Week (4 days)", not "Last 7-days". Wdyt?

Then we need to change Previous 7 days to Previous Week too as before.

@ravishanker ravishanker requested a review from irfano January 13, 2023 03:45
Copy link
Member

@irfano irfano left a comment

Choose a reason for hiding this comment

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

When you fetch 14 days it returns 14 days including today, whereas we need 14 days excluding today, so need to fetch 15 and drop last

Yes, I missed that. We still need 15 days on the detail screen. 👍🏻

The wrong value on the detail screen is fixed. LGTM!

@staskus
Copy link
Contributor

staskus commented Jan 15, 2023

Thank you for the changes in the graph!

🔴 I compared the numbers on iOS, Android, and the Web. Android is reporting a different number. The calculator represents Web's daily numbers added one by one.

After further investigation, I saw that Android calculates the numbers for one day behind. Jan 7 - Jan 13, when it's supposed to calculate the total for days Jan 8 - Jan 14 (as the graph shows).

CC @ravishanker, @irfano

Difference V   V Insights

@ravishanker ravishanker merged commit ff5ed08 into trunk Jan 15, 2023
@ravishanker ravishanker deleted the Stats-Revamp-Match-data-across-platforms branch January 15, 2023 22:28
@ravishanker
Copy link
Contributor Author

Thank you for the changes in the graph!

🔴 I compared the numbers on iOS, Android, and the Web. Android is reporting a different number. The calculator represents Web's daily numbers added one by one.

After further investigation, I saw that Android calculates the numbers for one day behind. Jan 7 - Jan 13, when it's supposed to calculate the total for days Jan 8 - Jan 14 (as the graph shows).

CC @ravishanker, @irfano

If the 14th is today, then it needs to be excluded to match with Web right? Then it is correct.
The graph as mentioned before still show today, just as Bar chart on Web

@staskus
Copy link
Contributor

staskus commented Jan 16, 2023

Thank you for the changes in the graph!

🔴 I compared the numbers on iOS, Android, and the Web. Android is reporting a different number. The calculator represents Web's daily numbers added one by one.

After further investigation, I saw that Android calculates the numbers for one day behind. Jan 7 - Jan 13, when it's supposed to calculate the total for days Jan 8 - Jan 14 (as the graph shows).

CC @ravishanker, @irfano

If the 14th is today, then it needs to be excluded to match with Web right? Then it is correct.

@ravishanker, thanks for the reply!

It was Jan 15th, showing the graph until Jan 14th, and loading the data until Jan 13th. I will retest today as well to see what it shows.

The graph as mentioned before still show today, just as Bar chart on Web

Bar chart on the web is a separate element. For me, it's misleading showing calculations for a different data range than displayed on the graph. I'm delaying to merge iOS PR so we could have exactly same behavior and synchronize our solutions.

CC: @irfano and @guarani (since you just reviewed iOS PR)

@staskus
Copy link
Contributor

staskus commented Jan 16, 2023

After further investigation, I saw that Android calculates the numbers for one day behind. Jan 7 - Jan 13, when it's supposed to calculate the total for days Jan 8 - Jan 14 (as the graph shows).

I can no longer reproduce this issue. I turned back the clock to yesterday but now the graph was until Jan 15th and calculations until Jan 14th. I've no idea why I had that behavior yesterday 🤷‍♂️.


The only question for me remains the fact that we continue showing the graph up to today. I think we have a disagreement here so it would be good to hear other opinions.

@irfano
Copy link
Member

irfano commented Jan 16, 2023

I can no longer reproduce this issue. I turned back the clock to yesterday but now the graph was until Jan 15th and calculations until Jan 14th. I've no idea why I had that behavior yesterday 🤷‍♂️.

What was the time when you tested yesterday? Could it be related to timezone difference?

The only question for me remains the fact that we continue showing the graph up to today. I think we have a disagreement here so it would be good to hear other opinions.

IMO, it's better to remove today from the line chart of "Views & Visitors".

@staskus
Copy link
Contributor

staskus commented Jan 16, 2023

What was the time when you tested yesterday? Could it be related to timezone difference?

It's visible on the screenshot, so I tried to come back at the exact same time. Maybe something was wrong with the emulator.

@irfano irfano added Stats and removed Stats Revamp labels Mar 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stats: Make Views & Visitors, Total Likes, and Total Comments cards data consistent with the Web

5 participants