Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Measuring time in minutes between two statuses?

Tomasz May 9, 2023

Dear,

I'am looking for a solution where I could measure time in minutes between two specific statuses in a ticket:
specifically between new ticket is registered, and closed. 

e.g.: NEW->....CLOSED

Is there any solution I could use to calculate this and have these result stored in a custom field? 

I have tried with scriptrunner and code below, but unfourtanetly where there will be some other status set, measure is not calculating any longer.....(only for this one particular). 

 

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.history.ChangeItemBean

// Status to be counted
final statusName = 'New'

def changeHistoryManager = ComponentAccessor.changeHistoryManager
def totalStatusTime = [0L]

// Every status change is checked
def changeItems = changeHistoryManager.getChangeItemsForField(issue, "status")
changeItems.reverse().each { ChangeItemBean item ->
    def timeDiff = System.currentTimeMillis() - item.created.time
    // Subtract time if the "from" status is equal to the status to be checked and from and to statuses are different.
    // This allows to count the time the issue is in the state for the first time
    if (item.fromString == statusName && item.fromString != item.toString) {
        totalStatusTime << -timeDiff
    }
    // Add time if the "to" status is equal to the status to be checked
    if (item.toString == statusName) {
        totalStatusTime << timeDiff
    }
}

def total = totalStatusTime.sum() as Long
// Every time (added or subtracted) is summed and divided by 1000 to get seconds
(total / 1000) as long ?: 0L

 

Any solution or help highly appreciated. Thank you!!!!!

 

 

4 answers

2 votes
Valeriia_Havrylenko_SaaSJet_AbcSite
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
May 9, 2023

Hi @Tomasz 👋

If you are interested, try out Time between Statuses, which gives you ability to check time in minutes between two statuses. 

How it looks like:

Знімок екрана 2023-05-09 о 14.37.43.png

Here are all Time Formats of status duration:

  • DHM (Days, Hours, Minutes)

  • HM (Hours, Minutes)

  • h:m (hours:minutes)

  • M (Minutes)

  • Decimal Hours

  • Decimal Days

  • Decimal Weeks

  • Business DHM, 

  • Business Decimal Days, 

  • Business Decimal Weeks.

c236520e-5e49-458b-bf6f-fbbffa75e1e5.png

You can also set up highlights of values that exceed the permissible level, and in this case, you can receive issue and email notifications.

image 99.png 
So, with add-on, your workflow can look like this and helps you uncover bottlenecks easily:

3 tools to analyze Cycle and Lead Time in the Jira_3.png

Add-on developed by my by SaaSJet team. 

We are offering you a 30 days of free trial, and you can also book a demo with our specialist.
Hope this helps!

1 vote
Yaniv July 5, 2023

Hi All,

 

I tried "Time between statuses" but it allows me only use a Project for the data while I want to use a specific filter contains all of my customers defects.

Any suggestions on how to measure the time between Created and Done for specific filter?

Valeriia_Havrylenko_SaaSJet_AbcSite
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
July 5, 2023

Hello, @Yaniv Bernhard 👋

 

If your filter includes the issue type, one project, and a specific date range, you will be able to perform this directly on the report itself.

ca342bb8-25f2-4758-a7d0-a40da9ba9e30.png

I also recommend booking a demo session to resolve your issue more quickly. I hope this helps you. Valeriia

Yaniv July 5, 2023

Thanks, I booked a session.

0 votes
Emre Toptancı _OBSS_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
May 9, 2023

Hello @Tomasz

I can recommend Time in Status which is built by my team at OBSS. It is available for Jira Server, Cloud, and Data Center. 

Time in Status mainly allows you to see how much time each issue spent on each status and on each assignee

tisCloud_StatusDuration_LeadTime_with Estimates.png  tisCloud_AssigneeDuration.png     

Time in Status offers two report types for your case:

The first one is Status Duration report (please see the screenshot above) which shows how much time each issue spent on each status. Ypu can combine status times to see measurements like Issue Age, Cycle Time, Lead Time, Resolution Time etc.

As an alternative approach, Time in Status also has Duration Between Statuses report type which shows the duration between two specific statuses. This report type also allows the user the exclude the times for "pause" statuses.

tisCloud_DBS_Metrics.png  tisCloud_DBS_Report.png

These reports show a list of issues by default so you can see the metric values for each issue separately. Also, for all numeric report types, you can calculate averages and sums of those durations grouped by the issue fields you select. For example total cycle time per customer (organization) or average resolution time per sprint, week, month, issuetype, request type, etc. The ability to group by parts of dates (year, month, week, day, hour) or sprints is particularly useful here since it allows you to compare different time periods or see the trend.

All these report types, including averages and sums, can be turned into charts.

Time in Status calculates its reports using already existing Jira issue histories so when you install the app, you don't need to add anything to your issue workflows and you can get reports on your past issues as well. It supports both Company Managed and Team Managed projects.

Time in Status reports can be accessed through its own reporting page, dashboard gadgets, and issue view screen tabs. All these options can provide both calculated data tables and charts.

And the app has a REST API so you can get the reports from Jira UI or via REST.

Gadget_AverageStatusDurationByComponent.png  tisCloud_StatusDuration_LeadTime_Chart.png

https://marketplace.atlassian.com/apps/1211756/

EmreT

0 votes
Mehmet A _Bloompeak_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
May 9, 2023

Hi @Tomasz

If lead time report (the time interval between the moment an issue is requested to the moment it is completed) is what you need, you can try Status Time Reports app developed by our team. For more detail, you can have a look at the article below.

Cycle Time and Lead Time in Jira: Productivity Measurement with Two Critical Parameters

Here is the online demo link, you can see it in action and try without installing the app.

If you are looking for a free solution, you can try the limited version Status Time Free.

Hope it helps.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events