Skip to content

Commit

Permalink
Merge pull request #1972 from opengovern/fix-web-ui
Browse files Browse the repository at this point in the history
fix: fix get controls
  • Loading branch information
artaasadi authored Nov 13, 2024
2 parents 8c24d66 + d79bf5e commit 00a245e
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions pkg/compliance/http_routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -3526,9 +3526,10 @@ func (h *HttpHandler) ListControlsFiltered(echoCtx echo.Context) error {
apiControl.Query.Parameters = append(apiControl.Query.Parameters, p.ToApi())
}

controlSummary, err := h.getControlSummary(ctx, control.ID, nil, integrationIDs)
h.logger.Info("ListControlsByFilter", zap.Strings("benchmarks", benchmarks))
controlResult, _, err := es.BenchmarksControlSummary(ctx, h.logger, h.client, benchmarks, nil)
if err != nil {
return err
h.logger.Error("failed to fetch control result", zap.Error(err), zap.String("controlID", control.ID), zap.Any("benchmarkID", benchmarks))
}

if req.ComplianceResultSummary {
Expand Down Expand Up @@ -3558,10 +3559,10 @@ func (h *HttpHandler) ListControlsFiltered(echoCtx echo.Context) error {
}{
IncidentCount: incidentCount,
NonIncidentCount: passingComplianceResultCount,
CompliantResources: controlSummary.TotalResourcesCount - controlSummary.FailedResourcesCount,
NonCompliantResources: controlSummary.FailedResourcesCount,
ImpactedResources: controlSummary.TotalResourcesCount,
CostImpact: controlSummary.CostImpact,
CompliantResources: controlResult[control.ID].TotalResourcesCount - controlResult[control.ID].FailedResourcesCount,
NonCompliantResources: controlResult[control.ID].FailedResourcesCount,
ImpactedResources: controlResult[control.ID].TotalResourcesCount,
CostImpact: controlResult[control.ID].CostImpact,
}
}

Expand Down

0 comments on commit 00a245e

Please sign in to comment.