Skip to content

Commit

Permalink
[fix] Count all changes of vulnerable and compliant (#431)
Browse files Browse the repository at this point in the history
  • Loading branch information
aquamatthias authored May 3, 2024
1 parent 20ba869 commit d12e922
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions fixbackend/inventory/inventory_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,15 +418,14 @@ async def issues_since(
accounts_by_severity: Dict[str, Set[str]] = defaultdict(set)
resource_count_by_severity: Dict[str, int] = defaultdict(int)
resource_count_by_kind: Dict[str, int] = defaultdict(int)
# vulnerable: use current severity, compliant: use previous severity
severity_prop = "/security.severity" if change == "node_vulnerable" else "/diff.previous"
async with self.client.execute_single(
db,
f"history --change {change} --after {duration.total_seconds()}s | aggregate "
f"history --change node_vulnerable --change node_compliant "
f"--after {duration.total_seconds()}s | aggregate "
f"/ancestors.account.reported.id as account_id, "
f"{severity_prop} as severity,"
f"/diff.{change}[*].severity as severity,"
f"kind as kind"
": count(name) as count | dump",
": sum(1) as count | dump",
) as result:
async for elem in result:
assert isinstance(elem, dict), f"Expected Json object but got {elem}"
Expand Down

0 comments on commit d12e922

Please sign in to comment.