Skip to content
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

Switch to bulk updating to handle audit interval updates #14227

Merged
merged 2 commits into from
Feb 6, 2024

Conversation

snipe
Copy link
Owner

@snipe snipe commented Feb 6, 2024

In the previous behavior, when you change the audit interval, it would loop through the assets and update the relative new next_audit_date as needed based on the new interval value.

This switches to using a mass update and DB::raw() - which I normally hate doing, but for users with 40k assets, anything else (short of building in a queueing system) simply won't work.

I don't love that this doesn't hit the observer, so you won't see these as edits to the asset in the asset history, but if you're editing 10k assets, that might junk up your history report anyway.

Signed-off-by: snipe <[email protected]>
Copy link
Collaborator

@uberbrady uberbrady left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent work! This should make short work of any of those users who have lots of assets that they're auditing. I did note that you can probably pull the Carbon\Carbon use line, but that's no big deal anyways. Thank you for handling this!

@@ -28,6 +28,7 @@
use Illuminate\Support\Str;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Validator;
use Carbon\Carbon;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can pull this, but it's no big deal.

@snipe snipe merged commit 1630e4b into develop Feb 6, 2024
8 checks passed
@snipe snipe deleted the fixes/bulk_update_by_audit_interval branch February 6, 2024 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants