Skip to content

Commit

Permalink
Merge pull request #666 from gobitfly/NOBIDS/data-access-overview-hours
Browse files Browse the repository at this point in the history
NOBIDS: fixed expected timeframe
  • Loading branch information
remoterami authored Aug 5, 2024
2 parents 99ff816 + f9dfdf8 commit 3deb406
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions backend/pkg/api/data_access/vdb_management.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,10 +312,10 @@ func (d *DataAccessService) GetValidatorDashboardOverview(ctx context.Context, d
WHERE validator_index = ANY($1)`
}

retrieveRewardsAndEfficiency := func(table string, days int, rewards *t.ClElValue[decimal.Decimal], apr *t.ClElValue[float64], efficiency *float64) {
retrieveRewardsAndEfficiency := func(table string, hours int, rewards *t.ClElValue[decimal.Decimal], apr *t.ClElValue[float64], efficiency *float64) {
// Rewards + APR
wg.Go(func() error {
(*rewards).El, (*apr).El, (*rewards).Cl, (*apr).Cl, err = d.internal_getElClAPR(ctx, dashboardId, -1, days)
(*rewards).El, (*apr).El, (*rewards).Cl, (*apr).Cl, err = d.internal_getElClAPR(ctx, dashboardId, -1, hours)
if err != nil {
return err
}
Expand Down Expand Up @@ -345,9 +345,9 @@ func (d *DataAccessService) GetValidatorDashboardOverview(ctx context.Context, d
})
}

retrieveRewardsAndEfficiency("validator_dashboard_data_rolling_daily", 1, &data.Rewards.Last24h, &data.Apr.Last24h, &data.Efficiency.Last24h)
retrieveRewardsAndEfficiency("validator_dashboard_data_rolling_weekly", 7, &data.Rewards.Last7d, &data.Apr.Last7d, &data.Efficiency.Last7d)
retrieveRewardsAndEfficiency("validator_dashboard_data_rolling_monthly", 30, &data.Rewards.Last30d, &data.Apr.Last30d, &data.Efficiency.Last30d)
retrieveRewardsAndEfficiency("validator_dashboard_data_rolling_daily", 24, &data.Rewards.Last24h, &data.Apr.Last24h, &data.Efficiency.Last24h)
retrieveRewardsAndEfficiency("validator_dashboard_data_rolling_weekly", 7*24, &data.Rewards.Last7d, &data.Apr.Last7d, &data.Efficiency.Last7d)
retrieveRewardsAndEfficiency("validator_dashboard_data_rolling_monthly", 30*24, &data.Rewards.Last30d, &data.Apr.Last30d, &data.Efficiency.Last30d)
retrieveRewardsAndEfficiency("validator_dashboard_data_rolling_total", -1, &data.Rewards.AllTime, &data.Apr.AllTime, &data.Efficiency.AllTime)

err = wg.Wait()
Expand Down

0 comments on commit 3deb406

Please sign in to comment.