Fix broken period calculation initialisation

This commit is contained in:
Paul van Tilburg 2014-10-18 21:25:51 +02:00
parent 3e1ed8af58
commit 21091e914e
1 changed files with 3 additions and 2 deletions

View File

@ -402,8 +402,9 @@ module StopTime::Models
# See also Task#bill_period.
def period
# FIXME: maybe should be updated_at?
return [created_at, created_at] if tasks.empty?
p = tasks.first.bill_period
p = [created_at, created_at]
return p if tasks.empty?
tasks.each do |task|
tp = task.bill_period
p[0] = tp[0] if tp[0] < p[0]