Author: Adam <git@apiote.tk>
sort experiences for item
db/db.go | 8 ++++++++
diff --git a/db/db.go b/db/db.go index 449974c120c0176728f84badb94e0dfdaa726f09..0586233dd5dc4fc5802c44d648ae0242512a141a 100644 --- a/db/db.go +++ b/db/db.go @@ -10,6 +10,7 @@ "encoding/hex" "errors" "fmt" "os" + "sort" "time" _ "github.com/mattn/go-sqlite3" @@ -262,6 +263,13 @@ return times, err } t = t.In(location) times[id] = append(times[id], t) + } + + for k, v := range times { + sort.Slice(v, func(i, j int) bool { + return v[i].After(v[j]) + }) + times[k] = v } return times, nil }