Skip to content

Commit

Permalink
fix: handle possible null for the contaminantPollenBv recalculate but… (
Browse files Browse the repository at this point in the history
  • Loading branch information
RMCampos authored Oct 11, 2024
1 parent 7743095 commit 064913c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ public record PtValsCalReqDto(
@NotNull List<OrchardParentTreeValsDto> orchardPtVals,
@NotNull List<GeospatialRequestDto> smpMixIdAndProps,
@NotNull Integer smpParentsOutside,
@NotNull BigDecimal contaminantPollenBv) {}
BigDecimal contaminantPollenBv) {}
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,12 @@ public PtCalculationResDto calculatePtVals(PtValsCalReqDto ptVals) {
Integer totalNonOrchardPollen = 0;
Integer numNonOrchardPollen = 0;

SparLog.debug("ptVals.contaminantPollenBv(): {}", ptVals.contaminantPollenBv());
double contaminantPollenBvDouble = 0;
if (ValueUtil.hasValue(ptVals.contaminantPollenBv())) {
contaminantPollenBvDouble = ptVals.contaminantPollenBv().doubleValue();
}

SparLog.debug("contaminantPollenBvDouble: {}", contaminantPollenBvDouble);

// --Third pass to calc values that depend on totals derived above and the remainder
for (OrchardParentTreeValsDto parentTreeRow : ptVals.orchardPtVals()) {
Expand Down Expand Up @@ -257,7 +262,7 @@ public PtCalculationResDto calculatePtVals(PtValsCalReqDto ptVals) {

// --col:AA
double vmContamContrib =
(auxValueAa * ptVals.contaminantPollenBv().doubleValue()) * femaleCropPop.doubleValue();
(auxValueAa * contaminantPollenBvDouble) * femaleCropPop.doubleValue();

// --col:AB (depends on SUM(X)=v_sum_m_gw_contrib_orch_poll)
double auxValueAb =
Expand Down

0 comments on commit 064913c

Please sign in to comment.