Open Salam5071 opened 1 year ago
I am not sure if understand your problem correctly but ActiveModel provides _was
methods to access previous value of a filed.
In your case self.status_id_was
will be pointing to the previous status.
Wrap it into an if statement:
# Issue status was changed from 45 => 44
if self.status_id_changed? && self.status_id_was == 45 && self.status_id == 44
# do smth
end
if self.status_id_changed? && self.status_id_was == 45 && self.status_id == 44 # do smth end
Hi Dmakurin,
I've tested your advise, but still the same..
For simplify, I want to set the status automatically when user do the decision "Technical Specification Revise" = Yes or = No. As you can the flowchart below, there are looping. So when the status changed to Technical Spefication Review for 2nd time, the issue will automatically set the status into Technical Specification Revise again as the selection remain "Yes".
Example code.
self.status_id = 39 if (custom_field_value(29) == 'Yes') && @issue.status_id==31
self.status_id = 32 if (custom_field_value(29) == 'No') && @issue.status_id==31
may be it will be useful as idea: add some version, that will up each round. If version become too high - make custom_field blank.
Hi all master!! I'm not a developer or programmer but this task assigned for me. I need your good help on his.
Attached is the flowchart for this project. GREEN colored words is can be manually assigned the status. BLUE colored words is to be automatically assigned the status when got decision selection.
Below is my code.
Check if "Further clarification needed?" AND issue status = Technical Spec Understanding
self.status_id = 37 if (custom_field_value(28) == 'Yes') && @issue.status_id==36
If Yes, issue status will be set into = Technical Spec Clarification
self.status_id = 38 if (custom_field_value(28) == 'No') && @issue.status_id==36
If No, issue status will be set into = Pending Development
Check if "Revise Technical Specification" AND issue status = Technical Spec Clarification
self.status_id = 39 if (custom_field_value(29) == 'Yes') && @issue.status_id==37
If Yes, issue status will be set into = Technical Specification Revise
self.status_id = 38 if (custom_field_value(29) == 'No') && @issue.status_id==37
If No, issue status will be set into = Pending Development
Check if "Resubmission Technical Specification" AND issue status = Technical Specification Revise
self.status_id = 36 if (custom_field_value(24) == 'Yes') && @issue.status_id==39
If Yes, issue status will be set into = Technical Spec Understanding
Check if "Approval 1st Level Code Review" AND issue status = Developer Code Review
self.status_id = 44 if (custom_field_value(30) == 'Yes') && @issue.status_id==42
If Yes, issue status will be set into = Project Team Lead Code Review
self.status_id = 43 if (custom_field_value(30) == 'No') && @issue.status_id==42
If No, issue status will be set into = Developer Revise Code Review
Check if ""Approval 2nd Level Code Review" AND issue status = Project Team Lead Code Review
self.status_id = 45 if (custom_field_value(31) == 'Yes') && @issue.status_id==44
If Yes, issue status will be set into = Check in to SVN
self.status_id = 46 if (custom_field_value(31) == 'No') && @issue.status_id==44
If No, issue status will be set into = Developer Revise Code Review
My Question: