Skip to content

Commit

Permalink
Merge pull request #1202 from threefoldtech/development_proxy_fix_nul…
Browse files Browse the repository at this point in the history
…l_consumption

fix getting consumption for a twin doesn't have contracts
  • Loading branch information
Omarabdul3ziz authored Sep 23, 2024
2 parents ed885b4 + b729e7d commit d54bb9e
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 d54bb9e

Please sign in to comment.