From: Tomas Sedovic <[email protected]>

Task used to validate correctly in situations where it had the "time_ended"
attribute set and "time_started" was nil. And similarly for "time_started"
vs."created_at".
---
 src/app/models/task.rb |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/app/models/task.rb b/src/app/models/task.rb
index 5e907a0..6cb907e 100644
--- a/src/app/models/task.rb
+++ b/src/app/models/task.rb
@@ -93,6 +93,8 @@ class Task < ActiveRecord::Base
   end
 
   def validate
+    errors.add("created_at", "Task started but does not have the creation time 
set") if time_started and created_at.nil?
+    errors.add("time_started", "Task ends but does not have the start time 
set") if time_ended and time_started.nil?
     errors.add("time_ended", "Tasks ends before it's started") unless 
time_ended.nil? or time_started.nil? or time_ended > time_started
     errors.add("time_started", "Tasks starts before it's created") unless 
time_started.nil? or created_at.nil? or time_started > created_at
   end
-- 
1.6.6.1

_______________________________________________
deltacloud-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/deltacloud-devel

Reply via email to