Merge branch 'standalone_develop' into pm_project_develop

This commit is contained in:
2024-09-12 09:21:10 +08:00
48 changed files with 440 additions and 64 deletions

View File

@@ -139,6 +139,7 @@ class Project < ApplicationRecord
has_many :daily_project_statistics, dependent: :destroy
has_one :project_dataset, dependent: :destroy
has_many :sync_repositories, dependent: :destroy
has_many :home_top_settings, as: :top, dependent: :destroy
after_create :incre_user_statistic, :incre_platform_statistic
after_save :check_project_members
before_save :set_invite_code, :reset_unmember_followed, :set_recommend_and_is_pinned, :reset_cache_data
@@ -462,6 +463,15 @@ class Project < ApplicationRecord
EduSetting.get("open_portrait_projects").present? ? EduSetting.get("open_portrait_projects").split(",").include?(self.id.to_s) : false
end
def has_pull_request(branch_name)
return true if self.pull_requests.opening.where(head: branch_name).present? || self.pull_requests.opening.where(base: branch_name).present?
if self.forked_from_project_id.present?
return true if self.fork_project.pull_requests.opening.where(head: branch_name).present? || self.fork_project.pull_requests.opening.where(base: branch_name).present?
end
return false
end
def self.mindspore_contributors
cache_result = $redis_cache.get("ProjectMindsporeContributors")
if cache_result.nil?