@stamhoofd/models 2.44.0 → 2.44.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -321,7 +321,7 @@ class BalanceItem extends simple_database_1.Model {
321
321
  balanceItemId
322
322
  ) i ON i.balanceItemId = balance_items.id
323
323
  SET balance_items.pricePending = LEAST(
324
- balance_items.unitPrice * balance_items.amount - balance_items.pricePaid,
324
+ GREATEST(0, balance_items.unitPrice * balance_items.amount - balance_items.pricePaid),
325
325
  coalesce(i.price, 0)
326
326
  )
327
327
  ${secondWhere}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stamhoofd/models",
3
- "version": "2.44.0",
3
+ "version": "2.44.1",
4
4
  "main": "./dist/src/index.js",
5
5
  "types": "./dist/src/index.d.ts",
6
6
  "license": "UNLICENCED",
@@ -29,5 +29,5 @@
29
29
  "publishConfig": {
30
30
  "access": "public"
31
31
  },
32
- "gitHead": "1168aea7895e1aba48cd3123b09fc0b09a2b336f"
32
+ "gitHead": "1f8431a9e5c1766e9012d2f0b1edbff4e36b4f6d"
33
33
  }
@@ -427,7 +427,7 @@ export class BalanceItem extends Model {
427
427
  balanceItemId
428
428
  ) i ON i.balanceItemId = balance_items.id
429
429
  SET balance_items.pricePending = LEAST(
430
- balance_items.unitPrice * balance_items.amount - balance_items.pricePaid,
430
+ GREATEST(0, balance_items.unitPrice * balance_items.amount - balance_items.pricePaid),
431
431
  coalesce(i.price, 0)
432
432
  )
433
433
  ${secondWhere}`;