foodcoop-adam / foodsoft

DEPRECATED, being merged in upstream. Web-based software for foodcoops - as used in NL.
http://foodcoop-adam.github.io/
Other
10 stars 3 forks source link

Implement weight / pc upstream #187

Open wvengen opened 3 years ago

wvengen commented 3 years ago

For foodcoops handling fresh produce, there is a need to enter amounts not in how many units, but in grams (or volume of liquid). This has been implemented in this fork with a unit - pieces switch, but needs to go upstream.

wvengen commented 3 years ago

Related issues:

wvengen commented 3 years ago

To understand, the foodcoop-adam fork has the current functionality.

The receive and distribute screens are part of the current_orders plugin, which is present in upstream Foodsoft already, but upstream it does not have the pc / weight switch shown here. Note that this is only implemented in the plugin, not in the order screen where you can edit group_order_article amounts.

Receive

Not implemented.

Distribute

'pc' is regular behaviour, you enter the amount in a number of times the unit. image

You can select 'g' here, which is parsed from a unit-parsing gem from the article unit. Since the unit is '90gr', it shows 'g'. image

So if you'd like to enter 180g, with regular behaviour ('pc' button) you'd need to enter 180g / 90g = 2. In unit-mode ('g'), you'd just enter 180g. This can save a lot of head-calculation and errors.

How this works internally is that a form sends a multiplier for each group_order_article, and the switch indicates if the multiplier is used or not.

Member orders

image

image

wvengen commented 3 years ago

In practice there are several kinds of articles with their own distribution flow.

Packaged by piece

Items that come packaged, where each item that is distributed to members has its own package, are well supported by the current Foodsoft approach: members can order by item, and items can be ordered from the supplier by unit quantity.

Packaged in bulk

Items that are packaged in large quantities like rice, flour, macaroni and raisins can be ordered from the supplier by package and distributed to members in smaller amounts. These smaller amounts are fixed amounts, so when bulk is per 10kg and members order per 100g, a member cannot order per 50g. But since the foodcoop can adjust this amount, it is no problem in practice.

Also, when distributing and the member gets 123g instead of 100g, this can still be entered in the system, even though it may require some head mental arithmetic.

Packaged by varying pieces

Some fresh produce like cabbage and pumpkin can be ordered from the supplier by weight (boxes) and distributed to members by piece having an average weight. If the pieces are about the same size, they can be handled as 'packaged by piece', but if they have very different sizes, it may be more fair to everyone to distribute by weight. This decision can only be made at receive or distribute time.

The current issue is mainly about 'packaged by varying pieces'.