-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstats.go
48 lines (38 loc) · 1.02 KB
/
stats.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package main
import (
"log"
"github.com/ellielle/bootdev-buddy/internal/bootdevapi"
)
// GetArchmagesList returns the data from the archmage leaderboard
func (a *App) ArchmagesList() []bootdevapi.Archmage {
list, err := bootdevapi.Archmages(a.cache)
if err != nil {
log.Fatal(err)
}
return list
}
// GlobalStats returns the general global stats from the leaderboard
func (a *App) GlobalStats() bootdevapi.GlobalStats {
stats, err := bootdevapi.GetGeneralStats(a.cache)
if err != nil {
log.Fatal(err)
}
return stats
}
// TopDailyLearners returns the top 30 users based on exp earned
func (a *App) TopDailyLearners() []bootdevapi.LeaderboardUser {
list, err := bootdevapi.GetDailyStats(a.cache)
if err != nil {
log.Fatal(err)
}
return list
}
// TopCommunity returns the top 30 members of the discord community,
// based on a variety of factors such as activity
func (a *App) TopCommunity() []bootdevapi.Archon {
list, err := bootdevapi.GetDiscordLeaderboard(a.cache)
if err != nil {
log.Fatal(err)
}
return list
}