From de1187b96c2cb0e348738ca8f64a4df0a8dd870d Mon Sep 17 00:00:00 2001 From: Artyom Belousov Date: Tue, 22 Sep 2020 12:11:49 +0300 Subject: [PATCH] Excluded cards with different names from results --- cardsinfo/prices.go | 3 ++- tests/prices_test.go | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cardsinfo/prices.go b/cardsinfo/prices.go index a879088..8a7ef41 100644 --- a/cardsinfo/prices.go +++ b/cardsinfo/prices.go @@ -1,6 +1,7 @@ package cardsinfo import ( + "fmt" "context" scryfall "github.com/BlueMonday/go-scryfall" @@ -16,7 +17,7 @@ func GetPrices(name string) ([]CardPrice, error) { opts := scryfall.SearchCardsOptions{ Unique: scryfall.UniqueModePrints, } - resp, err := client.SearchCards(ctx, name, opts) + resp, err := client.SearchCards(ctx, fmt.Sprintf("!\"%v\"", name), opts) var prices []CardPrice for _, card := range resp.Cards { edition := card.SetName + " #" + card.CollectorNumber diff --git a/tests/prices_test.go b/tests/prices_test.go index 23d4a10..fd7182f 100644 --- a/tests/prices_test.go +++ b/tests/prices_test.go @@ -8,7 +8,7 @@ import ( ) func TestParser(t *testing.T) { - prices, err := cardsinfo.GetPrices("Scavenging Ooze") + prices, err := cardsinfo.GetPrices("Black lotus") fmt.Println(prices) assert.Nil(t, err) assert.NotEmpty(t, prices)