1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00

chore: display leaderboard update time

This commit is contained in:
Ferdinand Mütsch
2022-10-06 15:30:18 +02:00
parent dec5849661
commit ef87445e43
5 changed files with 17 additions and 1 deletions

View File

@@ -68,3 +68,13 @@ func (l Leaderboard) TopKeysByUser(by uint8, userId string) []string {
return item.UserID == userId
})).TopKeys(by)
}
func (l Leaderboard) LastUpdate() time.Time {
lastUpdate := time.Time{}
for _, item := range l {
if item.CreatedAt.T().After(lastUpdate) {
lastUpdate = item.CreatedAt.T()
}
}
return lastUpdate
}