Fixed foil prices

This commit is contained in:
Artyom Belousov 2020-09-22 10:45:22 +03:00
parent 789db10013
commit ca5468eb15
2 changed files with 4 additions and 3 deletions

View file

@ -20,13 +20,15 @@ func GetPrices(name string) ([]CardPrice, error) {
var prices []CardPrice var prices []CardPrice
for _, card := range resp.Cards { for _, card := range resp.Cards {
foilString := "" foilString := ""
price := card.Prices.USD
if card.Foil { if card.Foil {
foilString = "(Foil)" foilString = "(Foil)"
price = card.Prices.USDFoil
} }
edition := card.Set + foilString edition := card.SetName + foilString
cardPrice := CardPrice { cardPrice := CardPrice {
Edition: edition, Edition: edition,
Price: card.Prices.USD, Price: price,
Name: card.Name, Name: card.Name,
Link: card.PurchaseURIs.TCGPlayer, Link: card.PurchaseURIs.TCGPlayer,
} }

View file

@ -1,7 +1,6 @@
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"