Need a Jira Query for all issues which have more than one component.
Each EPIC has a list of components that it effects. I want to query for all issues with two or more components listed. These will need to be discussed across teams, hence the interest in them.
I answered my own issue after some trial and error. Apparently the clearTime() function also executes on the object you call it from in addition to returning a date value to be stored in a variable. I fixed my issue by cloning the date objects so that any changes I made would change the clone, not the original.
import com.atlassian.jira.issue.MutableIssue
use(groovy.time.TimeCategory) {
MutableIssue issue = (MutableIssue) issue
try{
def date1 = issue.getDueDate().clone()
def date2 = issue.getCreated().clone()
def dueDate = date1.clearTime()
def createDate = date2.clearTime()
def duration = dueDate - createDate
return "${duration.days}".toDouble()
}
catch(NullPointerException e) {
return 0.toDouble()
}
}
clearTIme clears the time part on the object you you call it, and returns that, which I eventually worked out from http://stackoverflow.com/questions/6739561/groovy-date-cleartime-question
So your original code would modify the issue object in the current thread, but not actually store any changes to the database.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.