Skip to content

Commit

Permalink
find
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberhorsey committed May 28, 2023
1 parent 4fc4c93 commit 52ce239
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions packages/eventindexer/repo/stat.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,6 @@ func (r *StatRepository) Save(ctx context.Context, opts eventindexer.SaveStatOpt
return nil, errors.Wrap(err, "r.db.gormDB.FirstOrCreate")
}

if s.AverageProofReward == "" {
s.AverageProofReward = "0"
}

if s.AverageProofTime == "" {
s.AverageProofTime = "0"
}

if opts.ProofReward != nil {
s.NumVerifiedBlocks++
s.AverageProofReward = opts.ProofReward.String()
Expand Down Expand Up @@ -66,5 +58,13 @@ func (r *StatRepository) Find(ctx context.Context) (*eventindexer.Stat, error) {
return nil, errors.Wrap(err, "r.db.gormDB.FirstOrCreate")
}

if s.AverageProofReward == "" {
s.AverageProofReward = "0"
}

if s.AverageProofTime == "" {
s.AverageProofTime = "0"
}

return s, nil
}

0 comments on commit 52ce239

Please sign in to comment.