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

Aggregate most viewed products report daily via a Cron job #1829

Merged

Conversation

elidrissidev
Copy link
Member

@elidrissidev elidrissidev commented Sep 22, 2021

Description (*)

This PR will add a Cron job to aggregate most viewed products report daily at midnight. I added this Cron job in the Mage_Reports module instead of Mage_Catalog because that's where the aggregator model resides, I just wanted to keep them in the same place.

Fixed Issues (if relevant)

  1. Fixes Aggregate most viewed products report daily via a Cron job #1823

Manual testing scenarios (*)

  1. You can either wait for the Cron job to run at midnight or, you can invoke it manually with n98-magerun:
$ n98-magerun sys:cron:run aggregate_reports_report_product_viewed_data

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All automated tests passed successfully (all builds are green)
  • Add yourself to contributors list

@github-actions github-actions bot added the Component: Reports Relates to Mage_Reports label Sep 22, 2021
@sreichel
Copy link
Contributor

Cron schedule should be customizable. (?) How about to a add it to configuration?

@elidrissidev
Copy link
Member Author

@sreichel This change was mainly to stay consistent with all the other reports that get refreshed every day at midnight (also hardcoded). Allowing to customize this can be handled in a separate PR.

@elidrissidev
Copy link
Member Author

We're running this change in production. Working just fine.

Reports

@ADDISON74
Copy link
Contributor

ADDISON74 commented Sep 28, 2021

I confirm this issue in all my production stores. As you can see from the screenshot bellow all statistics are refreshed based on a cron job except Most Viewed. It can only be refreshed manually on this page..

screenshot

I will implement this PR in production.

@elidrissidev
Copy link
Member Author

@ADDISON74 Will appreciate a review to bump this

@Flyingmana Flyingmana changed the base branch from 1.9.4.x to 20.0 September 28, 2021 19:07
Flyingmana
Flyingmana previously approved these changes Sep 28, 2021
luigifab
luigifab previously approved these changes Oct 2, 2021
Copy link
Contributor

@luigifab luigifab left a comment

Choose a reason for hiding this comment

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

The branch rebasing added an unwanted commit: 17128ba.

@elidrissidev elidrissidev dismissed stale reviews from luigifab and Flyingmana via 253d416 October 20, 2021 11:16
@elidrissidev elidrissidev force-pushed the feature/aggregate-viewed-products-report branch from 52b0974 to 253d416 Compare October 20, 2021 11:16
@elidrissidev
Copy link
Member Author

@Flyingmana @luigifab Rebased on top of 20.0

Copy link
Contributor

@Sekiphp Sekiphp left a comment

Choose a reason for hiding this comment

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

I agree with this solution, but I will prefer adminhtml cron expressions settings, but this is for another PR :-)

@github-actions
Copy link
Contributor

Unit Test Results

1 files  ±0  1 suites  ±0   0s ⏱️ ±0s
0 tests ±0  0 ✔️ ±0  0 💤 ±0  0 ❌ ±0 
7 runs  ±0  7 ✔️ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit 9182719. ± Comparison against base commit 0229927.

@elidrissidev elidrissidev deleted the feature/aggregate-viewed-products-report branch November 30, 2021 16:57
sreichel added a commit that referenced this pull request Sep 18, 2022
…2610)

* Create Observer.php

* Add cron job to update most viewed products report

Co-authored-by: Mohamed ELIDRISSI <67818913+elidrissidev@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Reports Relates to Mage_Reports
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Aggregate most viewed products report daily via a Cron job
6 participants