From e4202b80485fe7c9c870f6c846471fe89e98662f Mon Sep 17 00:00:00 2001 From: Paul van Tilburg Date: Fri, 2 Dec 2011 22:16:27 +0100 Subject: [PATCH] Added Task#comment_or_name to return the comment if set and the task is billed --- stoptime.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/stoptime.rb b/stoptime.rb index c2a8154..ad4d327 100644 --- a/stoptime.rb +++ b/stoptime.rb @@ -184,6 +184,16 @@ module StopTime::Models end end end + + # Returns an invoice comment if the task is billed and if it is + # set, otherwise the name. + def comment_or_name + if billed? and self.invoice_comment.present? + self.invoice_comment + else + self.name + end + end end # == The time entry class