Added collectors number to edition

This commit is contained in:
Artyom Belousov 2020-09-22 11:40:54 +03:00
parent 194aee8e69
commit a941095a73
2 changed files with 3 additions and 5 deletions

View file

@ -19,11 +19,7 @@ func GetPrices(name string) ([]CardPrice, error) {
resp, err := client.SearchCards(ctx, name, opts) resp, err := client.SearchCards(ctx, name, opts)
var prices []CardPrice var prices []CardPrice
for _, card := range resp.Cards { for _, card := range resp.Cards {
fullArtString := "" edition := card.SetName + " #" + card.CollectorNumber
if card.FullArt {
fullArtString = " (Fullart)"
}
edition := card.SetName + fullArtString
if card.Prices.USD == "" && card.Prices.USDFoil == "" { if card.Prices.USD == "" && card.Prices.USDFoil == "" {
continue continue
} }

View file

@ -1,6 +1,7 @@
package tests package tests
import ( import (
"fmt"
"github.com/flygrounder/go-mtg-vk/cardsinfo" "github.com/flygrounder/go-mtg-vk/cardsinfo"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"testing" "testing"
@ -8,6 +9,7 @@ import (
func TestParser(t *testing.T) { func TestParser(t *testing.T) {
prices, err := cardsinfo.GetPrices("Scavenging Ooze") prices, err := cardsinfo.GetPrices("Scavenging Ooze")
fmt.Println(prices)
assert.Nil(t, err) assert.Nil(t, err)
assert.NotEmpty(t, prices) assert.NotEmpty(t, prices)
} }