mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-23 23:04:04 +00:00
Fix #2371 by left join maintenance_timeslot
This commit is contained in:
parent
54aa7d5dca
commit
02b5cae577
2 changed files with 20 additions and 16 deletions
|
@ -188,13 +188,13 @@ class Maintenance extends BeanModel {
|
||||||
*/
|
*/
|
||||||
static getActiveMaintenanceSQLCondition() {
|
static getActiveMaintenanceSQLCondition() {
|
||||||
return `
|
return `
|
||||||
|
(
|
||||||
(maintenance_timeslot.start_date <= DATETIME('now')
|
(maintenance_timeslot.start_date <= DATETIME('now')
|
||||||
AND maintenance_timeslot.end_date >= DATETIME('now')
|
AND maintenance_timeslot.end_date >= DATETIME('now')
|
||||||
AND maintenance.active = 1)
|
AND maintenance.active = 1)
|
||||||
OR
|
OR
|
||||||
(maintenance.strategy = 'manual' AND active = 1)
|
(maintenance.strategy = 'manual' AND active = 1)
|
||||||
|
)
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,10 +204,12 @@ class Maintenance extends BeanModel {
|
||||||
*/
|
*/
|
||||||
static getActiveAndFutureMaintenanceSQLCondition() {
|
static getActiveAndFutureMaintenanceSQLCondition() {
|
||||||
return `
|
return `
|
||||||
((maintenance_timeslot.end_date >= DATETIME('now')
|
(
|
||||||
AND maintenance.active = 1)
|
((maintenance_timeslot.end_date >= DATETIME('now')
|
||||||
OR
|
AND maintenance.active = 1)
|
||||||
(maintenance.strategy = 'manual' AND active = 1))
|
OR
|
||||||
|
(maintenance.strategy = 'manual' AND active = 1))
|
||||||
|
)
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -282,11 +282,13 @@ class StatusPage extends BeanModel {
|
||||||
let activeCondition = Maintenance.getActiveMaintenanceSQLCondition();
|
let activeCondition = Maintenance.getActiveMaintenanceSQLCondition();
|
||||||
let maintenanceBeanList = R.convertToBeans("maintenance", await R.getAll(`
|
let maintenanceBeanList = R.convertToBeans("maintenance", await R.getAll(`
|
||||||
SELECT maintenance.*
|
SELECT maintenance.*
|
||||||
FROM maintenance, maintenance_status_page msp, maintenance_timeslot
|
FROM maintenance
|
||||||
WHERE msp.maintenance_id = maintenance.id
|
JOIN maintenance_status_page
|
||||||
AND maintenance_timeslot.maintenance_id = maintenance.id
|
ON maintenance_status_page.maintenance_id = maintenance.id
|
||||||
AND msp.status_page_id = ?
|
AND maintenance_status_page.status_page_id = ?
|
||||||
AND ${activeCondition}
|
LEFT JOIN maintenance_timeslot
|
||||||
|
ON maintenance_timeslot.maintenance_id = maintenance.id
|
||||||
|
WHERE ${activeCondition}
|
||||||
ORDER BY maintenance.end_date
|
ORDER BY maintenance.end_date
|
||||||
`, [ statusPageId ]));
|
`, [ statusPageId ]));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue