From 2433d4ff5da40025ec92501d32b4a302c42f7966 Mon Sep 17 00:00:00 2001 From: Ivan Lausuch Date: Wed, 27 Apr 2022 10:27:02 +0200 Subject: [PATCH] enhance_aging --- .github/workflows/backlog_checker.yml | 10 +++++----- backlog_checker.py | 27 +++++++++++++++++++++++---- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/.github/workflows/backlog_checker.yml b/.github/workflows/backlog_checker.yml index 5f3f8f002d..4b66d918b8 100644 --- a/.github/workflows/backlog_checker.yml +++ b/.github/workflows/backlog_checker.yml @@ -903,7 +903,7 @@ jobs: category_description: | Mesures the time since the ticket is created and the ticket is resolved rowText: "Containers" - head: "Days to complete (Adv)" + head: "Days to complete" - name: aging JeOS if: always() run: | @@ -912,7 +912,7 @@ jobs: key: ${{ secrets.REDMINE_API_KEY }} query: "Finished In The Last 30 Days: JeOS" rowText: "JeOS" - head: "Days to complete (Adv)" + head: "Days to complete" - name: aging WSL if: always() run: | @@ -921,7 +921,7 @@ jobs: key: ${{ secrets.REDMINE_API_KEY }} query: "Finished In The Last 30 Days: WSL" rowText: "WSL" - head: "Days to complete (Adv)" + head: "Days to complete" - name: aging Public Cloud if: always() run: | @@ -930,7 +930,7 @@ jobs: key: ${{ secrets.REDMINE_API_KEY }} query: "Finished In The Last 30 Days: Public Cloud" rowText: "Public Cloud" - head: "Days to complete (Adv)" + head: "Days to complete" - name: aging SLE Micro if: always() run: | @@ -939,7 +939,7 @@ jobs: key: ${{ secrets.REDMINE_API_KEY }} query: "Finished In The Last 30 Days: SLE Micro" rowText: "SLE Micro" - head: "Days to complete (Adv)" + head: "Days to complete" - name: Footer diff --git a/backlog_checker.py b/backlog_checker.py index 045140f9cb..32cc1bc2cd 100644 --- a/backlog_checker.py +++ b/backlog_checker.py @@ -4,6 +4,7 @@ from datetime import datetime, timedelta from inspect import getmembers, isfunction import requests +import math # Icons used for PASS or FAIL in the md file result_icons = {"pass": "💚", "fail": "🔴", "review": "👈"} @@ -318,24 +319,42 @@ def gha_aging(): sum = 0 count = 0 + values = [] 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 + values.append(difference) + values = sorted(values) adv = sum / count + if len(values) > 0: + median = values[round(len(values)/2)] + + std_deviation = 0 + for v in values: + std_deviation = std_deviation = (v - adv) * (v - adv) + std_deviation = math.sqrt(std_deviation) / count gha_table([ { "header": "Backlog Query", - "text": os.environ["rowText"] + "text": os.environ["rowText"], + "link": query_links[os.environ['query']] }, { - "header": os.environ['head'], - "text": str(adv), - "link": query_links[os.environ['query']] + "header": os.environ['head'] + " (Adv)", + "text": str(round(adv)) + }, + { + "header": os.environ['head'] + " (Median)", + "text": str(round(median)) + }, + { + "header": os.environ['head'] + " (Std deviation)", + "text": str(round(std_deviation)) } ])