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

Fixed #9148 Checking Out Consumables doesn't decrease starting quantity #12491

Closed

Conversation

inietov
Copy link
Collaborator

@inietov inietov commented Feb 9, 2023

Description

A long time ago an user ask about some changes on the quantity of consumables that seems reasonable: The consumables doesn't need to be checkedin again, so the total and remaining quantities kinda made sense in the way they're implemented.

I adjusted the quantity to get decreased everytime a consumable is checked out. In the API and the GUI.
Alter a numRemaining function to return the Consumable->qty value directly.
Added a migration to adjust the previous consumables totals if consumables already used.
In the consumables index view, remove the remaining column, as doesn't really make sense anymore.

Fixes #9148

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Test Configuration:

  • PHP version: 8.2
  • MySQL version: 8.0.31
  • Webserver version: PHP dev server
  • OS version: Debian 11

@what-the-diff
Copy link

what-the-diff bot commented Feb 9, 2023

  • The qty field in the consumables table is updated when a user checks out an item.
  • A new migration was added to adjust all existing quantities of items that have been checked out by users, so they are accurate with what's actually available for checkout now (since we're updating them on checkouts).
  • In ConsumablePresenter class, removed remaining column from datatable layout since it wasn't being used anymore and caused confusion as to why there were more items than expected showing up in the list view after this change went into effect (because it showed total + numCheckedOut() instead of just total)

@snipe
Copy link
Owner

snipe commented Mar 10, 2023

Would this end up with a potentially negative number, or potentially a division by 0 number?

@inietov
Copy link
Collaborator Author

inietov commented Mar 14, 2023

Would this end up with a potentially negative number, or potentially a division by 0 number?

You mean the migration?

@inietov
Copy link
Collaborator Author

inietov commented Mar 15, 2023

I think this should be enough? Waiting for feedback in case is not :)

@Glukose1
Copy link

I agree here; the current workflow with the remaining and total is a bit complicated for my liking. I either have to create a new consumable for every batch of toner I order or start doing the math when buying new cartridges and adding them to the quantity for the remaining value to be correct.

Would be nice if this is merged in the future.

@snipe
Copy link
Owner

snipe commented Jul 20, 2024

I think we're going to solve this is a slightly different way.

@snipe snipe closed this Jul 20, 2024
@inietov
Copy link
Collaborator Author

inietov commented Jul 20, 2024

Yeah, I figured :P
Thanks for let me know!

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.

3 participants