#300: Fixed bug where description containing dots were not possible to add as predecessors.

This commit is contained in:
Henrik Bohre 2009-08-20 11:00:22 +02:00 committed by Eric Allen
parent 4ac3632fb9
commit db4c848512

View file

@ -93,10 +93,13 @@ class Todo < ActiveRecord::Base
# Split specification into parts: description <context, project>
parts = specification.split(%r{\ \<|; |\>})
return nil unless parts.length == 3
todos = Todo.all(:joins => [:project, :context],
:include => [:context, :project],
:conditions => {:description => parts[0],
:contexts => {:name => parts[1]}})
todos = Todo.all(
:joins => [:project, :context],
:conditions => {
:description => parts[0],
:contexts => {:name => parts[1]}
}
)
return nil if todos.empty?
# todos now contains all todos with matching description and context
# TODO: Is this possible to do with a single query?