修复id为0的错误

dev_forge
sylor_huang@126.com 5 years ago
parent 291aa386ca
commit cf6d75d2eb

@ -36,7 +36,7 @@ class Journal < ApplicationRecord
value = I18n.t("journal_detail.#{de[3]}")
when "assigned_to_id"
u = User.select(:id, :login, :lastname, :firstname)
old_value = u.find(de[2]).try(:show_real_name)
old_value = de[2].to_i > 0 ? u.find(de[2]).try(:show_real_name) : ""
assign_user = de[3].present? ? u.find(de[3]) : ""
if assign_user.present?
value = u.find(de[3]).try(:show_real_name)
@ -46,7 +46,7 @@ class Journal < ApplicationRecord
when "tracker_id"
t = Tracker.select(:id, :name)
old_value = t.find(de[2]).try(:name)
old_value = de[2].to_i > 0 ? t.find(de[2]).try(:name) : ""
tracker_name = de[3].present? ? t.find(de[3]) : ""
if tracker_name
value = t.find(de[3]).try(:name)
@ -56,7 +56,7 @@ class Journal < ApplicationRecord
when "status_id"
t = IssueStatus.select(:id, :name)
old_value = t.find(de[2]).try(:name)
old_value = de[2].to_i > 0 ? t.find(de[2]).try(:name) : ""
type_name = de[3].present? ? t.find(de[3]) : ""
if type_name
value = t.find(de[3]).try(:name)
@ -65,7 +65,7 @@ class Journal < ApplicationRecord
end
when "priority_id"
t = IssuePriority.select(:id, :name)
old_value = t.find(de[2]).try(:name)
old_value = de[2].to_i > 0 ? t.find(de[2]).try(:name): ""
type_name = de[3].present? ? t.find(de[3]) : ""
if type_name
value = t.find(de[3]).try(:name)
@ -74,7 +74,7 @@ class Journal < ApplicationRecord
end
when "issue_tags_value"
t = IssueTag.select(:id, :name)
old_value = t.where(id: de[2].split(",")).select(:id,:name,:color).as_json
old_value = de[2].to_i > 0 ? t.where(id: de[2].split(",")).select(:id,:name,:color).as_json : ""
if de[3].present?
value = t.where(id: de[3].split(",")).select(:id,:name,:color).as_json
else
@ -82,16 +82,16 @@ class Journal < ApplicationRecord
end
when "fixed_version_id"
t = Version.select(:id, :name)
old_value = t.find(de[2]).try(:name)
old_value = de[2].to_i > 0 ? t.find(de[2]).try(:name) : ""
type_name = de[3].present? ? t.find(de[3]) : ""
if type_name
value = t.find(de[3]).try(:name)
value = type_name.try(:name)
else
value = "取消了版本库"
end
when "end_time"
t = IssueTime.select(:id, :start_time, :end_time)
type_name = de[2].present? ? t.find(de[2]) : ""
type_name = de[2].to_i > 0 ? t.find(de[2]) : ""
if type_name.present?
old_value = "停止工作"
d_value = type_name.end_time.to_i - type_name.start_time.to_i

Loading…
Cancel
Save