refactor: refs #7457 Added from param if not exists #2502
|
@ -22,7 +22,7 @@ module.exports = Self => {
|
|||
}, {
|
||||
arg: 'from',
|
||||
type: 'date',
|
||||
description: 'The from date'
|
||||
description: 'The from date',
|
||||
pablone marked this conversation as resolved
|
||||
}, {
|
||||
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];
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
se quedà que se deu de poder consultar tots els tickets d'un client. Que havent un limit no deuria anar lento. La solució no es obligar a pasar parametros.