Skip to content

Commit

Permalink
Add aging table
Browse files Browse the repository at this point in the history
  • Loading branch information
ilausuch committed Apr 26, 2022
1 parent 1bac25f commit 6f1c3a8
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/backlog_checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -890,6 +890,58 @@ jobs:
header: "Public Cloud Epics"


# Aging
- name: aging containers
if: always()
run: |
python backlog_checker.py aging tb_start
env:
key: ${{ secrets.REDMINE_API_KEY }}
query: "Finished In The Last 30 Days: Containers"
header: "Aging tickets finished in the last 30 days"
category: "Aging of tickets"
category_description: |
Mesures the time since the ticket is created and the ticket is resolved
rowText: "Containers"
head: "Days to complete (Adv)"
- name: aging JeOS
if: always()
run: |
python backlog_checker.py aging
env:
key: ${{ secrets.REDMINE_API_KEY }}
query: "Finished In The Last 30 Days: JeOS"
rowText: "JeOS"
head: "Days to complete (Adv)"
- name: aging WSL
if: always()
run: |
python backlog_checker.py aging
env:
key: ${{ secrets.REDMINE_API_KEY }}
query: "Finished In The Last 30 Days: WSL"
rowText: "WSL"
head: "Days to complete (Adv)"
- name: aging Public Cloud
if: always()
run: |
python backlog_checker.py aging
env:
key: ${{ secrets.REDMINE_API_KEY }}
query: "Finished In The Last 30 Days: Public Cloud"
rowText: "Public Cloud"
head: "Days to complete (Adv)"
- name: aging SLE Micro
if: always()
run: |
python backlog_checker.py aging tb_end
env:
key: ${{ secrets.REDMINE_API_KEY }}
query: "Finished In The Last 30 Days: SLE Micro"
rowText: "SLE Micro"
head: "Days to complete (Adv)"


- name: Footer
if: always()
run: |
Expand Down
30 changes: 30 additions & 0 deletions backlog_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,34 @@ def gha_epics():
table_end_to_md()
print_footer()

def gha_aging():
initialize_queries()

root = query_base(os.environ['query'])

sum = 0
count = 0
for i in root['issues']:
created_on = datetime.strptime(i['created_on'], '%Y-%m-%dT%H:%M:%SZ').timestamp()
closed_on = datetime.strptime(i['closed_on'], '%Y-%m-%dT%H:%M:%SZ').timestamp()
difference = (closed_on - created_on) / (60*60*24)
sum = sum + difference
count = count + 1

adv = sum / count

gha_table([
{
"header": "Backlog Query",
"text": os.environ["rowText"]
},
{
"header": os.environ['head'],
"text": str(adv),
"link": query_links[os.environ['query']]
}
])

def gha_description():
text = os.environ['text']
toMD(text)
Expand All @@ -325,5 +353,7 @@ def gha_description():
gha_comp_2()
elif "description" in sys.argv:
gha_description()
elif "aging" in sys.argv:
gha_aging()
else:
gha_check()

0 comments on commit 6f1c3a8

Please sign in to comment.