fix(monitor_client): clientsFilter refactor
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
d99d2f1e50
commit
b5a73ec3a2
|
@ -43,11 +43,8 @@ module.exports = Self => {
|
|||
TIME(v.stamp) AS hour,
|
||||
DATE(v.stamp) AS dated,
|
||||
wtc.workerFk
|
||||
FROM hedera.userSession s
|
||||
JOIN hedera.visitUser v ON v.id = s.userVisitFk
|
||||
FROM hedera.visitUser v
|
||||
JOIN client c ON c.id = v.userFk
|
||||
LEFT JOIN account.user u ON c.salesPersonFk = u.id
|
||||
LEFT JOIN worker w ON c.salesPersonFk = w.id
|
||||
LEFT JOIN sharingCart sc ON sc.workerFk = c.salesPersonFk
|
||||
AND CURDATE() BETWEEN sc.started AND sc.ended
|
||||
LEFT JOIN workerTeamCollegues wtc
|
||||
|
@ -58,7 +55,9 @@ module.exports = Self => {
|
|||
const where = filter.where;
|
||||
where['wtc.workerFk'] = userId;
|
||||
|
||||
stmt.merge(conn.makeSuffix(filter));
|
||||
stmt.merge(conn.makeWhere(filter.where));
|
||||
stmt.merge(`GROUP BY clientFk, v.stamp`);
|
||||
stmt.merge(conn.makePagination(filter));
|
||||
|
||||
return conn.executeStmt(stmt, myOptions);
|
||||
};
|
||||
|
|
|
@ -11,7 +11,7 @@ describe('SalesMonitor clientsFilter()', () => {
|
|||
const filter = {order: 'dated DESC'};
|
||||
const result = await models.SalesMonitor.clientsFilter(ctx, filter, options);
|
||||
|
||||
expect(result.length).toEqual(9);
|
||||
expect(result.length).toEqual(3);
|
||||
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
|
|
Loading…
Reference in New Issue