Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: handle possible null for the contaminantPollenBv recalculate but… #1669

Merged
merged 1 commit into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading