Skip to content

Commit 8a07f99

Browse files
authored
fix(metrics): load project (#1611)
Signed-off-by: Miguel Martinez <[email protected]>
1 parent 2fda84d commit 8a07f99

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

app/controlplane/pkg/data/orgmetrics.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func NewOrgMetricsRepo(data *Data, l log.Logger) biz.OrgMetricsRepo {
4444

4545
func (repo *OrgMetricsRepo) RunsTotal(ctx context.Context, orgID uuid.UUID, tw *biz.TimeWindow) (int32, error) {
4646
total, err := orgScopedQuery(repo.data.DB, orgID).
47-
QueryWorkflows().
47+
QueryWorkflows().WithProject().
4848
QueryWorkflowruns().
4949
Where(
5050
workflowrun.CreatedAtGTE(tw.From),
@@ -66,7 +66,7 @@ func (repo *OrgMetricsRepo) RunsByStatusTotal(ctx context.Context, orgID uuid.UU
6666
}
6767

6868
if err := orgScopedQuery(repo.data.DB, orgID).
69-
QueryWorkflows().
69+
QueryWorkflows().WithProject().
7070
QueryWorkflowruns().
7171
Where(
7272
workflowrun.CreatedAtGTE(tw.From),
@@ -124,7 +124,6 @@ func (repo *OrgMetricsRepo) TopWorkflowsByRunsCount(ctx context.Context, orgID u
124124
if err := orgScopedQuery(repo.data.DB, orgID).
125125
QueryWorkflows().
126126
QueryWorkflowruns().
127-
WithWorkflow().
128127
Where(
129128
workflowrun.CreatedAtGTE(tw.From),
130129
workflowrun.CreatedAtLTE(tw.To),
@@ -146,7 +145,7 @@ func (repo *OrgMetricsRepo) TopWorkflowsByRunsCount(ctx context.Context, orgID u
146145
return nil, err
147146
}
148147

149-
wf, err := orgScopedQuery(repo.data.DB, orgID).QueryWorkflows().Where(workflow.ID(workflowID)).First(ctx)
148+
wf, err := orgScopedQuery(repo.data.DB, orgID).QueryWorkflows().WithProject().Where(workflow.ID(workflowID)).First(ctx)
150149
if err != nil {
151150
if ent.IsNotFound(err) {
152151
continue

0 commit comments

Comments
 (0)