Hi,
I was hoping someone can help me with the following.
We've created a new Hierarchy as followed: Initiative - Epic - Story
What I would like to do is track how long it took for an Epic to get resolved. The tricky part is to measure Epics when they have an Initiative.
In short:
When an Epic has an Initiative the start date would be the transition of the Initiative to In progress and the end date would be when the Epic is resolved.
Else
When an Epic doesn’t have an Initiative the start date would simply be the transition of the Epic to In progress and the end date would be when the Epic is resolved
Would this be possible with Script Runner and can I use the following Script from Adaptavist as a basis?
import com.atlassian.core.util.DateUtils
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.history.ChangeItemBean
def componentManager = ComponentManager.getInstance()
def changeHistoryManager = componentManager.getChangeHistoryManager()
def inProgressName = "In Progress"
def rt = [0]
changeHistoryManager.getChangeItemsForField (issue, "status").reverse().each {ChangeItemBean item ->
def timeDiff = System.currentTimeMillis() - item.created.getTime()
if (item.fromString == inProgressName) {
rt << -timeDiff
}
if (item.toString == inProgressName){
rt << timeDiff
}
}
// NOTE: doesn't show anything if less than 60 seconds
DateUtils.getDurationString(Math.round(rt.sum() / 1000))
I know we can measure time with the Time in Status plugin but the plugin doesn't fit the need that I have.
All help is much appreciated!!