Now creating periodic task via button

This commit is contained in:
Robert Waltemath 2013-06-21 13:48:48 +02:00
parent 4037ef12da
commit 6b62fc90d8
6 changed files with 10 additions and 12 deletions

View file

@ -1,5 +1,5 @@
class PeriodicTaskGroup < ActiveRecord::Base
has_many :tasks, :inverse_of => :periodic_task_group, :dependent => :destroy
has_many :tasks, :dependent => :destroy
PeriodDays = 7

View file

@ -2,7 +2,7 @@ class Task < ActiveRecord::Base
has_many :assignments, :dependent => :destroy
has_many :users, :through => :assignments
belongs_to :workgroup
belongs_to :periodic_task_group, :inverse_of => :tasks
belongs_to :periodic_task_group
scope :non_group, where(workgroup_id: nil, done: false)
scope :done, where(done: true)
@ -47,14 +47,10 @@ class Task < ActiveRecord::Base
end
end
def periodic
def periodic?
not periodic_task_group.nil?
end
def periodic=(p)
self.periodic_task_group = PeriodicTaskGroup.new if p == "1"
end
def is_assigned?(user)
self.assignments.detect {|ass| ass.user_id == user.id }
end