interchange / interchange6-schema

DBIC schema for Interchange 6
8 stars 7 forks source link

shipment rates based on subtotal #72

Closed hexfusion closed 2 years ago

hexfusion commented 10 years ago

How do we handle this?

racke commented 10 years ago

I suppose we can replace min_weight, max_weight with a generic min/max pair and add criteria to shipment rate.

racke commented 10 years ago

So I'll using min_value, max_value and condition.

hexfusion commented 10 years ago

sounds good

racke commented 10 years ago

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?

racke commented 10 years ago

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:

https://metacpan.org/pod/DBIx::Class::MaterializedPath