Fixed bug with limiting card amount

This commit is contained in:
Artyom Belousov 2019-11-22 18:44:22 +03:00
parent 61302ce9bc
commit 8d0e5ed4db

View file

@ -28,7 +28,10 @@ func preprocessNameForSearch(name string) string {
} }
func fetchPrices(doc *html.Node) ([]CardPrice, error) { func fetchPrices(doc *html.Node) ([]CardPrice, error) {
priceContainers := getPriceContainers(doc)[:MaxCards] priceContainers := getPriceContainers(doc)
if MaxCards < len(priceContainers) {
priceContainers = priceContainers[:MaxCards]
}
length := len(priceContainers) length := len(priceContainers)
prices := make(chan CardPrice, length) prices := make(chan CardPrice, length)
finished := make(chan bool, length) finished := make(chan bool, length)