app/models/account.rb in has_accounts-0.8.2 vs app/models/account.rb in has_accounts-0.8.3

- old
+ new

@@ -49,13 +49,14 @@ Account.all.map{|a| a.to_s(value_range, format)} end # Calculations def turnover(selector = Date.today, inclusive = true) + equality = "=" if inclusive + if selector.is_a? Range or selector.is_a? Array if selector.first.is_a? Booking - equality = "=" if inclusive if selector.first.value_date == selector.last.value_date condition = ["date(value_date) = :value_date AND id >#{equality} :first_id AND id <#{equality} :last_id", { :value_date => selector.first.value_date, :first_id => selector.first.id, :last_id => selector.last.id @@ -80,14 +81,12 @@ }] end end else if selector.is_a? Booking - equality = "=" if inclusive # date(value_date) is needed on sqlite! condition = ["(value_date < :value_date) OR (date(value_date) = :value_date AND id <#{equality} :id)", {:value_date => selector.value_date, :id => selector.id}] else - equality = "=" if inclusive condition = ["date(value_date) <#{equality} ?", selector] end end credit_amount = credit_bookings.where(condition).sum(:amount)