新增:操作日志旧数据适配
This commit is contained in:
parent
b7aa1e51b3
commit
854df00ffb
|
@ -82,6 +82,14 @@ class Journal < ApplicationRecord
|
|||
end
|
||||
end
|
||||
|
||||
def pm_operate_category
|
||||
if (detail.property == "requirement" || detail.property == "task" || detail.property == "bug") && detail.prop_key.to_s == "1"
|
||||
return "issue"
|
||||
else
|
||||
return detail.property == "attr" ? detail.prop_key : detail.property
|
||||
end
|
||||
end
|
||||
|
||||
def pm_operate_content
|
||||
content = ""
|
||||
detail = self.journal_details.take
|
||||
|
@ -282,6 +290,36 @@ class Journal < ApplicationRecord
|
|||
content += "将优先级由<b>#{old_value}</b>更改为<b>#{new_value}</b>"
|
||||
end
|
||||
return content
|
||||
when 'status_id'
|
||||
old_value = IssueStatus.find_by_id(detail.old_value)&.name
|
||||
new_value = IssueStatus.find_by_id(detail.value)&.name
|
||||
if old_value.nil? || old_value.blank?
|
||||
content += "将状态设置为<b>#{new_value}</b>"
|
||||
else
|
||||
new_value = "未设置" if new_value.blank?
|
||||
content += "将状态由<b>#{old_value}</b>更改为<b>#{new_value}</b>"
|
||||
end
|
||||
case self.issue.pm_issue_type
|
||||
when 'requirement'
|
||||
content.gsub!('新增', '待评审')
|
||||
content.gsub!('正在解决', '进行中')
|
||||
content.gsub!('已解决', '已完成')
|
||||
content.gsub!('关闭', '已关闭')
|
||||
content.gsub!('拒绝', '已拒绝')
|
||||
when 'task'
|
||||
content.gsub!('新增', '待处理')
|
||||
content.gsub!('正在解决', '进行中')
|
||||
content.gsub!('已解决', '已完成')
|
||||
content.gsub!('关闭', '已关闭')
|
||||
content.gsub!('拒绝', '已拒绝')
|
||||
when 'bug'
|
||||
content.gsub!('新增', '待修复')
|
||||
content.gsub!('正在解决', '修复中')
|
||||
content.gsub!('已解决', '已修复')
|
||||
content.gsub!('关闭', '已关闭')
|
||||
content.gsub!('拒绝', '已拒绝')
|
||||
end
|
||||
return content
|
||||
when 'pm_issue_type'
|
||||
old_value = detail.old_value
|
||||
new_value = detail.value
|
||||
|
@ -444,6 +482,16 @@ class Journal < ApplicationRecord
|
|||
end
|
||||
end
|
||||
return content
|
||||
when 'issue'
|
||||
issue = self.issue
|
||||
case issue.pm_issue_type
|
||||
when 1
|
||||
return "创建了需求"
|
||||
when 2
|
||||
return "创建了任务"
|
||||
when 3
|
||||
return "创建了缺陷"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ json.user do
|
|||
end
|
||||
if journal.is_journal_detail?
|
||||
detail = journal.journal_details.take
|
||||
json.operate_category detail.property == "attr" ? detail.prop_key : detail.property
|
||||
json.operate_category journal.pm_operate_category
|
||||
json.operate_content journal.is_journal_detail? ? journal.pm_operate_content : nil
|
||||
else
|
||||
json.notes journal.notes
|
||||
|
|
Loading…
Reference in New Issue