Small cosmetics fixes
This commit is contained in:
parent
73e982ab92
commit
f0fc422e30
@ -53,20 +53,19 @@ func modifyCardCount(coll *Collection, c *Card, amount int64, foil bool) error {
|
|||||||
return nil
|
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}}
|
sort := bson.D{{"_id", 1}}
|
||||||
search_filter := bson.D{{"set", setcode}, {"collectornumber", collectornumber}}
|
searchFilter := bson.D{{"set", setCode}, {"collectornumber", collectorNumber}}
|
||||||
stored_cards, err := coll.storageFind(search_filter, sort)
|
storedCards, err := coll.storageFind(searchFilter, sort)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return &Card{}, err
|
return &Card{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(stored_cards) < 1 {
|
if len(storedCards) < 1 {
|
||||||
return &Card{}, errors.New("Card not found")
|
return &Card{}, errors.New("Card not found")
|
||||||
}
|
}
|
||||||
|
|
||||||
return &stored_cards[0], nil
|
return &storedCards[0], nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func stringToTime(s primitive.DateTime) string {
|
func stringToTime(s primitive.DateTime) string {
|
||||||
@ -93,17 +92,16 @@ func missing(a, b []string) []string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func findSetByCode(coll *Collection, setcode string) (*Set, error) {
|
func findSetByCode(coll *Collection, setcode string) (*Set, error) {
|
||||||
|
storedSets, err := coll.storageFindSet(bson.D{{"code", setcode}}, bson.D{{"_id", 1}})
|
||||||
stored_sets, err := coll.storageFindSet(bson.D{{"code", setcode}}, bson.D{{"_id", 1}})
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return &Set{}, err
|
return &Set{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(stored_sets) < 1 {
|
if len(storedSets) < 1 {
|
||||||
return &Set{}, errors.New("Set not found")
|
return &Set{}, errors.New("Set not found")
|
||||||
}
|
}
|
||||||
|
|
||||||
return &stored_sets[0], nil
|
return &storedSets[0], nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func convertManaSymbols(sym []interface{}) string {
|
func convertManaSymbols(sym []interface{}) string {
|
||||||
|
|||||||
@ -75,7 +75,7 @@ func removeCards(cards []string, count int64) error {
|
|||||||
setName := strings.Split(card, "/")[0]
|
setName := strings.Split(card, "/")[0]
|
||||||
|
|
||||||
// Fetch card from scryfall
|
// Fetch card from scryfall
|
||||||
c, err := findCardbyCollectornumber(coll, setName, collectorNumber)
|
c, err := findCardByCollectorNumber(coll, setName, collectorNumber)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
LogMessage(fmt.Sprintf("%v", err), "red")
|
LogMessage(fmt.Sprintf("%v", err), "red")
|
||||||
continue
|
continue
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user