The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Hi everyone,
Im running the script below to count the time an issue is "In Progress" status.
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.history.ChangeItemBean
def changeHistoryManager = ComponentAccessor.getChangeHistoryManager()
def inProgressName = "In Progress"
List<Long> rt = [0L]
def changeItems = changeHistoryManager.getChangeItemsForField(issue, "status")
changeItems.reverse().each {ChangeItemBean item ->
def timeDiff = System.currentTimeMillis() - item.created.getTime()
if (item.fromString == inProgressName) {
rt << -timeDiff
}
if (item.toString == inProgressName){
rt << timeDiff
}
}
if (!changeItems) {
rt << (System.currentTimeMillis() - issue.getCreated().getTime())
}
def total = rt.sum() as Long
return (total / 1000) as long ?: 0L
What i need to do is the counter to restart from 0 when a new support employee presses again '' Start Working '' after pressing '' Undo Start Working '' .
Anyone have any idea how to do that? At the moment if it changes status it freezes counting and continues from where it was left when status changes again in "In Progress"
Thanx in advance,
George
Connect with like-minded Atlassian users at free events near you!
Find an eventConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.
Host an eventYou're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events