diff --git a/tracks/app/controllers/todos_controller.rb b/tracks/app/controllers/todos_controller.rb index bd3a3959..8bdb7e82 100644 --- a/tracks/app/controllers/todos_controller.rb +++ b/tracks/app/controllers/todos_controller.rb @@ -249,7 +249,7 @@ class TodosController < ApplicationController if tag_collection.empty? @todos = [] else - @todos = tag_collection.find(:all, :conditions => ['taggings.user_id = ?', @user.id]) + @todos = tag_collection.find(:all, :conditions => ['taggings.user_id = ? and state = ?', @user.id, 'active']) end @count = @todos.size unless @todos.empty? diff --git a/tracks/db/schema.rb b/tracks/db/schema.rb index ebc8cae2..ecc9fbf5 100644 --- a/tracks/db/schema.rb +++ b/tracks/db/schema.rb @@ -5,15 +5,14 @@ ActiveRecord::Schema.define(:version => 28) do create_table "contexts", :force => true do |t| - t.column "name", :string, :default => "", :null => false - t.column "hide", :integer, :limit => 4, :default => 0, :null => false - t.column "position", :integer, :default => 0, :null => false - t.column "user_id", :integer, :default => 0, :null => false + t.column "name", :string, :default => "", :null => false + t.column "position", :integer, :default => 0, :null => false + t.column "hide", :boolean, :default => false + t.column "user_id", :integer, :default => 1 t.column "created_at", :datetime t.column "updated_at", :datetime end - add_index "contexts", ["user_id"], :name => "index_contexts_on_user_id" add_index "contexts", ["user_id", "name"], :name => "index_contexts_on_user_id_and_name" create_table "notes", :force => true do |t| @@ -65,14 +64,13 @@ ActiveRecord::Schema.define(:version => 28) do create_table "projects", :force => true do |t| t.column "name", :string, :default => "", :null => false t.column "position", :integer, :default => 0, :null => false - t.column "user_id", :integer, :default => 0, :null => false + t.column "user_id", :integer, :default => 1 t.column "description", :text t.column "state", :string, :limit => 20, :default => "active", :null => false t.column "created_at", :datetime t.column "updated_at", :datetime end - add_index "projects", ["user_id"], :name => "index_projects_on_user_id" add_index "projects", ["user_id", "name"], :name => "index_projects_on_user_id_and_name" create_table "sessions", :force => true do |t| @@ -101,16 +99,16 @@ ActiveRecord::Schema.define(:version => 28) do add_index "tags", ["name"], :name => "index_tags_on_name" create_table "todos", :force => true do |t| - t.column "context_id", :integer, :default => 0, :null => false - t.column "description", :string, :limit => 100, :default => "", :null => false + t.column "context_id", :integer, :default => 0, :null => false + t.column "project_id", :integer + t.column "description", :string, :default => "", :null => false t.column "notes", :text t.column "created_at", :datetime t.column "due", :date t.column "completed_at", :datetime - t.column "project_id", :integer - t.column "user_id", :integer, :default => 0, :null => false + t.column "user_id", :integer, :default => 1 t.column "show_from", :date - t.column "state", :string, :limit => 20, :default => "immediate", :null => false + t.column "state", :string, :limit => 20, :default => "immediate", :null => false end add_index "todos", ["user_id", "state"], :name => "index_todos_on_user_id_and_state" @@ -120,10 +118,10 @@ ActiveRecord::Schema.define(:version => 28) do add_index "todos", ["user_id", "context_id"], :name => "index_todos_on_user_id_and_context_id" create_table "users", :force => true do |t| - t.column "login", :string, :limit => 80 - t.column "password", :string, :limit => 40 + t.column "login", :string, :limit => 80, :default => "", :null => false + t.column "password", :string, :limit => 40, :default => "", :null => false t.column "word", :string - t.column "is_admin", :integer, :limit => 4, :default => 0, :null => false + t.column "is_admin", :boolean, :default => false, :null => false t.column "first_name", :string t.column "last_name", :string t.column "auth_type", :string, :default => "database", :null => false diff --git a/tracks/test/fixtures/taggings.yml b/tracks/test/fixtures/taggings.yml index bc444fb1..6d5aa4d7 100644 --- a/tracks/test/fixtures/taggings.yml +++ b/tracks/test/fixtures/taggings.yml @@ -20,3 +20,10 @@ foo: taggable_id: 2 # Call dinosaur exterminator taggable_type: Todo user_id: 1 + +foo: + id: 4 + tag_id: 1 + taggable_id: 3 # Buy milk - completed + taggable_type: Todo + user_id: 1