mirror of
https://github.com/muety/wakapi.git
synced 2023-08-10 21:12:56 +03:00
fix: case sensitivity with leaderboard languages (resolve #418)
This commit is contained in:
@@ -45,10 +45,11 @@ func (l Leaderboard) TopKeys(by uint8) []string {
|
||||
if item.Key == nil || item.By == nil || *item.By != by {
|
||||
continue
|
||||
}
|
||||
if _, ok := totalsMapped[*item.Key]; !ok {
|
||||
totalsMapped[*item.Key] = &keyTotal{Key: *item.Key, Total: 0}
|
||||
key := strings.ToLower(*item.Key)
|
||||
if _, ok := totalsMapped[key]; !ok {
|
||||
totalsMapped[key] = &keyTotal{Key: *item.Key, Total: 0}
|
||||
}
|
||||
totalsMapped[*item.Key].Total += item.Total
|
||||
totalsMapped[key].Total += item.Total
|
||||
}
|
||||
|
||||
totals := slice.Map[*keyTotal, keyTotal](maputil.Values[string, *keyTotal](totalsMapped), func(i int, item *keyTotal) keyTotal {
|
||||
|
@@ -47,7 +47,6 @@ func (s *LeaderboardViewModel) ColorModifier(item *models.LeaderboardItem, princ
|
||||
func (s *LeaderboardViewModel) LangIcon(lang string) string {
|
||||
// https://icon-sets.iconify.design/mdi/
|
||||
langs := map[string]string{
|
||||
"c": "c",
|
||||
"c++": "cpp",
|
||||
"cpp": "cpp",
|
||||
"go": "go",
|
||||
|
Reference in New Issue
Block a user