Added project has_one :last_event assoc. Fixed tab line-height after font-awesome. Increased projects per page on dashboard
This commit is contained in:
parent
a9a3480de9
commit
e0c43c46dd
4 changed files with 10 additions and 11 deletions
|
@ -25,6 +25,7 @@ class Project < ActiveRecord::Base
|
|||
has_many :hooks, dependent: :destroy, class_name: "ProjectHook"
|
||||
has_many :wikis, dependent: :destroy
|
||||
has_many :protected_branches, dependent: :destroy
|
||||
has_one :last_event, class_name: 'Event', order: 'events.created_at DESC', foreign_key: 'project_id'
|
||||
|
||||
delegate :name, to: :owner, allow_nil: true, prefix: true
|
||||
|
||||
|
@ -141,15 +142,11 @@ class Project < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def last_activity
|
||||
events.order("created_at ASC").last
|
||||
last_event
|
||||
end
|
||||
|
||||
def last_activity_date
|
||||
if events.last
|
||||
events.last.created_at
|
||||
else
|
||||
updated_at
|
||||
end
|
||||
last_event.try(:created_at) || updated_at
|
||||
end
|
||||
|
||||
def wiki_notes
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue