Skip to content

Commit

Permalink
Query fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ArktinenKarpalo committed Mar 14, 2024
1 parent a3037a5 commit d3f0076
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/db/boxStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ module.exports.buyIn = async (boxBarcode, boxCount) => {
.transacting(trx)
.leftJoin('PRICE', 'RVBOX.itembarcode', 'PRICE.barcode')
.leftJoin('RVITEM', 'PRICE.itemid', 'RVITEM.itemid')
.where('RVBOX.barcode', boxBarcode)
.where({'RVBOX.barcode': boxBarcode, 'PRICE.endtime': null})
.first(
'RVBOX.itemcount',
'PRICE.priceid',
Expand All @@ -215,9 +215,8 @@ module.exports.buyIn = async (boxBarcode, boxCount) => {

await knex('PRICE')
.transacting(trx)
.select({ priceid, endtime: null })
.update({ count: newCount })
.where('PRICE.barcode', barcode);
.where({'PRICE.barcode': barcode, 'PRICE.endtime': null});

return newCount;
});
Expand Down

0 comments on commit d3f0076

Please sign in to comment.