test(e2e_order): fiter optimized
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Alex Moreno 2023-05-10 09:16:19 +02:00
parent 7a668adf18
commit 8c0deb6cfa
3 changed files with 79 additions and 1 deletions

View File

@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- (Ticket -> Boxing) Arreglado selección de horas
- (Cesta -> Índice) Optimizada búsqueda

View File

@ -0,0 +1,77 @@
CREATE OR REPLACE
ALGORITHM = UNDEFINED VIEW `vn`.`zoneEstimatedDelivery` AS
select
`t`.`zoneFk` AS `zoneFk`,
cast(`util`.`VN_CURDATE`() + interval hour(ifnull(`zc`.`hour`, `z`.`hour`)) * 60 + minute(ifnull(`zc`.`hour`, `z`.`hour`)) minute as time) AS `hourTheoretical`,
cast(sum(`sv`.`volume`) as decimal(5, 1)) AS `totalVolume`,
cast(sum(if(`s`.`alertLevel` < 2, `sv`.`volume`, 0)) as decimal(5, 1)) AS `remainingVolume`,
greatest(
ifnull(`lhp`.`m3`, 0),
ifnull(`dl`.`minSpeed`, 0)
) AS `speed`,
cast(`zc`.`hour` + interval -sum(if(`s`.`alertLevel` < 2, `sv`.`volume`, 0)) * 60 / greatest(ifnull(`lhp`.`m3`, 0), ifnull(`dl`.`minSpeed`, 0)) minute as time) AS `hourEffective`,
floor(-sum(if(`s`.`alertLevel` < 2, `sv`.`volume`, 0)) * 60 / greatest(ifnull(`lhp`.`m3`, 0), ifnull(`dl`.`minSpeed`, 0))) AS `minutesLess`,
cast(`zc`.`hour` + interval -sum(if(`s`.`alertLevel` < 2, `sv`.`volume`, 0)) * 60 / greatest(ifnull(`lhp`.`m3`, 0), ifnull(`dl`.`minSpeed`, 0)) minute as time) AS `etc`
from
(
(
(
(
(
(
(
(
(
`vn`.`ticket` `t`
join `vn`.`ticketStateToday` `tst` on
(
`tst`.`ticket` = `t`.`id`
)
)
join `vn`.`state` `s` on
(
`s`.`id` = `tst`.`state`
)
)
join `vn`.`saleVolume` `sv` on
(
`sv`.`ticketFk` = `t`.`id`
)
)
left join `vn`.`lastHourProduction` `lhp` on
(
`lhp`.`warehouseFk` = `t`.`warehouseFk`
)
)
join `vn`.`warehouse` `w` on
(
`w`.`id` = `t`.`warehouseFk`
)
)
join `vn`.`warehouseAlias` `wa` on
(
`wa`.`id` = `w`.`aliasFk`
)
)
straight_join `vn`.`zone` `z` on
(
`z`.`id` = `t`.`zoneFk`
)
)
left join `vn`.`zoneClosure` `zc` on
(
`zc`.`zoneFk` = `t`.`zoneFk`
and `zc`.`dated` = `util`.`VN_CURDATE`()
)
)
left join `cache`.`departure_limit` `dl` on
(
`dl`.`warehouse_id` = `t`.`warehouseFk`
and `dl`.`fecha` = `util`.`VN_CURDATE`()
)
)
where
`w`.`hasProduction` <> 0
and cast(`t`.`shipped` as date) = `util`.`VN_CURDATE`()
group by
`t`.`zoneFk`;

View File

@ -141,7 +141,7 @@ module.exports = Self => {
let stmt;
stmt = new ParameterizedSQL(
`CREATE TEMPORARY TABLE tmp.filter
`CREATE OR REPLACE TEMPORARY TABLE tmp.filter
(INDEX (id))
ENGINE = MEMORY
SELECT