From f0fc422e30dc54e5c7a3b9b4ed75b75c229e03ff Mon Sep 17 00:00:00 2001 From: Corentin Barreau Date: Thu, 27 Apr 2023 12:54:00 +0200 Subject: [PATCH] Small cosmetics fixes --- src/serra/helpers.go | 18 ++++++++---------- src/serra/remove.go | 2 +- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/serra/helpers.go b/src/serra/helpers.go index 74eea62..c6ae294 100644 --- a/src/serra/helpers.go +++ b/src/serra/helpers.go @@ -53,20 +53,19 @@ func modifyCardCount(coll *Collection, c *Card, amount int64, foil bool) error { return nil } -func findCardbyCollectornumber(coll *Collection, setcode string, collectornumber string) (*Card, error) { - +func findCardByCollectorNumber(coll *Collection, setCode string, collectorNumber string) (*Card, error) { sort := bson.D{{"_id", 1}} - search_filter := bson.D{{"set", setcode}, {"collectornumber", collectornumber}} - stored_cards, err := coll.storageFind(search_filter, sort) + searchFilter := bson.D{{"set", setCode}, {"collectornumber", collectorNumber}} + storedCards, err := coll.storageFind(searchFilter, sort) if err != nil { return &Card{}, err } - if len(stored_cards) < 1 { + if len(storedCards) < 1 { return &Card{}, errors.New("Card not found") } - return &stored_cards[0], nil + return &storedCards[0], nil } func stringToTime(s primitive.DateTime) string { @@ -93,17 +92,16 @@ func missing(a, b []string) []string { } func findSetByCode(coll *Collection, setcode string) (*Set, error) { - - stored_sets, err := coll.storageFindSet(bson.D{{"code", setcode}}, bson.D{{"_id", 1}}) + storedSets, err := coll.storageFindSet(bson.D{{"code", setcode}}, bson.D{{"_id", 1}}) if err != nil { return &Set{}, err } - if len(stored_sets) < 1 { + if len(storedSets) < 1 { return &Set{}, errors.New("Set not found") } - return &stored_sets[0], nil + return &storedSets[0], nil } func convertManaSymbols(sym []interface{}) string { diff --git a/src/serra/remove.go b/src/serra/remove.go index ad6c7d4..aa531fc 100644 --- a/src/serra/remove.go +++ b/src/serra/remove.go @@ -75,7 +75,7 @@ func removeCards(cards []string, count int64) error { setName := strings.Split(card, "/")[0] // Fetch card from scryfall - c, err := findCardbyCollectornumber(coll, setName, collectorNumber) + c, err := findCardByCollectorNumber(coll, setName, collectorNumber) if err != nil { LogMessage(fmt.Sprintf("%v", err), "red") continue