Commit ae2233b1 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Improve perfomance by using project.last_activity_at in project_last_activity helper

parent 0f2798d4
...@@ -151,9 +151,8 @@ module ApplicationHelper ...@@ -151,9 +151,8 @@ module ApplicationHelper
end end
def project_last_activity project def project_last_activity project
activity = project.last_activity if project.last_activity_at
if activity && activity.created_at time_ago_in_words(project.last_activity_at) + " ago"
time_ago_in_words(activity.created_at) + " ago"
else else
"Never" "Never"
end end
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
# It's strongly recommended to check this file into your version control system. # It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20130404164628) do ActiveRecord::Schema.define(:version => 20130404164628) do
create_table "events", :force => true do |t| create_table "events", :force => true do |t|
t.string "target_type" t.string "target_type"
t.integer "target_id" t.integer "target_id"
...@@ -36,8 +37,8 @@ ActiveRecord::Schema.define(:version => 20130404164628) do ...@@ -36,8 +37,8 @@ ActiveRecord::Schema.define(:version => 20130404164628) do
t.integer "assignee_id" t.integer "assignee_id"
t.integer "author_id" t.integer "author_id"
t.integer "project_id" t.integer "project_id"
t.datetime "created_at", :null => false t.datetime "created_at"
t.datetime "updated_at", :null => false t.datetime "updated_at"
t.integer "position", :default => 0 t.integer "position", :default => 0
t.string "branch_name" t.string "branch_name"
t.text "description" t.text "description"
...@@ -54,8 +55,8 @@ ActiveRecord::Schema.define(:version => 20130404164628) do ...@@ -54,8 +55,8 @@ ActiveRecord::Schema.define(:version => 20130404164628) do
create_table "keys", :force => true do |t| create_table "keys", :force => true do |t|
t.integer "user_id" t.integer "user_id"
t.datetime "created_at", :null => false t.datetime "created_at"
t.datetime "updated_at", :null => false t.datetime "updated_at"
t.text "key" t.text "key"
t.string "title" t.string "title"
t.string "identifier" t.string "identifier"
...@@ -73,8 +74,8 @@ ActiveRecord::Schema.define(:version => 20130404164628) do ...@@ -73,8 +74,8 @@ ActiveRecord::Schema.define(:version => 20130404164628) do
t.integer "author_id" t.integer "author_id"
t.integer "assignee_id" t.integer "assignee_id"
t.string "title" t.string "title"
t.datetime "created_at", :null => false t.datetime "created_at"
t.datetime "updated_at", :null => false t.datetime "updated_at"
t.text "st_commits", :limit => 2147483647 t.text "st_commits", :limit => 2147483647
t.text "st_diffs", :limit => 2147483647 t.text "st_diffs", :limit => 2147483647
t.integer "milestone_id" t.integer "milestone_id"
...@@ -123,8 +124,8 @@ ActiveRecord::Schema.define(:version => 20130404164628) do ...@@ -123,8 +124,8 @@ ActiveRecord::Schema.define(:version => 20130404164628) do
t.text "note" t.text "note"
t.string "noteable_type" t.string "noteable_type"
t.integer "author_id" t.integer "author_id"
t.datetime "created_at", :null => false t.datetime "created_at"
t.datetime "updated_at", :null => false t.datetime "updated_at"
t.integer "project_id" t.integer "project_id"
t.string "attachment" t.string "attachment"
t.string "line_code" t.string "line_code"
...@@ -142,8 +143,8 @@ ActiveRecord::Schema.define(:version => 20130404164628) do ...@@ -142,8 +143,8 @@ ActiveRecord::Schema.define(:version => 20130404164628) do
t.string "name" t.string "name"
t.string "path" t.string "path"
t.text "description" t.text "description"
t.datetime "created_at", :null => false t.datetime "created_at"
t.datetime "updated_at", :null => false t.datetime "updated_at"
t.integer "creator_id" t.integer "creator_id"
t.string "default_branch" t.string "default_branch"
t.boolean "issues_enabled", :default => true, :null => false t.boolean "issues_enabled", :default => true, :null => false
...@@ -187,8 +188,8 @@ ActiveRecord::Schema.define(:version => 20130404164628) do ...@@ -187,8 +188,8 @@ ActiveRecord::Schema.define(:version => 20130404164628) do
t.text "content" t.text "content"
t.integer "author_id", :null => false t.integer "author_id", :null => false
t.integer "project_id", :null => false t.integer "project_id", :null => false
t.datetime "created_at", :null => false t.datetime "created_at"
t.datetime "updated_at", :null => false t.datetime "updated_at"
t.string "file_name" t.string "file_name"
t.datetime "expires_at" t.datetime "expires_at"
end end
...@@ -207,9 +208,6 @@ ActiveRecord::Schema.define(:version => 20130404164628) do ...@@ -207,9 +208,6 @@ ActiveRecord::Schema.define(:version => 20130404164628) do
t.datetime "created_at" t.datetime "created_at"
end end
add_index "taggings", ["tag_id"], :name => "index_taggings_on_tag_id"
add_index "taggings", ["taggable_id", "taggable_type", "context"], :name => "index_taggings_on_taggable_id_and_taggable_type_and_context"
create_table "tags", :force => true do |t| create_table "tags", :force => true do |t|
t.string "name" t.string "name"
end end
...@@ -241,42 +239,41 @@ ActiveRecord::Schema.define(:version => 20130404164628) do ...@@ -241,42 +239,41 @@ ActiveRecord::Schema.define(:version => 20130404164628) do
end end
create_table "users", :force => true do |t| create_table "users", :force => true do |t|
t.string "email", :default => "", :null => false t.string "email", :default => "", :null => false
t.string "encrypted_password", :default => "", :null => false t.string "encrypted_password", :limit => 128, :default => "", :null => false
t.string "reset_password_token" t.string "reset_password_token"
t.datetime "reset_password_sent_at" t.datetime "reset_password_sent_at"
t.datetime "remember_created_at" t.datetime "remember_created_at"
t.integer "sign_in_count", :default => 0 t.integer "sign_in_count", :default => 0
t.datetime "current_sign_in_at" t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at" t.datetime "last_sign_in_at"
t.string "current_sign_in_ip" t.string "current_sign_in_ip"
t.string "last_sign_in_ip" t.string "last_sign_in_ip"
t.datetime "created_at", :null => false t.datetime "created_at"
t.datetime "updated_at", :null => false t.datetime "updated_at"
t.string "name" t.string "name"
t.boolean "admin", :default => false, :null => false t.boolean "admin", :default => false, :null => false
t.integer "projects_limit", :default => 10 t.integer "projects_limit", :default => 10
t.string "skype", :default => "", :null => false t.string "skype", :default => "", :null => false
t.string "linkedin", :default => "", :null => false t.string "linkedin", :default => "", :null => false
t.string "twitter", :default => "", :null => false t.string "twitter", :default => "", :null => false
t.string "authentication_token" t.string "authentication_token"
t.integer "theme_id", :default => 1, :null => false t.integer "theme_id", :default => 1, :null => false
t.string "bio" t.string "bio"
t.integer "failed_attempts", :default => 0 t.integer "failed_attempts", :default => 0
t.datetime "locked_at" t.datetime "locked_at"
t.string "extern_uid" t.string "extern_uid"
t.string "provider" t.string "provider"
t.string "username" t.string "username"
t.boolean "can_create_group", :default => true, :null => false t.boolean "can_create_group", :default => true, :null => false
t.boolean "can_create_team", :default => true, :null => false t.boolean "can_create_team", :default => true, :null => false
t.string "state" t.string "state"
t.integer "color_scheme_id", :default => 1, :null => false t.integer "color_scheme_id", :default => 1, :null => false
t.integer "notification_level", :default => 1, :null => false t.integer "notification_level", :default => 1, :null => false
end end
add_index "users", ["admin"], :name => "index_users_on_admin" add_index "users", ["admin"], :name => "index_users_on_admin"
add_index "users", ["email"], :name => "index_users_on_email", :unique => true add_index "users", ["email"], :name => "index_users_on_email", :unique => true
add_index "users", ["extern_uid", "provider"], :name => "index_users_on_extern_uid_and_provider", :unique => true
add_index "users", ["name"], :name => "index_users_on_name" add_index "users", ["name"], :name => "index_users_on_name"
add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true
add_index "users", ["username"], :name => "index_users_on_username" add_index "users", ["username"], :name => "index_users_on_username"
...@@ -284,8 +281,8 @@ ActiveRecord::Schema.define(:version => 20130404164628) do ...@@ -284,8 +281,8 @@ ActiveRecord::Schema.define(:version => 20130404164628) do
create_table "users_projects", :force => true do |t| create_table "users_projects", :force => true do |t|
t.integer "user_id", :null => false t.integer "user_id", :null => false
t.integer "project_id", :null => false t.integer "project_id", :null => false
t.datetime "created_at", :null => false t.datetime "created_at"
t.datetime "updated_at", :null => false t.datetime "updated_at"
t.integer "project_access", :default => 0, :null => false t.integer "project_access", :default => 0, :null => false
t.integer "notification_level", :default => 3, :null => false t.integer "notification_level", :default => 3, :null => false
end end
...@@ -297,8 +294,8 @@ ActiveRecord::Schema.define(:version => 20130404164628) do ...@@ -297,8 +294,8 @@ ActiveRecord::Schema.define(:version => 20130404164628) do
create_table "web_hooks", :force => true do |t| create_table "web_hooks", :force => true do |t|
t.string "url" t.string "url"
t.integer "project_id" t.integer "project_id"
t.datetime "created_at", :null => false t.datetime "created_at"
t.datetime "updated_at", :null => false t.datetime "updated_at"
t.string "type", :default => "ProjectHook" t.string "type", :default => "ProjectHook"
t.integer "service_id" t.integer "service_id"
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment