Commit f716c0a1 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

profjects filter with_push to project model

parent 8543313b
......@@ -5,7 +5,7 @@ class Admin::ProjectsController < AdminController
@projects = Project.scoped
@projects = @projects.where(namespace_id: params[:namespace_id]) if params[:namespace_id].present?
@projects = @projects.where(public: true) if params[:public_only].present?
@projects = @projects.joins(:events).where('events.action = ?', Event::Pushed) if params[:with_push].present?
@projects = @projects.with_push if params[:with_push].present?
@projects = @projects.abandoned if params[:abandoned].present?
@projects = @projects.where(namespace_id: nil) if params[:namespace_id] == Namespace.global_id
@projects = @projects.search(params[:name]) if params[:name].present?
......
......@@ -92,6 +92,10 @@ class Project < ActiveRecord::Base
where(id: project_ids)
end
def with_push
includes(:events).where('events.action = ?', Event::Pushed)
end
def active
joins(:issues, :notes, :merge_requests).order("issues.created_at, notes.created_at, merge_requests.created_at DESC")
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