Hi All, How can i calculate the total time spent while closing(from open) an issue in JIRA. Please advise.
Here is a version for culculated field provided by ScriptRunner.
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.Issue import com.atlassian.jira.issue.changehistory.ChangeHistory import com.atlassian.jira.issue.changehistory.ChangeHistoryManager import com.atlassian.jira.issue.history.ChangeItemBean /** * Return time between two statuses */ //Issue issue = null; long endStatusTime = 0; String endStatusName = "Закрыт" ChangeHistoryManager changeHistoryManager = ComponentAccessor.getChangeHistoryManager(); for(ChangeHistory changeHistory: changeHistoryManager.getChangeHistories(issue)) for(ChangeItemBean changeItemBean: changeHistory.getChangeItemBeans()) { if (changeItemBean.getField().equals("status")){ if( changeItemBean.getToString().equals(endStatusName) ){ endStatusTime = changeItemBean.getCreated().getTime() } } } return String.format("%.2f", (endStatusTime - issue.getCreated().getTime())/(1000*60*60*24))
If you do not want to use this plugin you could get this data via SQL.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.