Skip to content

Commit

Permalink
much better
Browse files Browse the repository at this point in the history
  • Loading branch information
idinium96 committed Jul 31, 2020
1 parent 686f464 commit 5db79c8
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/classes/MyHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1035,13 +1035,14 @@ export = class MyHandler extends Handler {
if (wrongAboutOffer.length !== 0) {
const reasons = wrongAboutOffer.map(wrong => wrong.reason);
const uniqueReasons = reasons.filter(reason => reasons.includes(reason));
const moreThanOnly =
(process.env.DISABLE_GIVE_PRICE_TO_INVALID_ITEMS === 'false' ||
process.env.DISABLE_ACCEPT_OVERSTOCKED_OVERPAY === 'false') &&
exchange.our.value < exchange.their.value;
const moreThanOrEqualTo =
process.env.DISABLE_GIVE_PRICE_TO_INVALID_ITEMS === 'true' &&
exchange.our.value <= exchange.their.value;

const acceptingCondition =
process.env.DISABLE_GIVE_PRICE_TO_INVALID_ITEMS === 'false' ||
process.env.DISABLE_ACCEPT_OVERSTOCKED_OVERPAY === 'false'
? exchange.our.value < exchange.their.value
: process.env.DISABLE_GIVE_PRICE_TO_INVALID_ITEMS === 'true'
? exchange.our.value <= exchange.their.value
: false;

// TO DO: Counter offer?
//
Expand All @@ -1066,7 +1067,7 @@ export = class MyHandler extends Handler {
uniqueReasons.includes('🟫DUPED_ITEMS') ||
uniqueReasons.includes('🟪DUPE_CHECK_FAILED')
) &&
(moreThanOnly || moreThanOrEqualTo) &&
acceptingCondition &&
exchange.our.value !== 0
) {
this.isAcceptedWithInvalidItemsOrOverstocked = true;
Expand Down

0 comments on commit 5db79c8

Please sign in to comment.