新增:修复数据rake任务

This commit is contained in:
2023-02-20 17:25:07 +08:00
parent cb3bb23e79
commit 4657618753
4 changed files with 89 additions and 23 deletions

View File

@@ -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