Skip to content

Commit

Permalink
fix[avas]:load list data
Browse files Browse the repository at this point in the history
  • Loading branch information
fishTsai20 committed Jan 24, 2024
1 parent 47287a6 commit c7661a0
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions loader/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -426,15 +426,17 @@ func LoadList(db *gorm.DB) ([]*model.List, error) {
return lists, err
}

err = db.Find(&tokenActivities).Error
result := db.Raw("SELECT MAX(block_number) FROM token_activities").Scan(&maxBlockNumber)
if result.Error != nil {
maxBlockNumber = 0
}

err = db.Where("type = ?", "list").Find(&tokenActivities).Error
if err != nil {
return lists, err
}

for _, activity := range tokenActivities {
if activity.BlockNumber > maxBlockNumber {
maxBlockNumber = activity.BlockNumber
}
if activity.Type == "list" {
amount, precision, err := model.NewDecimalFromString(activity.Amt.String())
if err != nil {
Expand Down

0 comments on commit c7661a0

Please sign in to comment.