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 maxAnnualFrequency = Integer.parseInt(propertyRepository.getPropertyByMappingId(SystemPropertyMappingId.FREQ_MAX, setId).orElseThrow().getCurrentValue());
|
||||
|
||||
if (fillContainer) {
|
||||
var fullContainers = huAnnualAmount / maxHuPerContainer;
|
||||
|
||||
if(fillContainer && huAnnualAmount > (double) maxAnnualFrequency)
|
||||
return fullContainers;
|
||||
return fullContainers > minAnnualFrequency ? fullContainers : minAnnualFrequency;
|
||||
}
|
||||
|
||||
if (huAnnualAmount > (double) maxAnnualFrequency)
|
||||
return maxAnnualFrequency;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue