Fixed caching

This commit is contained in:
Aryom Belousov 2020-11-09 19:21:16 +03:00
parent 7f77f8ebb3
commit f0a83a4f23
4 changed files with 33 additions and 21 deletions

View file

@ -14,7 +14,14 @@ const scgDomain = "https://starcitygames.com"
const scgSearchUrlTemplate = "https://starcitygames.hawksearch.com/sites/starcitygames/?search_query=%v"
func GetPrices(name string) ([]CardPrice, error) {
return GetPricesScg(name)
prices, err := GetPricesScg(name)
if err != nil {
return nil, err
}
if len(prices) > 5 {
return prices[:5], nil
}
return prices, nil
}
func GetPricesScg(name string) ([]CardPrice, error) {
@ -69,8 +76,5 @@ func GetPricesTcg(name string) ([]CardPrice, error) {
}
prices = append(prices, cardPrice)
}
if len(prices) > 5 {
return prices[:5], nil
}
return prices, nil
}