fix: tiene el cuenta zonEvent.type
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Vicent Llopis 2023-01-27 08:59:28 +01:00
parent 5d19da48e2
commit f7969c616c
1 changed files with 24 additions and 21 deletions

View File

@ -42,16 +42,19 @@ module.exports = Self => {
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 (ze.started IS NULL OR ? >= ze.started)
AND (ze.ended IS NULL OR ? <= ze.ended)
))
AND z.id IN (?) AND z.id IN (?)
ORDER BY type='day' DESC, type='range' DESC, type='indefinitely' DESC) z ORDER BY type='day' DESC, type='range' DESC, type='indefinitely' DESC) z
GROUP BY z.id;`; GROUP BY z.id`;
return Self.rawSql(query, [date, date, date, zoneIds], myOptions); return Self.rawSql(query, [date, date, date, date, zoneIds], myOptions);
}; };
}; };