Skip to content

Refresh Lifetime Statistics destroy statistic data #33896

Open
@bernd-reindl

Description

@bernd-reindl

Preconditions (*)

Magento 2.4.x

Steps to reproduce (*)

  1. View multiple products as a guest or customer on frontend from different browsers so there will be multiple entires in report_event and report_viewed_product_index table.
  2. If already have visitor logs and data in report_event and report_viewed_product_index tables that will be great.
  3. Login into Admin and refresh lifetime static data for product view from Reports -> STATISTICS -> Refresh Statistics.
  4. Open Product Views Report from Reports -> PRODUCTS -> Views
  5. Select rage and show reports.
  6. You will see the views of products.
  7. Now run cron to run manually change the expression of visitor_clean cron to run now * * * * * . and run bin/magento cron:run
  8. you will see data from customer_visitor and report_event cleaned.
  9. now repeat steps 3 to 6, Product view log will not be show but data in report_viewed_product_index still exists.

Expected result (*)

Report for the view products must be shown because logs exists in the table report_viewed_product_index.

Actual result (*)

Most viewed product reports does not show the correct report.

Description

Everyday a midnight the cron job 'visitor_clean' cleans the visitors log. This is done by \Magento\Customer\Model\Visitor::clean() which calls \Magento\Customer\Model\ResourceModel\Visitor::clean().
The module "Magento_Reports" has a plugin "afterClean" for \Magento\Customer\Model\ResourceModel\Visitor::clean().
This plugin removes all entries from 'report_event' which points to an non existing entry in 'customer_visitor'.
So when you updating the livetime statistics now. A lot of entries are missing.

Additional Information (*)

When cron cleans visitor log, report_event table also get clean from app/code/Magento/Reports/Model/ResourceModel/Event.php:180
When we run lifetime statics refresh it collects all data by joining report_event table in app/code/Magento/Reports/Model/ResourceModel/Report/Product/Viewed.php:10
4. In collection it ignores the damaged data which has been removed in clean process.


Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

  • [x ] Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: UI FrameworkComponent: Framework/CodeIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P2A defect with this priority could have functionality issues which are not to expectations.Progress: ready for devReported on 2.3.xIndicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchTriage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject it

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions