Updated tests
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
f8f9ece4a5
commit
bacc0101db
|
@ -52,8 +52,6 @@ module.exports = Self => {
|
|||
}
|
||||
|
||||
try {
|
||||
// const stmts = [];
|
||||
|
||||
const entry = await models.Entry.findById(id, {
|
||||
include: [{
|
||||
relation: 'travel',
|
||||
|
@ -87,12 +85,16 @@ module.exports = Self => {
|
|||
const buys = [];
|
||||
for (let buy of args.buys) {
|
||||
if (!buy.itemFk)
|
||||
throw new Error('The itemFk is required');
|
||||
throw new Error('The item is required');
|
||||
|
||||
const lastItemBuy = lastItemBuys.get(buy.itemFk);
|
||||
const lastBuy = await models.Buy.findById(lastItemBuy.buyFk, null, myOptions);
|
||||
let lastBuy;
|
||||
if (lastItemBuy)
|
||||
lastBuy = await models.Buy.findById(lastItemBuy.buyFk, null, myOptions);
|
||||
|
||||
const stickers = 1;
|
||||
const groupingMode = lastBuy && lastBuy.groupingMode ? lastBuy.groupingMode : 1;
|
||||
const weight = lastBuy && lastBuy.weight ? lastBuy.weight : 1;
|
||||
const quantity = (stickers * buy.packing);
|
||||
buys.push({
|
||||
entryFk: entry.id,
|
||||
|
@ -103,8 +105,8 @@ module.exports = Self => {
|
|||
grouping: buy.grouping,
|
||||
buyingValue: buy.buyingValue,
|
||||
packageFk: buy.packageFk,
|
||||
groupingMode: lastBuy.groupingMode,
|
||||
weight: lastBuy.weight
|
||||
groupingMode: groupingMode,
|
||||
weight: weight
|
||||
});
|
||||
|
||||
await models.ItemMatchProperties.upsert({
|
||||
|
|
Loading…
Reference in New Issue