Hi everyone,
Im running the script below to count the time an issue is "In Progress" status.
import com.atlassian.jira.component.ComponentAccessorimport com.atlassian.jira.issue.history.ChangeItemBeandef 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 Longreturn (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
It looks like you're new here. Sign in or register to get started.