Advanced logging detail report improvement
This issue relates to a discussion we had in CiviCRM Dev channel where it was being identified that when we got advanced logging activated and a contact triggered batch updates/changes, the detailed report most of the time does not work due to extremely long delays.
That case applies if the target system is having many contact records.
Example use-case / How to reproduce
That's a little bit difficult to reproduce due to data sizes but here are the requirements to see the make it:
- Have detailed logging enabled
- Batch import and/or update 5k-10k contacts (more is better!)
- Go to the contact that did run the import
- Go to his/her "Changelog" tab and click on the 'update' link ('View details for this update')
This link should try to render the report
logging/contact/detail (which points to
CRM_Logging_ReportDetail (link here)
- If the records associated are too many, the report will never finish in a timely manner
- The same issue happens if we hover to the icon next to the action in the changelog tab
- Show a list of 50 records per page by adding limit and pagers
- Render a pager on table list
- Disable the pager if layout is overlay (thus limiting the output to 50 rows max in overlay/hover mode)
As those 50 records per page are showing contacts that might have more than 1 change (change in multiple fields), we're grouping the change entries per contact ID so that we can keep them and then we are concatenating the results on the final table/overlay (tpl) using divs. This will help us maintain a consistency on the records vs rows listed on each page.
Since the main purpose of the overlay is just to show a preview (and not a complete listing), we are not going to use a pager on that display.