mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-07-13 21:44:32 +08:00
新增:修复数据rake任务
This commit is contained in:
@@ -20,10 +20,25 @@ class IssueStatus < ApplicationRecord
|
||||
ADD = 1
|
||||
SOLVING = 2
|
||||
SOLVED = 3
|
||||
FEEDBACK = 4
|
||||
# FEEDBACK = 4
|
||||
CLOSED = 5
|
||||
REJECTED = 6
|
||||
|
||||
has_many :issues
|
||||
belongs_to :project, optional: true
|
||||
|
||||
def self.init_data
|
||||
map = {
|
||||
"1" => "新增",
|
||||
"2" => "正在解决",
|
||||
"3" => "已解决",
|
||||
"5" => "关闭",
|
||||
"6" => "拒绝"
|
||||
}
|
||||
IssueStatus.order(id: :asc).each do |stat|
|
||||
next if map[stat.id] == stat.name
|
||||
Issue.where(status_id: stat.id).each{|i| i.update_column(:status_id, 1)}
|
||||
stat.destroy!
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -26,4 +26,24 @@ class IssueTag < ApplicationRecord
|
||||
belongs_to :project, optional: true, counter_cache: true
|
||||
belongs_to :user, optional: true
|
||||
|
||||
def self.init_data(project_id)
|
||||
data = [
|
||||
["缺陷", "表示项目存在问题", "#d92d4c"],
|
||||
["功能", "表示新功能申请", "#ee955a"],
|
||||
["疑问", "表示存在的问题", "#2d6ddc"],
|
||||
["支持", "表示特定功能或特定需求", "#019549"],
|
||||
["任务", "表示需要分配的任务", "#01a30d"],
|
||||
["协助", "表示需要社区用户协助", "#2a0dc1"],
|
||||
["搁置", "表示此问题不会继续处理", "#892794"],
|
||||
["文档", "表示文档材料补充", "#9ed600"],
|
||||
["测试", "表示需要测试的需求", "#2897b9"],
|
||||
["重复", "表示已存在类似的疑修", "#bb5332"]
|
||||
]
|
||||
data.each do |item|
|
||||
next if IssueTag.exists?(project_id: project_id, name: item[0])
|
||||
IssueTag.create!(project_id: project_id, name: item[0], description: item[1], color: item[2])
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user