Skip to content
Snippets Groups Projects
Commit 683c18bc authored by gbe's avatar gbe
Browse files

Sort wines by rating

parent 09ce4c36
No related branches found
No related tags found
No related merge requests found
......@@ -9,6 +9,7 @@ import (
"image/png"
"io"
"log"
"sort"
"strconv"
// Imported for side effects to register format handlers
......@@ -153,6 +154,10 @@ func ListWines(ctx context.Context, db *bolt.DB) ([]Vino, error) {
return nil, err
}
sort.Slice(wines, func(i, j int) bool {
return wines[i].Rating > wines[j].Rating
})
return wines, nil
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment