Fix wrong engaged alerts number when a filter is applied

This commit is contained in:
emanuele-f 2019-07-31 15:05:26 +02:00
parent 6f52961c84
commit 444916fa14
2 changed files with 17 additions and 10 deletions

View file

@ -466,17 +466,29 @@ local function engagedAlertsQuery(params)
i = i + 1
end
return(res)
return res, totalRows
end
-- #################################
function getAlerts(what, options)
function getAlerts(what, options, with_counters)
local alerts, num_alerts
if what == "engaged" then
return engagedAlertsQuery(options)
alerts, num_alerts = engagedAlertsQuery(options)
if not with_counters then
num_alerts = nil
end
else
return performAlertsQuery("SELECT rowid, *", what, options)
alerts = performAlertsQuery("SELECT rowid, *", what, options)
if with_counters then
num_alerts = getNumAlerts(what, options)
end
end
return alerts, num_alerts
end
-- #################################