Feature #1201

Better Weight/Decimal Formatting

Added by Pavan Rikhi about 2 years ago. Updated 3 months ago.

Status:ClosedStart date:09/06/2019
Priority:NormalDue date:09/07/2019
Assignee:Pavan Rikhi% Done:


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


Numbers like 5.000g are shown. Remove the trailing zeros & decimal so we get 5g.

Also Irena sent a list of certain weights that should be displayed in some thing other than grams(e.g. turn 454g into 1 lb.. Implement that.

Associated revisions

Revision 17221d8b
Added by Pavan Rikhi 3 months ago

[#1201] Add Export for Odd Variant Weights

Add an `export-odd-weights` script to export data for ProductVariants
with a LotSize Mass of 0, or with Masses greater than 42g that don't fit
the prettifying scheme in the client(which turns 454000mg into 1lb,

Refs #1201

Revision da2ef287
Added by Pavan Rikhi 3 months ago

[#1201] Prettify Formatting for Variant Weights

Modify the milligramsToString function to output prettified pound
amounts(e.g., 1 lb for 454g) for specific weight amounts. Improve the
display of the gram amounts by removing trailing zeros after the decimal

Closes #1201


#1 Updated by Pavan Rikhi 4 months ago

  • Target version changed from v1.00.00 - Deployment to v0.7.0 - Misc Pages & UI

From Irena:

All weights up to 42 grams remain in grams. Larger weights are in pounds:

  • 1/4 lb = 114g
  • 1/2 lb = 228g
  • 3/4 lb = 342g
  • 1 lb = 454g
  • 1.25lb = 568g
  • 1.5lb = 680g
  • 2 lb = 908g
  • 2.5lb = 1135g
  • 4 lb = 1816g
  • 5 lb = 2270g

This query shows all weights of active variants:

SELECT COUNT(*), lot_size
FROM "product_variant" 
WHERE is_active=true
GROUP BY lot_size
ORDER BY "lot_size" DESC

I should make an export of weights that are slightly off from the above list(2268g, 500g, 682g, etc.). Full SKU, Name, Mass(g)

#2 Updated by Pavan Rikhi 3 months ago

  • % Done changed from 0 to 100
  • Status changed from New to Closed

#3 Updated by Pavan Rikhi 3 months ago

  • Start date set to 09/06/2019
  • Due date set to 09/07/2019

Also available in: Atom PDF