Skip to content
Browse files

Fix ChargeRate.valid_at for rates no duration_from.

  • Loading branch information...
1 parent d5d7522 commit 03afb6a375ba360fc5f669b8336046ad9bbd5c48 @huerlisi committed May 4, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 app/models/charge_rate.rb
View
2 app/models/charge_rate.rb
@@ -25,7 +25,7 @@ def rate_to_s
default_scope order('duration_from DESC')
# Validity
- scope :valid_at, lambda {|value| where("duration_from <= :date AND (duration_to IS NULL OR duration_to > :date)", :date => value) }
+ scope :valid_at, lambda {|value| where("(duration_from IS NULL OR duration_from <= :date) AND (duration_to IS NULL OR duration_to > :date)", :date => value) }
scope :valid, lambda { valid_at(Date.today) }
scope :latest, group(:code, :person_id)

0 comments on commit 03afb6a

Please sign in to comment.
Something went wrong with that request. Please try again.