i would just save the :sum of the price for each line in the db so you have acces at all time to the sum of that exact line items sum and wouldnt hurt so when creating or making changes just include the sum as an extra field so you can later just say rgs each items Product, linePrice_sum, :sum

1 Like