From f9a0ee323ee9d4d913dfaaef4256678b2cf1148a Mon Sep 17 00:00:00 2001 From: Paul van Tilburg Date: Tue, 29 Nov 2011 16:47:16 +0100 Subject: [PATCH] Also show total of hours for fixed cost tasks --- stoptime.rb | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/stoptime.rb b/stoptime.rb index 68d756a..0ad6209 100644 --- a/stoptime.rb +++ b/stoptime.rb @@ -174,7 +174,8 @@ module StopTime::Models def summary case type when "fixed_cost" - [nil, nil, fixed_cost] + total = time_entries.inject(0.0) { |summ, te| summ + te.hours_total } + [total, nil, fixed_cost] when "hourly_rate" time_entries.inject([0.0, hourly_rate, 0.0]) do |summ, te| summ[0] += te.hours_total @@ -1193,14 +1194,8 @@ module StopTime::Views :href => R(CustomersNTasksN, customer.id, task.id) end summary = task.summary - case task.type - when "fixed_rate" - td "" - td.right { "€ %.2f" % summary[2] } - when "hourly_rate" - td.right { "%.2fh" % summary[0] } - td.right { "€ %.2f" % summary[2] } - end + td.right { "%.2fh" % summary[0] } + td.right { "€ %.2f" % summary[2] } end end end