Remove Debug
Also make sample program useful
This commit is contained in:
parent
cf5d10aaf8
commit
b29e554d69
2
aoc.go
2
aoc.go
@ -70,8 +70,6 @@ func (a *AoC) fetchLeaderboard(year int) (*Leaderboard, error) {
|
|||||||
|
|
||||||
client := &http.Client{}
|
client := &http.Client{}
|
||||||
boardString := fmt.Sprintf("https://adventofcode.com/%d/leaderboard/private/view/%s.json", year, a.boardId)
|
boardString := fmt.Sprintf("https://adventofcode.com/%d/leaderboard/private/view/%s.json", year, a.boardId)
|
||||||
fmt.Println(boardString)
|
|
||||||
|
|
||||||
req, err = http.NewRequest("GET", boardString, nil)
|
req, err = http.NewRequest("GET", boardString, nil)
|
||||||
req.Header.Add("Cookie", "session="+a.session)
|
req.Header.Add("Cookie", "session="+a.session)
|
||||||
resp, err = client.Do(req)
|
resp, err = client.Do(req)
|
||||||
|
11
cmd/main.go
11
cmd/main.go
@ -3,7 +3,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"time"
|
"sort"
|
||||||
|
|
||||||
aoc "git.bullercodeworks.com/brian/go-adventofcode"
|
aoc "git.bullercodeworks.com/brian/go-adventofcode"
|
||||||
)
|
)
|
||||||
@ -21,7 +21,14 @@ func main() {
|
|||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
var members []aoc.Member
|
||||||
for _, v := range l.Members {
|
for _, v := range l.Members {
|
||||||
fmt.Println(v.Name, v.LocalScore, v.LastStarTs.Format(time.RFC3339))
|
members = append(members, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sort.Sort(aoc.ByStarsThenScore(members))
|
||||||
|
for _, v := range members {
|
||||||
|
fmt.Println(v.Name, v.Stars, v.LocalScore)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user