Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRM: Fix dashboard contact graph #38316

Open
wants to merge 2 commits into
base: trunk
Choose a base branch
from

Conversation

gogdzl
Copy link
Contributor

@gogdzl gogdzl commented Jul 12, 2024

Fixes https://github.com/Automattic/zero-bs-crm/issues/3468

Proposed changes:

  • This PR fixes the dashboard contact graph which shows wrong values in some instances.

Other information:

  • Have you written new tests for your changes, if applicable?
  • Have you checked the E2E test CI results, and verified that your changes do not break them?
  • Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)?

Jetpack product discussion

https://github.com/Automattic/zero-bs-crm/issues/3468

Does this pull request change what data or activity we track or use?

No.

Testing instructions:

  • Create one contact in the last day of the month
  • Change your timezone to a high enough value that would cause the day to overflow, when changing timezones
  • Verify that the graph gets shifted
  • Apply this PR's code to your CRM installation
  • Verify that the error is gone

Alternatively just test the new code and check if the behavior is consistently the same as the previous, and that the new code looks good enough.

@gogdzl gogdzl added [Type] Bug When a feature is broken and / or not performing as intended [Plugin] CRM Issues about the Jetpack CRM plugin labels Jul 12, 2024
@gogdzl gogdzl requested a review from tbradsha July 12, 2024 03:09
@gogdzl gogdzl self-assigned this Jul 12, 2024
@github-actions github-actions bot added the Admin Page React-powered dashboard under the Jetpack menu label Jul 12, 2024
Copy link
Contributor

github-actions bot commented Jul 12, 2024

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Team Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available.


Once your PR is ready for review, check one last time that all required checks appearing at the bottom of this PR are passing or skipped.
Then, add the "[Status] Needs Team Review" label and ask someone from your team review the code. Once reviewed, it can then be merged.
If you need an extra review from someone familiar with the codebase, you can update the labels from "[Status] Needs Team Review" to "[Status] Needs Review", and in that case Jetpack Approvers will do a final review of your PR.

@github-actions github-actions bot added the [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! label Jul 12, 2024
Copy link
Contributor

@coder-karen coder-karen left a comment

Choose a reason for hiding this comment

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

Nice, thanks for working on this.

What would be the best way to change the timezone? In my case I created a contact and set the creation date for June 30th UTC+0, evening. Changed my timezone in WordPress to UTC+13 which changed the contact creation date to July 1st. The dashboard graph still shows the contact entry for June, both with and without the PR.

@gogdzl gogdzl added [Status] Needs Review To request a review from Crew. Label will be renamed soon. and removed [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! Admin Page React-powered dashboard under the Jetpack menu labels Jul 15, 2024
@github-actions github-actions bot added the Admin Page React-powered dashboard under the Jetpack menu label Jul 15, 2024
@gogdzl
Copy link
Contributor Author

gogdzl commented Jul 15, 2024

What would be the best way to change the timezone? In my case I created a contact and set the creation date for June 30th UTC+0, evening. Changed my timezone in WordPress to UTC+13 which changed the contact creation date to July 1st. The dashboard graph still shows the contact entry for June, both with and without the PR.

That's a great question. That should've bugged the dashboard's graph. Adjust inside your database zbsc_created so MONTH(FROM_UNIXTIME(zbsc_created)) as month returns June on your machine's timezone.

@gogdzl gogdzl requested a review from coder-karen July 15, 2024 13:49
@coder-karen
Copy link
Contributor

Yes that's how I adjusted the zbsc_created initially for the contact, the timestamp there (in the database, for zbsc_created) is for June 30th, unless I'm misunderstanding 🤔

Copy link
Contributor

@cleacos cleacos left a comment

Choose a reason for hiding this comment

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

To test this way:

We could use the WP installation timezone configured:

$datetime_month = new DateTime( '@', $v->ts );
$datetime_month->setTimezone( new DateTimeZone('the_UTC_time_zone') );
$the_month = $datetime_month->format( 'M y' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Admin Page React-powered dashboard under the Jetpack menu [Plugin] CRM Issues about the Jetpack CRM plugin [Status] Needs Review To request a review from Crew. Label will be renamed soon. [Type] Bug When a feature is broken and / or not performing as intended
3 participants