pull request统计数显示所有
This commit is contained in:
parent
fe9731c11c
commit
3699ddd398
|
@ -17,19 +17,21 @@ class PullRequestsController < ApplicationController
|
||||||
@allow_to_pull_request = allow_pull_request(@project) > 0
|
@allow_to_pull_request = allow_pull_request(@project) > 0
|
||||||
|
|
||||||
type = params[:type]
|
type = params[:type]
|
||||||
|
merge_requests = @g.merge_requests(@project.gpid)
|
||||||
|
merge_requests_count = merge_requests.count
|
||||||
case type
|
case type
|
||||||
when nil, "1"
|
when nil, "1"
|
||||||
@requests = @g.merge_requests(@project.gpid).select{|request| request.state == "opened" || request.state == "reopened"}
|
@requests = merge_requests.select{|request| request.state == "opened" || request.state == "reopened"}
|
||||||
# 更新统计数字
|
# 更新统计数字
|
||||||
project_score = @project.project_score.update_column(:pull_request_num, @requests.count)
|
project_score = @project.project_score.update_column(:pull_request_num, merge_requests_count)
|
||||||
when "2"
|
when "2"
|
||||||
@requests = @g.merge_requests(@project.gpid).select{|request| request.state == "merged"}
|
@requests = merge_requests.select{|request| request.state == "merged"}
|
||||||
when "3"
|
when "3"
|
||||||
@requests = @g.merge_requests(@project.gpid).select{|request| request.state == "closed"}
|
@requests = merge_requests.select{|request| request.state == "closed"}
|
||||||
end
|
end
|
||||||
@requests_opened_count = @requests.count
|
@requests_opened_count = @requests.count
|
||||||
@requests_merged_count = @g.merge_requests(@project.gpid).select{|request| request.state == "merged"}.count
|
@requests_merged_count = merge_requests.select{|request| request.state == "merged"}.count
|
||||||
@requests_closed_count = @g.merge_requests(@project.gpid).select{|request| request.state == "closed"}.count
|
@requests_closed_count = merge_requests.select{|request| request.state == "closed"}.count
|
||||||
|
|
||||||
@limit = 10
|
@limit = 10
|
||||||
@is_remote = true
|
@is_remote = true
|
||||||
|
|
Loading…
Reference in New Issue