Skip to content

1024pix/compute-lead-time

Repository files navigation

compute-lead-time

This is a simple script to save all transitions of a Jira Issues to a PostgreSQL database.

Transitions are the changes of status of an issue. For example, when an issue is created, it is in the status To Do. When it is moved to In Progress, it is a transition.

How to use

  1. Install the requirements:
npm ci
  1. Copy sample.env and fill the variables:
cp sample.env .env
  1. Run the script:
node --env-file=.env index.js

SQL Usage Example

with age as (select t1."issueId",t1.destination as status, sum(age(t2.timestamp, t1.timestamp)) as duration
from transitions t1
inner join transitions t2 on t1.destination = t2.source and t1."issueId" = t2."issueId" group by t1."issueId", status)
select status, extract(epoch from percentile_disc(0.5) within group (order by duration)) / 86400 AS age_in_days 
from age
where status in ('Ready for dev', 'Doing', 'Tech/Func Review', 'Deployed on Integration', 'Deployed on Recette') and extract(epoch from duration) > 0
group by status 
order by position(status::text in 'Ready for dev, Doing, Tech/Func Review, Deployed on Integration, Deployed on Recette');

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published