Skip to content

Commit

Permalink
early return when a twin does not have contracts
Browse files Browse the repository at this point in the history
  • Loading branch information
Omarabdul3ziz committed Sep 17, 2024
1 parent 6f6f6a7 commit b729e7d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions grid-proxy/internal/explorer/db_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ func (c *DBClient) GetTwinConsumption(ctx context.Context, twinId uint64) (types
}
}

if len(allCIds) == 0 {
return types.TwinConsumption{}, nil
}

// get the latest two reports for each active contract
reports, err := c.DB.GetContractsLatestBillReports(ctx, nonDeletedCIds, 2)
if err != nil {
Expand Down

0 comments on commit b729e7d

Please sign in to comment.