parsestock
This commit is contained in:
@@ -4,6 +4,8 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
messages "git.tornberg.me/go-cart-actor/pkg/messages"
|
||||
"github.com/matst80/slask-finder/pkg/index"
|
||||
@@ -52,10 +54,13 @@ func ToItemAddMessage(item *index.DataItem, storeId *string, qty int, country st
|
||||
}
|
||||
|
||||
stock := StockStatus(0)
|
||||
centralStockValue, ok := item.GetNumberFieldValue(3)
|
||||
centralStockValue, ok := item.GetStringFieldValue(3)
|
||||
if storeId == nil {
|
||||
if ok {
|
||||
stock = StockStatus(centralStockValue)
|
||||
pureNumber := strings.Replace(centralStockValue, "+", "", -1)
|
||||
if centralStock, err := strconv.ParseInt(pureNumber, 10, 64); err == nil {
|
||||
stock = StockStatus(centralStock)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
storeStock, ok := item.Stock.GetStock()[*storeId]
|
||||
|
||||
Reference in New Issue
Block a user