Skip to content

Commit

Permalink
fix: transfer null units error
Browse files Browse the repository at this point in the history
  • Loading branch information
danielstefanequilobe committed Sep 2, 2022
1 parent 25dd73e commit f7b41c6
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions src/models/staging/staging.model.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,16 @@ class Staging extends Model {
})),
);

maker.inclusions.push(
...makerUnitInclusions.unit
.filter((inclusion) => inclusion.action !== 'delete')
.map((inclusion) => ({
key: inclusion.key,
value: inclusion.value,
})),
);
if (makerUnitInclusions?.unit) {
maker.inclusions.push(
...makerUnitInclusions.unit
.filter((inclusion) => inclusion.action !== 'delete')
.map((inclusion) => ({
key: inclusion.key,
value: inclusion.value,
})),
);
}

taker.inclusions.push(
...takerProjectInclusions.project
Expand All @@ -194,14 +196,16 @@ class Staging extends Model {
})),
);

taker.inclusions.push(
...takerUnitInclusions.unit
.filter((inclusion) => inclusion.action !== 'delete')
.map((inclusion) => ({
key: inclusion.key,
value: inclusion.value,
})),
);
if (takerUnitInclusions?.unit) {
taker.inclusions.push(
...takerUnitInclusions.unit
.filter((inclusion) => inclusion.action !== 'delete')
.map((inclusion) => ({
key: inclusion.key,
value: inclusion.value,
})),
);
}

const offerInfo = generateOffer(maker, taker);
const offer = makeOffer(offerInfo);
Expand Down

0 comments on commit f7b41c6

Please sign in to comment.