Update print inventory view with indirect assignments table#18629
Update print inventory view with indirect assignments table#18629Godmartinz wants to merge 12 commits intogrokability:developfrom
Conversation
|
@Godmartinz I think the failing test needs to be updated. |
marcusmoore
left a comment
There was a problem hiding this comment.
There's a couple small fixes I outlined but I also noticed query count creeping up when more assignments exist. There's an n+1 in there somewhere.
It's kind of out of the scope of this PR but throwing \Illuminate\Database\EloquentModel::preventLazyLoading(); at the top of the controller method and reloading the page shows directLicenses.category is not eager loaded.
| ->withTrashed() | ||
| ->first(); | ||
|
|
||
| $indirectItemsCount = $user?->assets?->flatMap->assignedAssets->count() + $user?->assets?->flatMap->components->count() + $user?->assets?->flatMap->licenses->count() + $user?->assets?->flatMap->assignedAccessories->count(); |
There was a problem hiding this comment.
This caught my eye. I wonder if there is a way to have the database do the counting. I'm not sure off the top of my head.
There was a problem hiding this comment.
I didnt find a good/better solution to this.. this was less lines. But I am open to suggestions.
|
handling your requests @marcusmoore, Thanks. |
…d2assets # Conflicts: # app/Http/Controllers/ProfileController.php # app/Http/Controllers/Users/UsersController.php
This adds a table for Indirect Assignments, assets/accessories/licenses/components assigned to assets that are assigned to users, to the print inventory view