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
447 stars 474 forks source link

Add models to support request units #4306

Closed dorner closed 4 months ago

dorner commented 5 months ago

Resolves #4096

Description

This creates the models and fields necessary to support reporting units. For now this is a model-only change. This adds some simple validations and specs for them, as well as seed data.

cielf commented 5 months ago

@dorner Hrm. I have to apologize -- I didn't come back into this issue and address the fact that we had settled on just "units" for the default units.

cielf commented 5 months ago

@dorner I think we're going to need something on ItemRequest as well -- that' s the level that the packs or whatever will actually be requested.

dorner commented 4 months ago

@cielf not sure how using "units" as the default changes anything... that should be purely on the display side. We said that we'd stick with null to indicate "no request unit" (which corresponds to "unit").

I've added the item request piece.

cielf commented 4 months ago

@cielf not sure how using "units" as the default changes anything... that should be purely on the display side. We said that we'd stick with null to indicate "no request unit" (which corresponds to "unit").

Well, the description in the issue of what's required for the seed indicates diapers,and pads, rather than units. That would change.

dorner commented 4 months ago

I've already addressed that in the seed - the defaults don't include diaper.

cielf commented 4 months ago

@dorner Cool. I also think we don't need "reporting unit" on item -- that would always be "unit" , the way we are thinking of things now, right?

dorner commented 4 months ago

@cielf pushed the fixes! So now it seems like all we have are organization request units, and a specific request unit selected on an item request. And the only validation is that the request unit on the item request needs to exist on the org.

cielf commented 4 months ago

Hmm. That doesn't sound right? Let me take another look. We may have had a terminology mixup.

awwaiid commented 4 months ago

Ooops wrong PR. @cielf changes not addressed :)

dorner commented 4 months ago

@cielf updated!

cielf commented 4 months ago

@dorner This is nitpicky and maybe a bit out of scope -- I ran the setup, and inspected the results -- I see a request with two ItemRequests for pads with different units. If we go forward in time to Packs #2, we aren't going to allow that. So maybe we should just have one level of item (in this case either packs or units) for each item on a request to avoid new developer confusion later?

awwaiid commented 4 months ago

I'm ok with this as-is and can help make sure that packs-#2 doesn't get confused based on the existing test data.

cielf commented 4 months ago

I'm ok with this as-is and can help make sure that packs-#2 doesn't get confused based on the existing test data.

WE'll need to add fixing the seed to packs #2, then, right? Sorry -- #3. I have added a note about the seed ti it.

github-actions[bot] commented 4 months ago

@dorner: Your PR Add models to support request units is part of today's Human Essentials production release: 2024.05.26. Thank you very much for your contribution!