4873-zone.delivery-day #1248

Merged
vicent merged 8 commits from 4873-zone.delivery-day into dev 2023-02-03 12:28:36 +00:00
1 changed files with 9 additions and 6 deletions
Showing only changes of commit 484b8d42e1 - Show all commits

View File

@ -30,8 +30,11 @@ module.exports = Self => {
if (typeof options == 'object')
Object.assign(myOptions, options);
const dated = new Date(date);
vicent marked this conversation as resolved Outdated
Outdated
Review

Esto es necesario? Si se define el argumento como tipo Date debería llegar una fecha

Esto es necesario? Si se define el argumento como tipo Date debería llegar una fecha
const dayName = dated.toString().split(' ')[0];
vicent marked this conversation as resolved Outdated
Outdated
Review

No nesario si se pasa directamente date a la función

No nesario si se pasa directamente date a la función
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
(
vicent marked this conversation as resolved Outdated
Outdated
Review

S'ha de tindre en compte tambe la columna type de zoneEvent, mira el WHERE del procediment vn.zone_getOptionsForLanding

S'ha de tindre en compte tambe la columna `type` de `zoneEvent`, mira el WHERE del procediment `vn.zone_getOptionsForLanding`

Pero aixo ja ho fa:

 WHERE
                        (
                            ze.dated = ?
                            OR ? BETWEEN ze.started AND ze.ended
                            OR ze.weekDays & (1 << WEEKDAY(?))
                        )

pq depen del camps q tinga rellenats es un type o altre.

Pero aixo ja ho fa: ``` WHERE ( ze.dated = ? OR ? BETWEEN ze.started AND ze.ended OR ze.weekDays & (1 << WEEKDAY(?)) ) ``` pq depen del camps q tinga rellenats es un type o altre.

Vale res, he vist q pot tindre started, ended y weekDays rellenat. Pensava q eren exclusius.

Vale res, he vist q pot tindre started, ended y weekDays rellenat. Pensava q eren exclusius.
dated = ?
OR ? BETWEEN started AND ended
OR INSTR(weekDays, SUBSTRING(DAYNAME(?), 1, 3) ) > 0
dated = ?
OR ? BETWEEN started AND ended
OR weekDays LIKE ?
vicent marked this conversation as resolved Outdated
Outdated
Review

Pasar la fecha directamnte y comparar así: ze.weekDays & (1 << WEEKDAY(?))

Además hay que tener en cuenta el tipo de evento type.

Todas las columnas de la consulta debería llevar el alias de la tabla.

Pasar la fecha directamnte y comparar así: `ze.weekDays & (1 << WEEKDAY(?))` Además hay que tener en cuenta el tipo de evento `type`. Todas las columnas de la consulta debería llevar el alias de la tabla.
)
vicent marked this conversation as resolved Outdated
Outdated
Review

N'hi ha una tabulació de mes en tota la consulta, punt i coma no fa falta al final si nomes es una consulta.

N'hi ha una tabulació de mes en tota la consulta, punt i coma no fa falta al final si nomes es una consulta.
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);
vicent marked this conversation as resolved Outdated
Outdated
Review

Pasar date en lugar de dayName

Pasar `date` en lugar de `dayName`
};
};