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
Update visit only when needed #15869
Conversation
@@ -877,10 +877,22 @@ private function triggerHookOnDimensions(Request $request, $dimensions, $hook, $ | |||
|
|||
private function getGoalFromVisitor(VisitProperties $visitProperties, Request $request, $action) | |||
{ | |||
$lastVisitTime = $visitProperties->getProperty('visit_last_action_time'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this part is not 100% related to this PR. It refs matomo-org/matomo-for-wordpress#215 (comment) figured since it is related to visit last action time etc might fix that as well.
Code looks good, some system tests are failing though. |
@diosmosis just fixed the tests. They should pass now. I looked into it and the changed values are expected as it fixes an issue where eg when
And then it would falsely overwrite the last_visit_action_time Eg it first tracks an event where it adds 5 minutes: https://github.com/matomo-org/matomo/blob/3.13.5/tests/PHPUnit/Fixtures/ThreeVisitsWithCustomEvents.php#L134-L137 Then it tracks events where it adds only one minute or two minutes: https://github.com/matomo-org/matomo/blob/3.13.5/tests/PHPUnit/Fixtures/ThreeVisitsWithCustomEvents.php#L96-L106 And therefore it sets a lower |
@diosmosis fyi tests pass now |
* update idvisitor only when needed * better implementation * fix tests
* update idvisitor only when needed * better implementation * fix tests
On every log_visit update it will try to update the idvisitor with the same value. In theory even if there was no other value to update then it will do
updateVisit($idVisit, array('idvisitor' => '...'))
which be unneeded. As the value in most queries won't change this PR likely doesn't have an impact but be still good to have as it would avoid the need for checking that field on every log_visit update and if no other log_visit field is needed to be updated, then it avoids the query altogether.