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:
parent
dec5849661
commit
ef87445e43
@ -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
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package view
|
||||
import (
|
||||
"github.com/muety/wakapi/models"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
type LeaderboardViewModel struct {
|
||||
@ -69,3 +70,7 @@ func (s *LeaderboardViewModel) LangIcon(lang string) string {
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (s *LeaderboardViewModel) LastUpdate() time.Time {
|
||||
return models.Leaderboard(s.Items).LastUpdate()
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
Binary file not shown.
@ -77,6 +77,7 @@
|
||||
</li>
|
||||
{{ end }}
|
||||
</ol>
|
||||
<p class="text-sm pt-8">Last Updated: {{ .LastUpdate | datetime }}</p>
|
||||
{{ else }}
|
||||
<p>
|
||||
<span class="iconify inline text-white text-base" data-icon="twemoji:frowning-face"></span>
|
||||
|
Loading…
Reference in New Issue
Block a user