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

Check for valid asset before accessing properties #16003

Merged
merged 3 commits into from
Dec 26, 2024

Conversation

snipe
Copy link
Owner

@snipe snipe commented Dec 26, 2024

This fixes a rare 500 that can occur when the maintenances API is loaded, but the asset does not exist anymore. We see this most commonly in the demo, where the data can be unpredictable, and people can end up hitting the demo just as it's resetting/re-seeding.

Fixes RB-3934, RB-3759, RB-3935, and RB-3936.

Copy link

what-the-diff bot commented Dec 26, 2024

PR Summary

  • Improved Method Returns
    The returns of store, update, destroy, and show methods in the AssetMaintenancesController.php have been modified to be more versatile. These methods can now return either a JsonResponse or an array, expanding the flexibility of their use.

  • Better Null Handling
    Safety measures in AssetMaintenancesTransformer.php have been stepped up. Additional checks have been implemented to ensure the non-null status of the asset objects, which will reduce potential errors in the code.

  • Enhanced Date Formatting
    We've tweaked how deleted_at and created_at fields in the asset transformation are formatted. They now use the Helper::getFormattedDateObject method, which means that their formatting is more standardized and consistent.

  • Inclusion of Updated_at Field
    The asset transformation now has a new updated_at field. Like the other date fields, it uses the same date formatting function. This means our data set has more information than before.

  • Refined Conditional Checks
    We've made some improvements to the way we handle conditions involving asset status and certain fields. We refined how we check conditions, thus boosting the robustness and accuracy of our permission processes.

@snipe snipe merged commit 8fc1227 into develop Dec 26, 2024
9 checks passed
@snipe snipe deleted the asset_maintenance_api_fix branch December 26, 2024 10:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant