OpenMage / magento-lts

Official OpenMage LTS codebase | Migrate easily from Magento Community Edition in minutes! Download the source code for free or contribute to OpenMage LTS | Security vulnerability patches, bug fixes, performance improvements and more.
https://www.openmage.org
Open Software License 3.0
868 stars 436 forks source link

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

Closed elidrissidev closed 2 years ago

elidrissidev commented 3 years ago

Description (*)

I've spent some time today debugging why the most viewed products report was not being aggregated automatically like the rest of the reports (see screenshot below) thinking it was a bug only to find out that it's not meant to happen in the first place which is a bit weird considering all other reports are. For example in Mage/Sales/etc/config.xml I can see the following which aggregates the sales every day at midnight:

...
<crontab>
        ...
        <jobs>
            <aggregate_sales_report_order_data>
                <schedule>
                    <cron_expr>0 0 * * *</cron_expr>
                </schedule>
                <run>
                    <model>sales/observer::aggregateSalesReportOrderData</model>
                </run>
            </aggregate_sales_report_order_data>
        </jobs>
       ...
</crontab>
...

Considering we're using this data in an internal system to calculate the conversion rate for products, I suggest we add a cron job for it like the rest. I'm willing to work on it myself.

report_statistics

Expected behavior (*)

Most viewed products report should be aggregated automatically like the rest of the reports.

Benefits

No need for refreshing product views report manually from the Admin panel.

elidrissidev commented 2 years ago

This should've been closed automatically after merge 🤔