perf(salix): refs #7671 #7671 imrpove and revert where changes

This commit is contained in:
Javier Segarra 2024-09-09 09:57:38 +02:00
parent 5c4a30f2f9
commit 6012604946
1 changed files with 5 additions and 8 deletions

View File

@ -128,6 +128,9 @@ module.exports = Self => {
return {[param]: value};
}
});
if (ctx.req.query.showBadDates === 'true')
where['fp.started'] = {gte: Date.vnNew()};
filter = mergeFilters(filter, {where});
const stmts = [];
@ -184,14 +187,8 @@ module.exports = Self => {
}
}
}
if (ctx.req.query.showBadDates === 'true') {
stmt.merge({
sql: ` WHERE
fp.started> util.VN_CURDATE() `});
} else
stmt.merge(conn.makeWhere(filter.where));
stmt.merge(conn.makeOrderBy(filter.order));
stmt.merge(conn.makeLimit(filter));
stmt.merge(conn.makeSuffix(filter));
const fixedPriceIndex = stmts.push(stmt) - 1;
const sql = ParameterizedSQL.join(stmts, ';');
const result = await conn.executeStmt(sql, myOptions);