Skip to content

Commit

Permalink
[MODORDERS-1079] Renamed some variables to clarify
Browse files Browse the repository at this point in the history
  • Loading branch information
damien-git committed Apr 4, 2024
1 parent 4f438c5 commit bea6cb1
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@ private void updateLocationWithHoldingInfo(JsonObject holding, Location location
private void updateLocations(CompositePoLine compPOL) {
List<Location> locations = new ArrayList<>();
for (Location location : compPOL.getLocations()) {
boolean physical = location.getQuantityPhysical() != null && location.getQuantityPhysical() > 0;
boolean electronic = location.getQuantityElectronic() != null && location.getQuantityElectronic() > 0;
boolean physicalUpdate = physical && isHoldingUpdateRequiredForPhysical(compPOL);
boolean electronicUpdate = electronic && isHoldingUpdateRequiredForEresource(compPOL);
boolean physicalResource = location.getQuantityPhysical() != null && location.getQuantityPhysical() > 0;
boolean electronicResource = location.getQuantityElectronic() != null && location.getQuantityElectronic() > 0;
boolean physicalHolding = physicalResource && isHoldingUpdateRequiredForPhysical(compPOL);
boolean electronicHolding = electronicResource && isHoldingUpdateRequiredForEresource(compPOL);
Location newLocation = JsonObject.mapFrom(location).mapTo(Location.class);
// Split locations only if one type is getting a holdings update but not the other
if (electronicUpdate && physical && !physicalUpdate) {
// Split locations only if one resource type is getting a holdings update but not the other
if (electronicHolding && physicalResource && !physicalHolding) {
Location newElectronicLocation = JsonObject.mapFrom(location).mapTo(Location.class);
newElectronicLocation.setQuantityPhysical(null);
newElectronicLocation.setLocationId(null);
Expand All @@ -95,7 +95,7 @@ private void updateLocations(CompositePoLine compPOL) {
newLocation.setQuantityElectronic(null);
newLocation.setHoldingId(null);
newLocation.setQuantity(location.getQuantityPhysical());
} else if (physicalUpdate && electronic && !electronicUpdate) {
} else if (physicalHolding && electronicResource && !electronicHolding) {
Location newPhysicalLocation = JsonObject.mapFrom(location).mapTo(Location.class);
newPhysicalLocation.setQuantityElectronic(null);
newPhysicalLocation.setLocationId(null);
Expand All @@ -105,7 +105,7 @@ private void updateLocations(CompositePoLine compPOL) {
newLocation.setHoldingId(null);
newLocation.setQuantity(location.getQuantityElectronic());
} else {
if (physicalUpdate || electronicUpdate) {
if (physicalHolding || electronicHolding) {
newLocation.setLocationId(null);
} else {
newLocation.setHoldingId(null);
Expand Down

0 comments on commit bea6cb1

Please sign in to comment.