fix: projecttrend show rule

This commit is contained in:
yystopf 2021-10-14 15:30:00 +08:00
parent 94a6cd96c6
commit 79b394d291
2 changed files with 5 additions and 6 deletions

View File

@ -14,14 +14,13 @@ 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) project_trends = project_trends.where("created_at between ? and ?",(Time.now.beginning_of_day - check_time.days), Time.now.end_of_day)
end 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_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_issues_count = project_trends.where(trend_type: "Issue", action_type: "create").size
@project_open_issues_count = @project_issues_count - @project_close_issues_count
@project_pr_count = project_trends.where(trend_type: "PullRequest", action_type: "close").size @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 @project_pr_all_count = project_trends.where(trend_type: "PullRequest", action_type: "create").size
@project_pr_all_count = @project_pr_count + @project_new_pr_count @project_new_pr_count = @project_pr_all_count - @project_pr_count
if check_type.present? if check_type.present?
project_trends = project_trends.where(trend_type: check_type.to_s.strip) project_trends = project_trends.where(trend_type: check_type.to_s.strip)
end end

View File

@ -54,7 +54,7 @@ class PullRequest < ApplicationRecord
Project.find_by(id: self.fork_project_id) Project.find_by(id: self.fork_project_id)
end end
def bind_gitea_pull_request!(gitea_pull_number, gitea_pull_id) def bind_gitea_pull_request!(gitea_pull_number, gitea_pull_id=gitea_pull_number)
update_columns( update_columns(
gitea_number: gitea_pull_number, gitea_number: gitea_pull_number,
gitea_id: gitea_pull_id) gitea_id: gitea_pull_id)