rubyforgood / human-essentials

Human Essentials is an inventory management system for diaper, incontinence, and period-supply banks. It supports them in distributing to partners, tracking inventory, and reporting stats and analytics.
https://humanessentials.app
MIT License
464 stars 492 forks source link

[BUG] able to enter negative values in distributions and donations. Shouldn't be able to #4487

Open cielf opened 4 months ago

cielf commented 4 months ago

Summary

Should not be able to have negative values for line items in distributions, donations, purchases, transfers, audits, kits

Why

Those values are just invalid in context.

Details

Note that there are line items where we should be able to have negative values, though. Specifically Inventory Adjustments and kit allocations. All other line items should not have negative values in them.

We consider this a high beginner difficulty -- manual testing it out will give you a lot of exercise of the system.

Criteria for completion

mgrigoriev8109 commented 4 months ago

Can I work on this @cielf ?

topeogunleye commented 4 months ago

Can I work on this @cielf ?

Hi @mgrigoriev8109, I would love to be able to join you on a video call, and see you work on this by sharing your screen. If we can collaborate, I'll love to do that also.

cielf commented 4 months ago

@mgrigoriev8109 Please do!

mgrigoriev8109 commented 4 months ago

Sorry @topeogunleye , I don't have much bandwidth at the moment so I'm mostly trying to contribute asynchronously. Are you comfortable working in Ruby, or do you need some resources to familiarize yourself with the language?

In general open source projects are great learning opportunities - but it's helpful to have familiarity with a language before diving into a large codebase.

topeogunleye commented 4 months ago

Hi @mgrigoriev8109, Yes!, I have more than a year of working with Ruby and Ruby on Rails and more than 6 months experience of being a code reviewer for Ruby and Ruby on Rails projects. With this experience, I feel more than comfortable with Ruby.

mgrigoriev8109 commented 4 months ago

@cielf Figured I'd ask about the other inputs in the codebase since this issue mentions most of them already.

So these questions are when a user is logged in as an Organization Admin ( org_admin1@example.com )

  1. When adding a New Partner Agency under Partner Agencies → All Partners, should the user be allowed to enter a negative quota?
  2. When adding a New Item under Inventory → Item Types, should the user be allowed to enter negative values for any of the fields ( Value per item, Quantities, package size )
  3. For kit allocations, should the user be allowed to enter a negative kit value and a negative quantity?
  4. When adding a new barcode item, should user be allowed to enter negative quantity?
  5. When adding a new storage location should user be allowed to enter negative square footage?

And then the follow-up question is if these fields also require validation, if I should add it in the same PR, or do a new PR.

cielf commented 4 months ago

Thanks for catching these -- most are out of out of scope for this change,

cielf commented 4 months ago

Kit allocations should be allowed to have a negative quantity, though. This represents a bank de-constructing some kits and putting the components back into inventory. Doesn't happen very often at all, but it can.

The rest should not be negative.

cielf commented 4 months ago

And, I'll followup by checking the rest of those and putting any that aren't right in out backlog of issues (they'll mostly be Good First Issue fodder, I think.)

mgrigoriev8109 commented 4 months ago

Sounds good. Just realized this issue only dealt with line items not being negative, some other ones can also be added to the backlog of issues might be:

github-actions[bot] commented 3 months ago

This issue is marked as stale due to no activity within 30 days. If no further activity is detected within 7 days, it will be unassigned.

cielf commented 3 months ago

Have checked the above, and added those that are not right to our deep backlog of issues to be written up.

github-actions[bot] commented 2 months ago

This issue is marked as stale due to no activity within 30 days. If no further activity is detected within 7 days, it will be unassigned.

github-actions[bot] commented 2 months ago

Automatically unassigned after 7 days of inactivity.