Feature #1403

Show Lot Quantities Instead of Weights for Some Products

Added by Pavan Rikhi 12 months ago. Updated 4 months ago.

Status:ClosedStart date:08/31/2019
Priority:NormalDue date:09/01/2019
Assignee:Pavan Rikhi% Done:


Category:ProductsSpent time:-
Target version:v0.7.0 - Misc Pages & UI
Easy Pickings:


E.g., for mushroom spawn we want to show things like "100 plugs", not "0.00g".

Make the weight field an amount field/type with weight or custom label constructors?
E.g., type ProductAmount = Mass Milligrams | Custom Integer Text.

Or should we hardcode all possible types & show a "amount type" dropdown on the admin page? E.g. type ProductAmount = Mass Milligrams | Plugs Amount.

After reviewing old product names, this should be good enough for now. Later, we can add more standardized options if necessary/common.

data LotSize
  = Mass Milligrams
  | Bulbs Integer
  | Slips Integer
  | Plugs Integer
  | CustomLotSize Text

  lotSize LotSize Maybe

Related issues

Duplicated by SESE Website - Feature #1202: Allow Hiding of Weights & Custom Variant Descriptions Duplicate

Associated revisions

Revision 12aeb7e6
Added by Pavan Rikhi 4 months ago

[#1403] Support Multiple Lot Size Descriptions

Modify the ProductVariant model so that variants can be described in
other ways than just milligrams by replacing the weight field with a
lotSize field. Add a LotSize type to the Models.Fields module with
built-in support for Mass, Bulb/Slip/Plug counts, custom text, & blank

Modify the routes returning Variants to use the new lotSize field insted
of the weight field.

Modify the DataMigration script so that blank values are given for the
LotSize if the old Product's weight is 0.

Refs #1403

Revision 78d13feb
Added by Pavan Rikhi 4 months ago

[#1403] Show Lot Sizes Instead of Variant Weights

Modify the client to decode & display the new lotSize field for Product
Variants instead of the removed weight field. A LotSize type has been
added to the Models.Fields module, along with a decoder & string
conversion function.

Modify the milligramsToString function to append the "g" suffix(grams)
to the returned string.

Closes #1403


#1 Updated by Pavan Rikhi 4 months ago

Check each product for what label the lot quantity should be. Rename the weight field to lotQuantity and use a sum type. Leave custom text out for now.

Make the lotQuantity nullable so we don't need one for things like Catalogs?

#2 Updated by Pavan Rikhi 4 months ago

  • Start date set to 08/31/2019
  • Status changed from New to In Progress
  • Description updated (diff)

#3 Updated by Pavan Rikhi 4 months ago

  • % Done changed from 0 to 100
  • Status changed from In Progress to Closed

#4 Updated by Pavan Rikhi 4 months ago

  • Due date set to 09/01/2019

#5 Updated by Pavan Rikhi 3 months ago

  • Duplicated by Feature #1202: Allow Hiding of Weights & Custom Variant Descriptions added

Also available in: Atom PDF