Browse Source

EDIT: cron-job, округление ДШВ

portowyi 1 year ago
parent
commit
ce06b8a42e
1 changed files with 7 additions and 6 deletions
  1. 7 6
      cron-job/cronJobs.go

+ 7 - 6
cron-job/cronJobs.go

@@ -7,6 +7,7 @@ import (
 	"kng_feed_api/helper"
 	"kng_feed_api/model"
 	"log"
+	"math"
 	"os"
 	"path/filepath"
 	"strconv"
@@ -171,23 +172,23 @@ func CreateXMLFeed() {
 			Name: "deficit",
 		})
 		offer.Param = append(offer.Param, Param{
-			Text: strconv.FormatFloat(value.Width, 'f', 6, 64),
+			Text: strconv.FormatFloat(math.Round(value.Width*100)/100, 'f', 6, 64),
 			Name: "width",
 		})
 		offer.Param = append(offer.Param, Param{
-			Text: strconv.FormatFloat(value.Height, 'f', 6, 64),
+			Text: strconv.FormatFloat(math.Round(value.Height*100)/100, 'f', 6, 64),
 			Name: "height",
 		})
 		offer.Param = append(offer.Param, Param{
-			Text: strconv.FormatFloat(value.Weight, 'f', 6, 64),
+			Text: strconv.FormatFloat(math.Round(value.Weight*100)/100, 'f', 6, 64),
 			Name: "weight",
 		})
 		offer.Param = append(offer.Param, Param{
-			Text: strconv.FormatFloat(value.Length, 'f', 6, 64),
+			Text: strconv.FormatFloat(math.Round(value.Length*100)/100, 'f', 6, 64),
 			Name: "length",
 		})
 		offer.Param = append(offer.Param, Param{
-			Text: strconv.FormatFloat(value.Multiple, 'f', 6, 64),
+			Text: strconv.FormatFloat(math.Round(value.Multiple*100)/100, 'f', 6, 64),
 			Name: "multiple",
 		})
 
@@ -202,7 +203,7 @@ func CreateXMLFeed() {
 		}
 
 		if value.Certificates != nil {
-			certificates := strings.Split(*value.IdNumbers, ";")
+			certificates := strings.Split(*value.Certificates, ";")
 			for idx, cert := range certificates {
 				offer.Param = append(offer.Param, Param{
 					Text: cert,