Skip to content

Commit

Permalink
fixed the burndown calculation function to ignore duplicates and also…
Browse files Browse the repository at this point in the history
… calculate risk accepted findings
  • Loading branch information
lme-nca authored Nov 13, 2023
1 parent 0456bbe commit f18e2e2
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions dojo/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit f18e2e2

Please sign in to comment.