Commit d98ddaaa by Hiếu Lê

Skip auto delete with some conditions

parent 749bf6af
Pipeline #69 canceled with stages
in 0 seconds
...@@ -632,7 +632,15 @@ class IssuesController < ApplicationController ...@@ -632,7 +632,15 @@ class IssuesController < ApplicationController
return if @issue.tracker_id != 3 #Support return if @issue.tracker_id != 3 #Support
#Remove subtasks when change from User Story to Support #Remove subtasks when change from User Story to Support
Issue.where(tracker_id: 8, parent_id: @issue.id).delete_all tasks = Issue.where(tracker_id: 8, parent_id: @issue.id)
tasks.each do |task|
next if task.description.present?
next if task.attachments.present?
next if task.time_entries.present?
next if task.notes.present?
next if task.journals.present?
task.delete
end
end end
end end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment