refactor: refs #6276 drop setState function
gitea/salix/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Jorge Penadés 2024-02-28 09:06:48 +01:00
parent cbb7bd0028
commit f95a4f3530
1 changed files with 6 additions and 13 deletions

View File

@ -42,7 +42,12 @@ module.exports = Self => {
const [tickets] = await Self.rawSql('CALL vn.collection_getTickets(?)', [id], myOptions);
await setState(source, id, myOptions);
if (source) {
await Self.rawSql(
'CALL vn.ticketStateToday_setState(?,?)', [id, source], options
);
}
const [sales] = await Self.rawSql('CALL vn.sale_getFromTicketOrCollection(?)',
[id], myOptions);
@ -151,16 +156,4 @@ module.exports = Self => {
AND tr.landed >= DATE_SUB(CURDATE(), INTERVAL 1 YEAR)`;
return Self.rawSql(query, [ticketId], options);
}
async function setState(source, id, options) {
const states = {
'PRECHECKER': 'PREVIOUS_CONTROL',
'CHECKER': 'ON_CHECKING'
};
if (states[source]) {
await Self.rawSql(
'CALL vn.ticketStateToday_setState(?,?)', [id, states[source]], options
);
}
}
};