-
-
Notifications
You must be signed in to change notification settings - Fork 812
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
Optimize Change Log Viewing For A Contact #31125
base: master
Are you sure you want to change the base?
Optimize Change Log Viewing For A Contact #31125
Conversation
🤖 Thank you for contributing to CiviCRM! ❤️ We will need to test and review this PR. 👷 Introduction for new contributors...
Quick links for reviewers...
|
$logEntries[] = [ | ||
'id' => $log->modified_id, | ||
'name' => $displayName, | ||
'image' => $contactImage, | ||
'name' => $log->modified_id && $modifiers[$log->modified_id]['name'] ? $modifiers[$log->modified_id]['name'] : '', |
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.
I think this should be better done as $modifiers[$log->modified_id]['name'] ?? ''
right @eileenmcnaughton ?
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.
I agree. @shahrukh-compuco can you make that change please?
Overview
This pr optimizes the code for viewing the change logs for a contact.
Technical Details
Currently during fetching the change log for a contact we also fetch information for modifier contact here once for each row from the log table. This can give timeout errors on big databases as each call to the function getDisplayAndImage results in one query being executed. Even if same modifier changed the one contact multiple times we will have multiple queries for fetching same information for same modifier.
This pr changes the code to store the modifier information in an array and only query the modifier info if its not already available in the array thus results in significantly lesser number of queries for large change logs.