Add validation for task.done in combination with periodic task.

This commit is contained in:
Robert Waltemath 2013-06-22 18:56:17 +02:00
parent a7fd7a7936
commit 577945e591
1 changed files with 2 additions and 0 deletions

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
class Task < ActiveRecord::Base
has_many :assignments, :dependent => :destroy
has_many :users, :through => :assignments
@ -17,6 +18,7 @@ class Task < ActiveRecord::Base
validates :required_users, :presence => true
validates_numericality_of :duration, :required_users, :only_integer => true, :greater_than => 0
validates_length_of :description, maximum: 250
validates :done, exclusion: { in: [true], message: 'erledigte Aufgaben können nicht wöchentlich wiederholt werden' }, if: :periodic?
before_save :exclude_from_periodic_task_group
after_save :update_ordergroup_stats