mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-17 10:15:57 +08:00
@@ -17,6 +17,13 @@
|
||||
#
|
||||
|
||||
class IssueStatus < ApplicationRecord
|
||||
ADD = 1
|
||||
SOLVING = 2
|
||||
SOLVED = 3
|
||||
FEEDBACK = 4
|
||||
CLOSED = 5
|
||||
REJECTED = 6
|
||||
|
||||
has_many :issues
|
||||
belongs_to :project, optional: true
|
||||
end
|
||||
|
||||
@@ -18,6 +18,9 @@
|
||||
#
|
||||
|
||||
class ProjectTrend < ApplicationRecord
|
||||
CLOSE = 'close'
|
||||
CREATE = 'create'
|
||||
|
||||
belongs_to :project
|
||||
belongs_to :trend, polymorphic: true, optional: true
|
||||
belongs_to :user
|
||||
|
||||
@@ -24,7 +24,11 @@
|
||||
#
|
||||
|
||||
class PullRequest < ApplicationRecord
|
||||
#status 0 默认未合并, 1表示合并, 2表示请求拒绝
|
||||
#status 0 默认未合并, 1表示合并, 2表示请求拒绝(或已关闭)
|
||||
OPEN = 0
|
||||
MERGED = 1
|
||||
CLOSED = 2
|
||||
|
||||
belongs_to :issue
|
||||
belongs_to :user
|
||||
belongs_to :project, :counter_cache => true
|
||||
@@ -42,6 +46,14 @@ class PullRequest < ApplicationRecord
|
||||
update_column(:gpid, gitea_pull_number)
|
||||
end
|
||||
|
||||
def merge!
|
||||
update_column(:status, PullRequest::MERGED)
|
||||
end
|
||||
|
||||
def project_trend_status!
|
||||
self&.project_trends&.update_all(action_type: ProjectTrend::CLOSE)
|
||||
end
|
||||
|
||||
# TODO: sync educoder platform repo's for update some statistics count
|
||||
def self.update_some_count
|
||||
PullRequest.includes(:user, :project).select(:id, :user_id, :gpid, :project_id, :fork_project_id).each do |pr|
|
||||
|
||||
Reference in New Issue
Block a user