diff --git a/pkg/jia/handlers.go b/pkg/jia/handlers.go index 6a30a59..ef6c84c 100644 --- a/pkg/jia/handlers.go +++ b/pkg/jia/handlers.go @@ -90,7 +90,7 @@ func onMessage(slackClient *slack.Client, event *slackevents.MessageEvent) { month := now.Month() // Increment the person's monthly count - redisClient.Incr(fmt.Sprintf("leaderboard:%d-%d:%s", month, year, event.User)) + redisClient.Incr(fmt.Sprintf("leaderboard:%d-%d:%s", year, month, event.User)) } func HandleLeaderboardSlashCommand(w http.ResponseWriter, r *http.Request) { @@ -99,13 +99,13 @@ func HandleLeaderboardSlashCommand(w http.ResponseWriter, r *http.Request) { year := now.Year() month := now.Month() - scan := redisClient.Scan(0, fmt.Sprintf("leaderboard:%d-%d:*", month, year), 10) + scan := redisClient.Scan(0, fmt.Sprintf("leaderboard:%d-%d:*", year, month), 10) if scan.Err() != nil { w.Write([]byte("Something went wrong while loading the leaderboard :cry: Please try again later!")) return } - scan_iterator := scan.Iterator() + scanIterator := scan.Iterator() type Entry struct { Number int @@ -114,16 +114,16 @@ func HandleLeaderboardSlashCommand(w http.ResponseWriter, r *http.Request) { entries := []Entry{} - for scan_iterator.Next() { - entry := redisClient.Get(scan_iterator.Val()) - entry_int, err := entry.Int() + for scanIterator.Next() { + entry := redisClient.Get(scanIterator.Val()) + entryInt, err := entry.Int() if err != nil { return } - if user, ok := parseLeaderboardEntry(scan_iterator.Val()); ok { + if user, ok := parseLeaderboardEntry(scanIterator.Val()); ok { entries = append(entries, Entry{ - Number: entry_int, + Number: entryInt, User: user, }) }