|
|
|
@ -4,11 +4,6 @@ class ProjectTrendsController < ApplicationController
|
|
|
|
|
|
|
|
|
|
def index
|
|
|
|
|
project_trends = @project.project_trends.includes(:user, trend: :user)
|
|
|
|
|
@project_open_issues_count = project_trends.where(trend_type: "Issue", action_type: "create").size
|
|
|
|
|
@project_close_issues_count = project_trends.where(trend_type: "Issue", action_type: "close").size
|
|
|
|
|
@project_issues_count = @project_open_issues_count + @project_close_issues_count
|
|
|
|
|
@project_pr_count = project_trends.where(trend_type: "PullRequest", action_type: "close").size
|
|
|
|
|
@project_new_pr_count = project_trends.where(trend_type: "PullRequest", action_type: "create").size
|
|
|
|
|
|
|
|
|
|
check_time = params[:time] #时间的筛选
|
|
|
|
|
check_type = params[:type] #动态类型的筛选,目前已知的有 Issue, PullRequest, Version
|
|
|
|
@ -19,6 +14,12 @@ class ProjectTrendsController < ApplicationController
|
|
|
|
|
project_trends = project_trends.where("created_at between ? and ?",(Time.now.beginning_of_day - check_time.days), Time.now.end_of_day)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
@project_open_issues_count = project_trends.where(trend_type: "Issue", action_type: "create").size
|
|
|
|
|
@project_close_issues_count = project_trends.where(trend_type: "Issue", action_type: "close").size
|
|
|
|
|
@project_issues_count = @project_open_issues_count + @project_close_issues_count
|
|
|
|
|
@project_pr_count = project_trends.where(trend_type: "PullRequest", action_type: "close").size
|
|
|
|
|
@project_new_pr_count = project_trends.where(trend_type: "PullRequest", action_type: "create").size
|
|
|
|
|
|
|
|
|
|
if check_type.present?
|
|
|
|
|
project_trends = project_trends.where(trend_type: check_type.to_s.strip)
|
|
|
|
|
end
|
|
|
|
|