Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -63,7 +63,7 @@ func SavePricingRulesBulkHandler(pg *sql.DB) http.HandlerFunc {
|
||||
updated := 0
|
||||
for _, it := range payload.Items {
|
||||
// Zero means that no rounding rule has been configured yet.
|
||||
if it.TryStep < 0 || it.UsdStep < 0 || it.EurStep < 0 {
|
||||
if it.TryWholesaleStep < 0 || it.TryRetailStep < 0 || it.UsdWholesaleStep < 0 || it.UsdRetailStep < 0 || it.EurWholesaleStep < 0 || it.EurRetailStep < 0 {
|
||||
http.Error(w, "invalid rounding step", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
@@ -188,9 +188,9 @@ func filterPricingRuleExportRows(rows []queries.PricingParameterRuleRow, r *http
|
||||
}
|
||||
|
||||
fields := []string{
|
||||
"try_base", "try1", "try2", "try3", "try4", "try5", "try6", "try_step",
|
||||
"usd_base", "usd1", "usd2", "usd3", "usd4", "usd5", "usd6", "usd_step",
|
||||
"eur_base", "eur1", "eur2", "eur3", "eur4", "eur5", "eur6", "eur_step",
|
||||
"try_base", "try1", "try2", "try3", "try4", "try5", "try6", "try_wholesale_step", "try_retail_step",
|
||||
"usd_base", "usd1", "usd2", "usd3", "usd4", "usd5", "usd6", "usd_wholesale_step", "usd_retail_step",
|
||||
"eur_base", "eur1", "eur2", "eur3", "eur4", "eur5", "eur6", "eur_wholesale_step", "eur_retail_step",
|
||||
}
|
||||
minMap := map[string]*float64{}
|
||||
maxMap := map[string]*float64{}
|
||||
@@ -238,8 +238,10 @@ func pricingRuleNumericValue(row queries.PricingParameterRuleRow, field string)
|
||||
return row.Rule.Try5
|
||||
case "try6":
|
||||
return row.Rule.Try6
|
||||
case "try_step":
|
||||
return row.Rule.TryStep
|
||||
case "try_wholesale_step":
|
||||
return row.Rule.TryWholesaleStep
|
||||
case "try_retail_step":
|
||||
return row.Rule.TryRetailStep
|
||||
case "usd_base":
|
||||
return row.Rule.UsdBase
|
||||
case "usd1":
|
||||
@@ -254,8 +256,10 @@ func pricingRuleNumericValue(row queries.PricingParameterRuleRow, field string)
|
||||
return row.Rule.Usd5
|
||||
case "usd6":
|
||||
return row.Rule.Usd6
|
||||
case "usd_step":
|
||||
return row.Rule.UsdStep
|
||||
case "usd_wholesale_step":
|
||||
return row.Rule.UsdWholesaleStep
|
||||
case "usd_retail_step":
|
||||
return row.Rule.UsdRetailStep
|
||||
case "eur_base":
|
||||
return row.Rule.EurBase
|
||||
case "eur1":
|
||||
@@ -270,8 +274,10 @@ func pricingRuleNumericValue(row queries.PricingParameterRuleRow, field string)
|
||||
return row.Rule.Eur5
|
||||
case "eur6":
|
||||
return row.Rule.Eur6
|
||||
case "eur_step":
|
||||
return row.Rule.EurStep
|
||||
case "eur_wholesale_step":
|
||||
return row.Rule.EurWholesaleStep
|
||||
case "eur_retail_step":
|
||||
return row.Rule.EurRetailStep
|
||||
default:
|
||||
return 0
|
||||
}
|
||||
@@ -356,9 +362,9 @@ func buildPricingRuleCSV(rows []queries.PricingParameterRuleRow) string {
|
||||
headers := []string{
|
||||
"DURUM", "AKTIF", "ASKILI YAN", "KATEGORI", "URUN ILK GRUBU", "URUN ANA GRUBU", "URUN ALT GRUBU",
|
||||
"ICERIK", "MARKA", "BRAND CODE", "MARKA GRUBU",
|
||||
"TRY YUVARLAMA", "TRY TABAN", "TRY 1", "TRY 2", "TRY 3", "TRY 4", "TRY 5", "TRY 6",
|
||||
"USD YUVARLAMA", "USD TABAN", "USD 1", "USD 2", "USD 3", "USD 4", "USD 5", "USD 6",
|
||||
"EUR YUVARLAMA", "EUR TABAN", "EUR 1", "EUR 2", "EUR 3", "EUR 4", "EUR 5", "EUR 6",
|
||||
"TRY TOPTAN YUVARLAMA", "TRY PERAKENDE YUVARLAMA", "TRY TABAN", "TRY 1", "TRY 2", "TRY 3", "TRY 4", "TRY 5", "TRY 6",
|
||||
"USD TOPTAN YUVARLAMA", "USD PERAKENDE YUVARLAMA", "USD TABAN", "USD 1", "USD 2", "USD 3", "USD 4", "USD 5", "USD 6",
|
||||
"EUR TOPTAN YUVARLAMA", "EUR PERAKENDE YUVARLAMA", "EUR TABAN", "EUR 1", "EUR 2", "EUR 3", "EUR 4", "EUR 5", "EUR 6",
|
||||
}
|
||||
var b strings.Builder
|
||||
for i, h := range headers {
|
||||
@@ -386,7 +392,8 @@ func buildPricingRuleCSV(rows []queries.PricingParameterRuleRow) string {
|
||||
row.Marka,
|
||||
row.BrandCode,
|
||||
row.BrandGroupSec,
|
||||
fmt.Sprintf("%.2f", pricingRuleNumericValue(row, "try_step")),
|
||||
fmt.Sprintf("%.2f", pricingRuleNumericValue(row, "try_wholesale_step")),
|
||||
fmt.Sprintf("%.2f", pricingRuleNumericValue(row, "try_retail_step")),
|
||||
fmt.Sprintf("%.2f", pricingRuleNumericValue(row, "try_base")),
|
||||
fmt.Sprintf("%.2f", pricingRuleNumericValue(row, "try1")),
|
||||
fmt.Sprintf("%.2f", pricingRuleNumericValue(row, "try2")),
|
||||
@@ -394,7 +401,8 @@ func buildPricingRuleCSV(rows []queries.PricingParameterRuleRow) string {
|
||||
fmt.Sprintf("%.2f", pricingRuleNumericValue(row, "try4")),
|
||||
fmt.Sprintf("%.2f", pricingRuleNumericValue(row, "try5")),
|
||||
fmt.Sprintf("%.2f", pricingRuleNumericValue(row, "try6")),
|
||||
fmt.Sprintf("%.2f", pricingRuleNumericValue(row, "usd_step")),
|
||||
fmt.Sprintf("%.2f", pricingRuleNumericValue(row, "usd_wholesale_step")),
|
||||
fmt.Sprintf("%.2f", pricingRuleNumericValue(row, "usd_retail_step")),
|
||||
fmt.Sprintf("%.2f", pricingRuleNumericValue(row, "usd_base")),
|
||||
fmt.Sprintf("%.2f", pricingRuleNumericValue(row, "usd1")),
|
||||
fmt.Sprintf("%.2f", pricingRuleNumericValue(row, "usd2")),
|
||||
@@ -402,7 +410,8 @@ func buildPricingRuleCSV(rows []queries.PricingParameterRuleRow) string {
|
||||
fmt.Sprintf("%.2f", pricingRuleNumericValue(row, "usd4")),
|
||||
fmt.Sprintf("%.2f", pricingRuleNumericValue(row, "usd5")),
|
||||
fmt.Sprintf("%.2f", pricingRuleNumericValue(row, "usd6")),
|
||||
fmt.Sprintf("%.2f", pricingRuleNumericValue(row, "eur_step")),
|
||||
fmt.Sprintf("%.2f", pricingRuleNumericValue(row, "eur_wholesale_step")),
|
||||
fmt.Sprintf("%.2f", pricingRuleNumericValue(row, "eur_retail_step")),
|
||||
fmt.Sprintf("%.2f", pricingRuleNumericValue(row, "eur_base")),
|
||||
fmt.Sprintf("%.2f", pricingRuleNumericValue(row, "eur1")),
|
||||
fmt.Sprintf("%.2f", pricingRuleNumericValue(row, "eur2")),
|
||||
|
||||
Reference in New Issue
Block a user