Greetings
We currently have a scripted field which gives a percentage of stories estimated to an epic.
This has worked well for us, however we now want to only summarize stories when the story points field is > 0, where the resolution is empty, or set to the values of "Fixed" or "Done". All other stories, we do not wish to summarize.
Below is our current code.
Any recommendations on how to obtain the resolution value, and add the above criteria?
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.component.ComponentAccessor;
def componentManager = ComponentManager.getInstance()
def issueLinkManager = ComponentAccessor.getIssueLinkManager()
def cfManager = ComponentAccessor.getCustomFieldManager()
double totalStoriesEstimated = 0
double totalStoriesUnestimated = 0
double totalStories = 0
double percentEstimated = 0
double SP = 0
def storyestimated = false
customField = ComponentAccessor.getCustomFieldManager().getCustomFieldObject("customfield_10073");
if (issue.getIssueTypeId() != "17") {
return null
}
issueLinkManager.getOutwardLinks(issue.id)?.each {issueLink ->
if (issueLink.issueLinkType.name == "Epic-Story Link" ) {
SP = (double)(issueLink.destinationObject.getCustomFieldValue(customField) ?: 0)
totalStories++;
if (SP > 0) {
totalStoriesEstimated++;
}
}
percentEstimated = ((totalStoriesEstimated ) / totalStories) * 100;
if (percentEstimated <= 0) {
percentEstimated = 0}
}
return percentEstimated