8144-devToTest_2448 #3216

Merged
alexm merged 256 commits from 8144-devToTest_2448 into test 2024-11-19 07:36:04 +00:00
1 changed files with 11 additions and 6 deletions
Showing only changes of commit 7a9bcf11e2 - Show all commits

View File

@ -22,7 +22,7 @@ module.exports = Self => {
}, {
arg: 'from',
type: 'date',
description: 'The from date'
description: 'The from date',
}, {
arg: 'to',
type: 'date',
@ -84,7 +84,6 @@ module.exports = Self => {
Object.assign(myOptions, options);
const args = ctx.args;
// Apply filter by team
const teamMembersId = [];
if (args.myTeam != null) {
@ -101,9 +100,12 @@ module.exports = Self => {
teamMembersId.push(userId);
}
if (args && args.myTeam)
if (args?.myTeam)
args.teamIds = teamIds;
if (args?.to)
args.to.setHours(23, 59, 0, 0);
const where = buildFilter(args, (param, value) => {
switch (param) {
case 'search':
@ -151,7 +153,12 @@ module.exports = Self => {
CREATE OR REPLACE TEMPORARY TABLE tmp.filter
(INDEX (id))
ENGINE = MEMORY
SELECT o.id,
WITH wOrderTicket AS(
SELECT orderFk,
ticketFk
FROM orderTicket
GROUP BY orderFk
)SELECT o.id,
o.total,
o.date_send landed,
o.date_make created,
@ -199,7 +206,6 @@ module.exports = Self => {
`);
stmt.merge(conn.makeWhere(filter.where));
stmt.merge(`GROUP BY id`);
stmt.merge(conn.makePagination(filter));
stmts.push(stmt);
stmts.push(`SET SESSION optimizer_search_depth = @_optimizer_search_depth`);
@ -212,7 +218,6 @@ module.exports = Self => {
const sql = ParameterizedSQL.join(stmts, ';');
const result = await conn.executeStmt(sql, myOptions);
return result[ordersIndex];
};
};