Skip to content

Commit

Permalink
Merge pull request #104 from decert-me/feature/ranking
Browse files Browse the repository at this point in the history
Fix 排行榜 Holders 列表排序错误
  • Loading branch information
0xdwong authored Dec 29, 2023
2 parents bb1a78f + 3e0d151 commit 421257e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions internal/app/dao/collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,10 +350,10 @@ func (d *Dao) GetCollectionHolderRank(address string, id int64, page, pageSize i
return res, total, err
}
err = d.db.Model(&model.UserChallenges{}).
Select("ROW_NUMBER() OVER (ORDER BY user_challenges.add_ts ASC) as rank,users.*,to_timestamp(user_challenges.add_ts) as claim_time").
Select("ROW_NUMBER() OVER (ORDER BY user_challenges.add_ts ASC,user_challenges.id ASC) as rank,users.*,to_timestamp(user_challenges.add_ts) as claim_time").
Joins("LEFT JOIN users ON user_challenges.address=users.address").
Where("user_challenges.token_id", tokenId).
Order("user_challenges.add_ts DESC").
Order("user_challenges.add_ts ASC,user_challenges.id ASC").
Limit(limit).Offset(offset).
Find(&res).Error
fmt.Println(res)
Expand Down
4 changes: 2 additions & 2 deletions internal/app/dao/quest.go
Original file line number Diff line number Diff line change
Expand Up @@ -561,10 +561,10 @@ func (d *Dao) GetQuestHolderRankByTokenID(address string, tokenId int64, page, p
return res, total, err
}
err = d.db.Model(&model.UserChallenges{}).
Select("ROW_NUMBER() OVER (ORDER BY user_challenges.add_ts ASC) as rank,users.*,to_timestamp(user_challenges.add_ts) as claim_time").
Select("ROW_NUMBER() OVER (ORDER BY user_challenges.add_ts ASC,user_challenges.id ASC) as rank,users.*,to_timestamp(user_challenges.add_ts) as claim_time").
Joins("LEFT JOIN users ON user_challenges.address=users.address").
Where("user_challenges.token_id", tokenId).
Order("user_challenges.add_ts DESC").
Order("user_challenges.add_ts ASC,user_challenges.id ASC").
Limit(limit).Offset(offset).
Find(&res).Error
fmt.Println(res)
Expand Down

0 comments on commit 421257e

Please sign in to comment.