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

Small consumables optimizations #15071

Merged
merged 23 commits into from
Jul 11, 2024
Merged

Conversation

snipe
Copy link
Owner

@snipe snipe commented Jul 11, 2024

This came up today for a customer where someone on their team was playing around with the system and created a quarter of a million consumables checkouts, which exposed a few query optimizations we could do. Since I was in there, I also tightened up some of the layout (we hadn't noticed it looked weird before) and added some more tests. I also added in a form request to make sure we cannot change the category type to a non-consumable type, either by fiddling with the DOM or via API.

I also realized that when we delete a consumable, we weren't actually detaching those pivot table records. 😬 We also weren't capturing the log meta for editing consumables, which we now do.

Still plenty of work to be done here, of course, but this should make things a little tighter.

snipe added 18 commits July 11, 2024 14:15
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Copy link

what-the-diff bot commented Jul 11, 2024

PR Summary

  • Introduced a new file for storing consumables
    A fresh file has been added. This file contains a new class that handles authorization and validation logic when storing consumables.

  • Updated functionality of the ConsumablesController
    Several updates have been made, including import adjustments, updating the methods with new type hints for better accuracy and efficiency. The index method was upgraded to include more relationships and counts. Sorting is now more straightforward with a hardcoded array for allowed columns. A store() and update() methods got updated to use new class for authorization.

  • Improvements in the ConsumableCheckoutController
    Unnecessary imports and aliases were cleared out. The create() method was modified for efficiency by only checking for the presence of the consumable without trying to authorize it.

  • Enhancements for ConsumablesController
    Additional adjustments were made here, including switching out imports and type hints to make method usage more appropriate and beneficial to the processes it's applied to. Notably, a user assignment is detached before a consumable gets deleted.

  • Addition of the ConsumableAssignment class
    A new class was added here to cover the user-consumable assignment relationship, complete with properties and validation logic additions to enhance overall function.

  • Updated Consumable model
    This update removed unnecessary imports and aliases, changed namespaces, added validation and brought about a new property to the Consumable class. Several methods were adjusted to ensure the use of the right namespace and attributes for better functionality.

  • Amended translatable message for invalid category type
    A new translation for the invalid_category_type is added to enhance user-friendly error messages and facilitate understanding.

  • Revamps to view files
    Updates to HTML and logic were performed to display additional information like consumable notes and markup. Conditional rendering for more user-targeted interaction has also been included.

  • Form editing amendments
    New error message sections were added to improve user understanding, and validation was improved with the allocation of maxlength attributes to input fields to prevent unwanted overflows.

  • Removal of duplicate test
    A assertOk() method call, which was duplicated, has been cleared to refine the testing process.

  • Introduction of new test cases
    New files have been added which contain multiple test cases for processes like updating and viewing consumables via different methods, enabling efficient validation and operation.

These updates aim to tighten the efficiency of the application processes, from storing and control features to the user-interface experience.

Signed-off-by: snipe <snipe@snipe.net>
@snipe snipe requested a review from uberbrady July 11, 2024 15:35
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.

This looks great! Nice work.

snipe added 2 commits July 11, 2024 16:46
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
snipe added 2 commits July 11, 2024 17:00
Signed-off-by: snipe <snipe@snipe.net>
@snipe snipe merged commit c5c5ac5 into develop Jul 11, 2024
8 checks passed
@snipe snipe deleted the fixes/small_consumables_optimizations branch July 11, 2024 16:27
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.

None yet

2 participants