From 484b8d42e1c233a21d7f08f1f969cd392a16e12d Mon Sep 17 00:00:00 2001 From: vicent Date: Tue, 10 Jan 2023 13:31:20 +0100 Subject: [PATCH 1/4] fix: corregido sql --- modules/zone/back/methods/zone/getZoneClosing.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/modules/zone/back/methods/zone/getZoneClosing.js b/modules/zone/back/methods/zone/getZoneClosing.js index 2a0088203..0e3872c1b 100644 --- a/modules/zone/back/methods/zone/getZoneClosing.js +++ b/modules/zone/back/methods/zone/getZoneClosing.js @@ -30,8 +30,11 @@ module.exports = Self => { if (typeof options == 'object') Object.assign(myOptions, options); + const dated = new Date(date); + const dayName = dated.toString().split(' ')[0]; + query = ` - SELECT * + SELECT * FROM ( SELECT DISTINCT z.id, @@ -42,16 +45,16 @@ module.exports = Self => { FROM vn.zone z JOIN agencyMode am ON am.id = z.agencyModeFk LEFT JOIN zoneEvent ze ON ze.zoneFk = z.id - WHERE + WHERE ( - dated = ? - OR ? BETWEEN started AND ended - OR INSTR(weekDays, SUBSTRING(DAYNAME(?), 1, 3) ) > 0 + dated = ? + OR ? BETWEEN started AND ended + OR weekDays LIKE ? ) AND z.id IN (?) ORDER BY type='day' DESC, type='range' DESC, type='indefinitely' DESC) z GROUP BY z.id`; - return Self.rawSql(query, [date, date, date, zoneIds], myOptions); + return Self.rawSql(query, [date, date, dayName, zoneIds], myOptions); }; }; -- 2.40.1 From 5d19da48e2dd4685701bc25c2f4980e3dc70025b Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 20 Jan 2023 08:16:02 +0100 Subject: [PATCH 2/4] refactor: actualizada consulta sql --- .../zone/back/methods/zone/getZoneClosing.js | 45 +++++++++---------- 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/modules/zone/back/methods/zone/getZoneClosing.js b/modules/zone/back/methods/zone/getZoneClosing.js index 0e3872c1b..8714e8e65 100644 --- a/modules/zone/back/methods/zone/getZoneClosing.js +++ b/modules/zone/back/methods/zone/getZoneClosing.js @@ -30,31 +30,28 @@ module.exports = Self => { if (typeof options == 'object') Object.assign(myOptions, options); - const dated = new Date(date); - const dayName = dated.toString().split(' ')[0]; - query = ` - SELECT * - FROM ( - SELECT - DISTINCT z.id, - z.name, - am.name agencyModeName, - IFNULL(ze.hour, z.hour) as hour, - IFNULL(ze.price, z.price) as price - FROM vn.zone z - JOIN agencyMode am ON am.id = z.agencyModeFk - LEFT JOIN zoneEvent ze ON ze.zoneFk = z.id - WHERE - ( - dated = ? - OR ? BETWEEN started AND ended - OR weekDays LIKE ? - ) - AND z.id IN (?) - ORDER BY type='day' DESC, type='range' DESC, type='indefinitely' DESC) z - GROUP BY z.id`; + SELECT * + FROM ( + SELECT + DISTINCT z.id, + z.name, + am.name agencyModeName, + IFNULL(ze.hour, z.hour) as hour, + IFNULL(ze.price, z.price) as price + FROM vn.zone z + JOIN vn.agencyMode am ON am.id = z.agencyModeFk + LEFT JOIN vn.zoneEvent ze ON ze.zoneFk = z.id + WHERE + ( + ze.dated = ? + OR ? BETWEEN ze.started AND ze.ended + OR ze.weekDays & (1 << WEEKDAY(?)) + ) + AND z.id IN (?) + ORDER BY type='day' DESC, type='range' DESC, type='indefinitely' DESC) z + GROUP BY z.id;`; - return Self.rawSql(query, [date, date, dayName, zoneIds], myOptions); + return Self.rawSql(query, [date, date, date, zoneIds], myOptions); }; }; -- 2.40.1 From f7969c616c151b6e584717071c7cf8c6c8cd24d6 Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 27 Jan 2023 08:59:28 +0100 Subject: [PATCH 3/4] fix: tiene el cuenta zonEvent.type --- .../zone/back/methods/zone/getZoneClosing.js | 45 ++++++++++--------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/modules/zone/back/methods/zone/getZoneClosing.js b/modules/zone/back/methods/zone/getZoneClosing.js index 8714e8e65..76706b55c 100644 --- a/modules/zone/back/methods/zone/getZoneClosing.js +++ b/modules/zone/back/methods/zone/getZoneClosing.js @@ -31,27 +31,30 @@ module.exports = Self => { Object.assign(myOptions, options); query = ` - SELECT * - FROM ( - SELECT - DISTINCT z.id, - z.name, - am.name agencyModeName, - IFNULL(ze.hour, z.hour) as hour, - IFNULL(ze.price, z.price) as price - FROM vn.zone z - JOIN vn.agencyMode am ON am.id = z.agencyModeFk - LEFT JOIN vn.zoneEvent ze ON ze.zoneFk = z.id - WHERE - ( - ze.dated = ? - OR ? BETWEEN ze.started AND ze.ended - OR ze.weekDays & (1 << WEEKDAY(?)) - ) - AND z.id IN (?) - ORDER BY type='day' DESC, type='range' DESC, type='indefinitely' DESC) z - GROUP BY z.id;`; + SELECT * + FROM ( + SELECT + DISTINCT z.id, + z.name, + am.name agencyModeName, + IFNULL(ze.hour, z.hour) as hour, + IFNULL(ze.price, z.price) as price + FROM vn.zone z + JOIN vn.agencyMode am ON am.id = z.agencyModeFk + LEFT JOIN vn.zoneEvent ze ON ze.zoneFk = z.id + WHERE (( + ze.type = 'day' + AND ze.dated = ? + ) OR ( + ze.type != 'day' + AND ze.weekDays & (1 << WEEKDAY(?)) + AND (ze.started IS NULL OR ? >= ze.started) + AND (ze.ended IS NULL OR ? <= ze.ended) + )) + AND z.id IN (?) + ORDER BY type='day' DESC, type='range' DESC, type='indefinitely' DESC) z + GROUP BY z.id`; - return Self.rawSql(query, [date, date, date, zoneIds], myOptions); + return Self.rawSql(query, [date, date, date, date, zoneIds], myOptions); }; }; -- 2.40.1 From e69a6ae0dcfb06fcbb8cdfa801a5f82f3fc2bc8c Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 3 Feb 2023 13:25:38 +0100 Subject: [PATCH 4/4] add changelog --- CHANGELOG.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 91ce818a8..6533a84ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,10 +11,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - ### Changed -- +- (General -> Inicio) Ahora permite recuperar la contraseña tanto con el correo de recuperación como el usuario ### Fixed -- +- (Monitor de tickets) Cuando ordenas por columna, ya no se queda deshabilitado el botón de 'Actualizar' +- (Zone -> Días de entrega) Al hacer click en un día, muestra correctamente las zonas ## [2304.01] - 2023-02-09 -- 2.40.1