From 125b7730e736b2e8421e4226c624a80d4d109230 Mon Sep 17 00:00:00 2001 From: jgallego Date: Thu, 16 Jan 2025 12:56:04 +0100 Subject: [PATCH] feat: refs #8298 update price calculation logic and add packagesDiscountFactor column to client table --- db/routines/vn/procedures/catalog_componentCalculate.sql | 6 +----- db/versions/11398-orangeRose/02-clientAlter.sql | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/db/routines/vn/procedures/catalog_componentCalculate.sql b/db/routines/vn/procedures/catalog_componentCalculate.sql index 991ff412f..aaf2db408 100644 --- a/db/routines/vn/procedures/catalog_componentCalculate.sql +++ b/db/routines/vn/procedures/catalog_componentCalculate.sql @@ -236,11 +236,7 @@ BEGIN ic.cm3delivery * ( ( - zo.price - - ( - (zo.price - zo.priceOptimum) - * c.packagesDiscountFactor - ) + zo.priceOptimum + (( zo.price - zo.priceOptimum) * 2 * ( 1 - c.packagesDiscountFactor)) ) - IFNULL(zo.bonus, 0) ) diff --git a/db/versions/11398-orangeRose/02-clientAlter.sql b/db/versions/11398-orangeRose/02-clientAlter.sql index 4119f05ff..b5275a301 100644 --- a/db/versions/11398-orangeRose/02-clientAlter.sql +++ b/db/versions/11398-orangeRose/02-clientAlter.sql @@ -1,3 +1,3 @@ ALTER TABLE `vn`.`client` ADD COLUMN `packagesDiscountFactor` DECIMAL(4,3) NOT NULL DEFAULT 1.000 - COMMENT 'Factor (1-0) que pondera el precio final entre priceOptimum (mejor) y price (peor)'; + COMMENT 'Porcentaje de ajuste entre el numero de bultos medio del cliente, y el número medio óptimo para las zonas en las que compra';