diff --git a/pkg/serializer/calc_price.go b/pkg/serializer/calc_price.go index 54bae47..2b03e77 100644 --- a/pkg/serializer/calc_price.go +++ b/pkg/serializer/calc_price.go @@ -39,7 +39,7 @@ func CalcPrice(total_price int64, total_ruler int32, artworksPrices []*model.Art maxId, dirId := findArtworkToAdd(artworksPrices, int64(price)) - if dirId > 0 { + if dirId >= 0 { artworksPrices[dirId].Price = artworksPrices[dirId].Price + loss_total_price } else { artworksPrices[maxId].Price = artworksPrices[maxId].Price + loss_total_price @@ -60,7 +60,7 @@ func CalcPrice(total_price int64, total_ruler int32, artworksPrices []*model.Art } } - if dirId > 0 { + if dirId >= 0 { artworksPrices[dirId].ArtworkPrice = artworksPrices[dirId].ArtworkPrice + loss_artwork_price } else { artworksPrices[maxId].ArtworkPrice = artworksPrices[maxId].ArtworkPrice + loss_artwork_price @@ -77,7 +77,7 @@ func CalcPrice(total_price int64, total_ruler int32, artworksPrices []*model.Art } } - if dirId > 0 { + if dirId >= 0 { artworksPrices[dirId].CopyrightPrice = artworksPrices[dirId].CopyrightPrice + loss_copyright_price } else { artworksPrices[maxId].CopyrightPrice = artworksPrices[maxId].CopyrightPrice + loss_copyright_price