stash filterState

This commit is contained in:
Carlos Satorres 2024-07-09 11:00:02 +02:00
parent 5558e69e64
commit 02c2ccd62e
1 changed files with 11 additions and 0 deletions

View File

@ -347,6 +347,17 @@ module.exports = Self => {
if (hasWhere) if (hasWhere)
stmt.merge(conn.makeWhere(problems)); stmt.merge(conn.makeWhere(problems));
if (filter.order) {
const index = filter.order.findIndex(o => o.includes('stateFk'));
if (index > -1) {
filter.order = [
...filter.order.slice(0, index),
'refFk ' + filter.order[index].split(' ')[1],
...filter.order.slice(index)
];
}
}
stmt.merge(conn.makeOrderBy(filter.order)); stmt.merge(conn.makeOrderBy(filter.order));
stmt.merge(conn.makeLimit(filter)); stmt.merge(conn.makeLimit(filter));
const ticketsIndex = stmts.push(stmt) - 1; const ticketsIndex = stmts.push(stmt) - 1;