fix(medusa): Fix order service linting issues (#5071)
* style(medusa): Fix order service linting issues * Create short-ligers-pull.md
This commit is contained in:
1 parent
dc94f053d3
commit
60360d2fd2
2 files changed
+11
-5
No files matched your search
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@medusajs/medusa": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
style(medusa): Fix order service linting issues
|
||||||
@@ -733,10 +733,10 @@ class OrderService extends TransactionBaseService {
|
|||||||
let giftCardableAmountBalance = giftCardableAmount
|
let giftCardableAmountBalance = giftCardableAmount
|
||||||
const giftCardService = this.giftCardService_.withTransaction(manager)
|
const giftCardService = this.giftCardService_.withTransaction(manager)
|
||||||
|
|
||||||
//Order the gift cards by first ends_at date, then remaining amount. To ensure largest possible amount left, for longest possible time.
|
// Order the gift cards by first ends_at date, then remaining amount. To ensure largest possible amount left, for longest possible time.
|
||||||
const orderedGiftCards = cart.gift_cards.sort((a, b) => {
|
const orderedGiftCards = cart.gift_cards.sort((a, b) => {
|
||||||
let aEnd = a.ends_at ?? new Date(2100, 1, 1)
|
const aEnd = a.ends_at ?? new Date(2100, 1, 1)
|
||||||
let bEnd = b.ends_at ?? new Date(2100, 1, 1)
|
const bEnd = b.ends_at ?? new Date(2100, 1, 1)
|
||||||
return aEnd.getTime() - bEnd.getTime() || a.balance - b.balance
|
return aEnd.getTime() - bEnd.getTime() || a.balance - b.balance
|
||||||
})
|
})
|
||||||
for (const giftCard of orderedGiftCards) {
|
for (const giftCard of orderedGiftCards) {
|
||||||
@@ -762,8 +762,9 @@ class OrderService extends TransactionBaseService {
|
|||||||
giftCardableAmountBalance =
|
giftCardableAmountBalance =
|
||||||
giftCardableAmountBalance - giftCardBalanceUsed
|
giftCardableAmountBalance - giftCardBalanceUsed
|
||||||
|
|
||||||
if (giftCardableAmountBalance == 0)
|
if (giftCardableAmountBalance == 0) {
|
||||||
break;
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const shippingOptionServiceTx =
|
const shippingOptionServiceTx =
|
||||||
|
|||||||
Reference in new issue
Block a user