Closed frankz96 closed 1 year ago
@picman Hi, thanks for your revision, but the "help wanted" label is not correct😅
Hi,
Use this code:
AFTER SAVE SECTION:
same_subject = Issue.where("subject = ?",self.subject).pluck(:id)
same_subject.each do |issueid|
relation = IssueRelation.new :issue_from => self, :issue_to => issueid,:relation_type => IssueRelation::TYPE_RELATES
relation.save
end
I hope it helps!
Hi,
Use this code:
AFTER SAVE SECTION:
same_subject = Issue.where("subject = ?",self.subject).pluck(:id) same_subject.each do |issueid| relation = IssueRelation.new :issue_from => self, :issue_to => issueid,:relation_type => IssueRelation::TYPE_RELATES relation.save end
I hope it helps!
@AirTibu Hi, thank you very much for your help. But I tried your code, it didn't work. I create a new issue with duplicate subject. Here is what i found in log file:
Custom workflow exception: Issue(#47344935497480) expected, got 10762 which is an instance of Integer(#47344902929580)
I found the issue with id 10762 is the duplicate subject issue. Could you fix this problem?
Hi,
You are right, small correction is needed, use this code:
same_subject = Issue.where("subject = ?",self.subject).pluck(:id)
same_subject.each do |issueid|
relation = IssueRelation.new :issue_from => self, :issue_to => Issue.find(issueid),:relation_type => IssueRelation::TYPE_RELATES
relation.save
end
I hope it helps!
Hi,
You are right, small correction is needed, use this code:
same_subject = Issue.where("subject = ?",self.subject).pluck(:id)
same_subject.each do |issueid| relation = IssueRelation.new :issue_from => self, :issue_to => Issue.find(issueid),:relation_type => IssueRelation::TYPE_RELATES relation.save end
I hope it helps!
Thank you so much! It worked perfectly.
Here is what i want: when i creat a new issue or other operate, if two or more issues have same "Subject", them relate them in "Related issues". Thank you very much if anyone can helps.