From 21091e914e964e087ef3c9e4690155c19fc78646 Mon Sep 17 00:00:00 2001 From: Paul van Tilburg Date: Sat, 18 Oct 2014 21:25:51 +0200 Subject: [PATCH] Fix broken period calculation initialisation --- stoptime.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/stoptime.rb b/stoptime.rb index bfecec8..5a62e81 100644 --- a/stoptime.rb +++ b/stoptime.rb @@ -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]