From 601260494694578df7e0c06e450eb4ef39e08544 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Mon, 9 Sep 2024 09:57:38 +0200 Subject: [PATCH] perf(salix): refs #7671 #7671 imrpove and revert where changes --- modules/item/back/methods/fixed-price/filter.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/modules/item/back/methods/fixed-price/filter.js b/modules/item/back/methods/fixed-price/filter.js index addc7027d..3bc8ed6b0 100644 --- a/modules/item/back/methods/fixed-price/filter.js +++ b/modules/item/back/methods/fixed-price/filter.js @@ -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);