Class: Project

Inherits:
Sequel::Model
  • Object
show all
Defined in:
lib/kale/project.rb

Instance Method Summary collapse

Instance Method Details

#total_earnedObject



10
11
12
# File 'lib/kale/project.rb', line 10

def total_earned
  "$" + sprintf("%.2f", self.rate_per_hour.to_f * (total_time.to_f / 3600))
end

#total_timeObject



5
6
7
8
# File 'lib/kale/project.rb', line 5

def total_time
  times = self.sessions.collect { |s| s[:elapsed_time] }
  times.inject{ |sum,x| sum + x }
end