From 6377f55fb07571466f4db71d8c32372ec8bfda6b Mon Sep 17 00:00:00 2001 From: Lars Meijers Date: Mon, 13 Nov 2023 13:42:09 +0100 Subject: [PATCH] fixed the burndown calculation function to ignore duplicates and also calculate risk accepted findings --- dojo/utils.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/dojo/utils.py b/dojo/utils.py index 27a0135d83..19f1db975b 100644 --- a/dojo/utils.py +++ b/dojo/utils.py @@ -28,7 +28,7 @@ from dojo.github import add_external_issue_github, update_external_issue_github, close_external_issue_github, reopen_external_issue_github from dojo.models import Finding, Engagement, Finding_Group, Finding_Template, Product, \ Test, User, Dojo_User, System_Settings, Notifications, Endpoint, Benchmark_Type, \ - Language_Type, Languages, Dojo_Group_Member, Dojo_Group, NOTIFICATION_CHOICES + Language_Type, Languages, Dojo_Group_Member, Dojo_Group, NOTIFICATION_CHOICES, Risk_Acceptance from asteval import Interpreter from dojo.notifications.helper import create_notification import logging @@ -2522,7 +2522,7 @@ def sum_by_severity_level(metrics): def get_open_findings_burndown(product): - findings = Finding.objects.filter(test__engagement__product=product) + findings = Finding.objects.filter(test__engagement__product=product, duplicate=False) f_list = list(findings) curr_date = datetime.combine(datetime.now(), datetime.min.time()) @@ -2577,6 +2577,20 @@ def get_open_findings_burndown(product): if f.severity == 'Info': info_count -= 1 + if f.risk_accepted: + f_risk_accepted = f.risk_acceptance.created.timestamp() + if f_risk_accepted >= d_start and f_risk_accepted < d_end: + if f.severity == 'Critical': + critical_count -= 1 + if f.severity == 'High': + high_count -= 1 + if f.severity == 'Medium': + medium_count -= 1 + if f.severity == 'Low': + low_count -= 1 + if f.severity == 'Info': + info_count -= 1 + f_day = [critical_count, high_count, medium_count, low_count, info_count] if min(f_day) < running_min: running_min = min(f_day)