Tweaked the model a bit (forgotten the hourly_rate attribute).
This commit is contained in:
parent
adb1896506
commit
5f0ae36745
|
@ -79,15 +79,21 @@ module StopTime::Models
|
||||||
def fixed_cost?
|
def fixed_cost?
|
||||||
not self.fixed_cost.blank?
|
not self.fixed_cost.blank?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def task_type
|
||||||
|
fixed_cost? ? "fixed_cost" : "hourly_rate"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class TimeEntry < Base
|
class TimeEntry < Base
|
||||||
belongs_to :task
|
belongs_to :task
|
||||||
|
has_one :customer, :through => :task
|
||||||
has_one :invoice
|
has_one :invoice
|
||||||
end
|
end
|
||||||
|
|
||||||
class Invoice < Base
|
class Invoice < Base
|
||||||
has_many :time_entries
|
has_many :time_entries
|
||||||
|
has_many :tasks, :through => :time_entries
|
||||||
belongs_to :customer
|
belongs_to :customer
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -153,11 +159,13 @@ module StopTime::Models
|
||||||
def self.up
|
def self.up
|
||||||
add_column(Task.table_name, :billed, :boolean)
|
add_column(Task.table_name, :billed, :boolean)
|
||||||
add_column(Task.table_name, :fixed_cost, :float)
|
add_column(Task.table_name, :fixed_cost, :float)
|
||||||
|
add_column(Task.table_name, :hourly_rate, :float)
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.down
|
def self.down
|
||||||
remove_column(Task.table_name, :billed)
|
remove_column(Task.table_name, :billed)
|
||||||
remove_column(Task.table_name, :fixed_cost)
|
remove_column(Task.table_name, :fixed_cost)
|
||||||
|
remove_column(Task.table_name, :hourly_rate, :float)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue