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);
|
Object.assign(myOptions, options);
|
||||||
|
|
||||||
query = `
|
query = `
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM (
|
FROM (
|
||||||
SELECT
|
SELECT
|
||||||
DISTINCT z.id,
|
DISTINCT z.id,
|
||||||
z.name,
|
z.name,
|
||||||
am.name agencyModeName,
|
am.name agencyModeName,
|
||||||
IFNULL(ze.hour, z.hour) as hour,
|
IFNULL(ze.hour, z.hour) as hour,
|
||||||
IFNULL(ze.price, z.price) as price
|
IFNULL(ze.price, z.price) as price
|
||||||
FROM vn.zone z
|
FROM vn.zone z
|
||||||
JOIN vn.agencyMode am ON am.id = z.agencyModeFk
|
JOIN vn.agencyMode am ON am.id = z.agencyModeFk
|
||||||
LEFT JOIN vn.zoneEvent ze ON ze.zoneFk = z.id
|
LEFT JOIN vn.zoneEvent ze ON ze.zoneFk = z.id
|
||||||
WHERE
|
WHERE ((
|
||||||
(
|
ze.type = 'day'
|
||||||
ze.dated = ?
|
AND ze.dated = ?
|
||||||
OR ? BETWEEN ze.started AND ze.ended
|
) OR (
|
||||||
OR ze.weekDays & (1 << WEEKDAY(?))
|
ze.type != 'day'
|
||||||
)
|
AND ze.weekDays & (1 << WEEKDAY(?))
|
||||||
AND z.id IN (?)
|
AND (ze.started IS NULL OR ? >= ze.started)
|
||||||
ORDER BY type='day' DESC, type='range' DESC, type='indefinitely' DESC) z
|
AND (ze.ended IS NULL OR ? <= ze.ended)
|
||||||
GROUP BY z.id;`;
|
))
|
||||||
|
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