Refactor ShippingFrequencyCalculationService: Adjust container calculation logic to ensure minAnnualFrequency is respected when fillContainer is true.
This commit is contained in:
parent
9b13261a20
commit
8d85e4c692
1 changed files with 4 additions and 4 deletions
|
|
@ -17,10 +17,10 @@ public class ShippingFrequencyCalculationService {
|
||||||
int minAnnualFrequency = Integer.parseInt(propertyRepository.getPropertyByMappingId(SystemPropertyMappingId.FREQ_MIN, setId).orElseThrow().getCurrentValue());
|
int minAnnualFrequency = Integer.parseInt(propertyRepository.getPropertyByMappingId(SystemPropertyMappingId.FREQ_MIN, setId).orElseThrow().getCurrentValue());
|
||||||
int maxAnnualFrequency = Integer.parseInt(propertyRepository.getPropertyByMappingId(SystemPropertyMappingId.FREQ_MAX, setId).orElseThrow().getCurrentValue());
|
int maxAnnualFrequency = Integer.parseInt(propertyRepository.getPropertyByMappingId(SystemPropertyMappingId.FREQ_MAX, setId).orElseThrow().getCurrentValue());
|
||||||
|
|
||||||
var fullContainers = huAnnualAmount / maxHuPerContainer;
|
if (fillContainer) {
|
||||||
|
var fullContainers = huAnnualAmount / maxHuPerContainer;
|
||||||
if(fillContainer && huAnnualAmount > (double) maxAnnualFrequency)
|
return fullContainers > minAnnualFrequency ? fullContainers : minAnnualFrequency;
|
||||||
return fullContainers;
|
}
|
||||||
|
|
||||||
if (huAnnualAmount > (double) maxAnnualFrequency)
|
if (huAnnualAmount > (double) maxAnnualFrequency)
|
||||||
return maxAnnualFrequency;
|
return maxAnnualFrequency;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue