fix: tiene el cuenta zonEvent.type
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
5d19da48e2
commit
f7969c616c
|
@ -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);
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue