MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / entWrPolicySummary

Function entWrPolicySummary

app/controlplane/pkg/data/workflowrun.go:621–648  ·  view source on GitHub ↗

entWrPolicySummary builds the domain summary from the materialized columns. Returns nil when the row predates the materialization change (all columns NULL) so callers can tell "never computed" apart from "computed and empty".

(wr *ent.WorkflowRun)

Source from the content-addressed store, hash-verified

619// Returns nil when the row predates the materialization change (all columns
620// NULL) so callers can tell "never computed" apart from "computed and empty".
621func entWrPolicySummary(wr *ent.WorkflowRun) *chainloop.PolicyStatusSummary {
622 if wr.PolicyStatus == nil {
623 return nil
624 }
625
626 s := &chainloop.PolicyStatusSummary{
627 Status: entToPolicyStatus(*wr.PolicyStatus),
628 }
629 if wr.PolicyEvaluationsTotal != nil {
630 s.Total = int(*wr.PolicyEvaluationsTotal)
631 }
632 if wr.PolicyEvaluationsPassed != nil {
633 s.Passed = int(*wr.PolicyEvaluationsPassed)
634 }
635 if wr.PolicyEvaluationsSkipped != nil {
636 s.Skipped = int(*wr.PolicyEvaluationsSkipped)
637 }
638 if wr.PolicyViolationsCount != nil {
639 s.Violated = int(*wr.PolicyViolationsCount)
640 }
641 if wr.PolicyViolationsSuppressed != nil {
642 s.Suppressed = int(*wr.PolicyViolationsSuppressed)
643 }
644 if wr.PolicyHasGates != nil {
645 s.HasGates = *wr.PolicyHasGates
646 }
647 return s
648}

Callers 1

entWrToBizWrFunction · 0.85

Calls 1

entToPolicyStatusFunction · 0.85

Tested by

no test coverage detected