Fixed #6634: Asset Import History fixes and optimizations #6657
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I took a quick stab at fixing asset history imports.
Assumptions made:
-Asset history is coming from a previous management system.
-It isn't historical unless it has both a checkout and a checkin (sysadmin can fudge a checkin date if they don't have this information in previous system)
-The history importer no longer assigns assets (this can be done using the regular importer)
Optimizations made:
-Removed second iteration of asset import list, including all business attempting to 'magically' create past checkin dates
-Removed creation of, potentially giant, $items array
-Removed username matching schemes and only use that which is configured in settings
-CSV is sorted using league/csv statement filters (in post) on username to reduce db or cache calls
-Asset and User query results (both hits and misses) are cached (for 1 minute) to avoid duplicate queries
-Some better controls around date conversions included