Closed hexfusion closed 2 years ago
I suppose we can replace min_weight, max_weight with a generic min/max pair and add criteria to shipment rate.
So I'll using min_value, max_value and condition.
sounds good
https://gist.github.com/sbatschelet/9514389
I suppose the zipcode ranges doesn't match up with the states?
This makes me thinking about the following setup: break out the conditions(rules) out of ShipmentRate and put them into a separate table with has_many rules for ShipmentRate.
For UPS we would have two rules, one for zip range and one for weight, both combined by a parent rule (AND).
This leaves us with one shipment_method for UPS Ground, NextDay etc.
BTW: while looking for rules and trees in RDBMS, I ran across the following presentation:
http://www.slideshare.net/billkarwin/models-for-hierarchical-data
What do you think?
The alternative suggested by ribasushi on IRC are materialized paths (matpath in short):
http://bojanz.wordpress.com/2014/04/25/storing-hierarchical-data-materialized-path/
There is also a component for that approach:
How do we handle this?