Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Total Time in Current Status with excluding Weekends - Scripted Field

TN Raju June 27, 2023

I'm trying to create a scripted field to show the Total Time in Current Status with excluding the weekends.

unable to remove the weekends from the script.

Thanks

7 answers

2 votes
Ram Kumar Aravindakshan _Adaptavist_
Community Champion
August 10, 2023

Hi @TN Raju

For your requirement, you could try the solution provided in the Adaptavist Library.

So in your case, you will need to use the changeHistory to get the date range the issue was in a particular status and update the sample code accordingly.

Thank you and Kind regards,

Ram

2 votes
Valeriia_Havrylenko_SaaSJet
Atlassian Partner
July 4, 2023

Hello @TN Raju 

Additionally, performing this calculation solely through scripting can have performance implications as the script runs every time an issue is displayed, which may be problematic for older issues.

As an alternative , I guess you can try Time in Status for Jira Cloud or Time Between Statuses developed by my team SaaSJet.

Time in Status for Jira Cloud will be an option for you too if you are already switching to cloud version. You will see the Total Time in Current Status and even more with 7 types of reports that build in our add-on. also you will be able to exclude the weekends easily with work calendars.

work calendars.png
See how Time in Status for Jira Cloud works: 

Time in status GIF.gif

Another option is Time between Statuses. This add-on, which measures connections in the workflow, through a transition time in specific issues. 

Time Between Satuses.jpg

You can customize your Cycle and Lead Time reports by adjusting the app interface fields such as: Type of Project Date range Time Format Multi Calendar (to configure non-working hours and different calendars same as in Time in status for Jira Cloud.) 

Add-ons have a 30-day free trial version and free up to 10 users. 
Please, let me know if you have any questions

Hope it helps 😌
Valeriia

1 vote
Mehmet A _Bloompeak_
Atlassian Partner
June 27, 2023

Hi @TN Raju

If you prefer to use a marketplace app, you can try Status Time Reports app developed by our team. It mainly provides reports and gadgets based on how much time passed in each status. Status durations are calculated according to the working calendar you define. Once you enter your working calendar into the app, it takes your working schedule into account too. That is, "In Progress" time of an issue opened on Friday at 5 PM and closed on Monday at 9 AM, will be a few hours rather than 3 days.

Here is the online demo link, you can see it in action and try without installing the app. For your case, you can have a look at Time in Status for Each Issue report.

  • This app has a dynamic status grouping feature so that you can generate various valuable reports as time in status, time in assignee, status entry dates and status counts, cycle time and lead time, average/sum reports by any field(e.g. average in progress time by project, average cycle time by issue creation month).
  • You can search issues by Project, Issue Type, Status, Assignee, Issue Creation/Resolution Date(and any other Date field) and JQL Query.
  • You can set different duration formats.
  • You can export reports in CSV file format and open them in MS Excel.
  • You can also add this app as a gadget to your Jira dashboards and reach “Status Time” from Issue Detail page.
  • You can enable/disable access to Status Time reports&gadgets and Issue Detail page per project, users, groups or project role.

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

Hope it helps.

1 vote
Albert Manuel
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 27, 2023

I tried myself such thing without success - so i use status time free plugin for this - in dc version.

0 votes
Emre Toptancı _OBSS_
Atlassian Partner
July 3, 2023

Hello @TN Raju

As others have pointed out, this is possible but certainly not easy. You will need to build separate scripted fields for each status you want to see and it is a really hard calculation. Besides, this is not a cheap calculation to make by script. Remember, the script will run every time the issue is displayed. This might cause significant performance problems, especially on older issues.

The data needed for such a measurement is present in each issue's history but Jira does not give this as a ready-to-use report. For that, you will need to use a marketplace app.

Our team at OBSS built Timepiece - Time in Status for Jira exactly for this. 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 or each assignee

The app can create reports showing both resolved and unresolved issues. 

tisCloud_StatusDuration_LeadTime_with Estimates.png    tisCloud_AssigneeDuration.png

You can combine the time for multiple statuses to get metrics like Issue Age, Cycle Time, Lead Time, Resolution Time etc. 

For all numeric report types, you can calculate averages and sums of those durations grouped by the issue fields you select. For example total in-progress time per customer 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. 

tisCloud_StatusDuration_LeadTime_Average_TimeGrouped.png

The app 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 for Jira Cloud.

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.

Gadget_AverageStatusDurationByComponent.png  tisCloud_StatusDuration_LeadTime_Chart.png

Timepiece - Time in Status for Jira

EmreT

0 votes
Dan -minware-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 27, 2023

@Radek Dostál is correct - this is not easy to do but if you are open to a 3rd party we can help at minware. Our tool provides a weighted time allocation metric called Dev Days that accommodates nights, weekends, and all time zones globally:

minware_time_allocation_heuristics.png

0 votes
Radek Dostál
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 27, 2023

While this is possible, it's certainly not easy because you need to take into consideration different user time zones, possibly different working hours, in grand scheme of things, some teams might work 7 days a week, some not. Using https://docs.oracle.com/javase/8/docs/api/java/util/Calendar.html you can get the "start" and "end" milliseconds, with the Calendar, you would be able to infer from the data which portion is inside weekend, which is outside of it, but it's, yet again, not so simple because then you also need to account for the possibility of multiple weeks.

All in all doing this with pure "start" and "end" times is computationally heavy, due to multiple time zones and user requirements, further quite complex. Bear in mind that scripted fields do not provide a reliable index to search on (the value will not be re-indexed/stored outside of the issue itself being updated).

For all intents and purposes, I would try to discourage doing this through scripted fields, because it will have a performance overhead and likely not provide you with the functionality you're after.

TN Raju June 27, 2023

Thank you for your feedback Radek Dostál

Suggest an answer

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

Atlassian Community Events