Create a function "isOverloaded" using 3 arguments isOverloaded(branchIds, reduction, thresholdDuration). The first one is the only one to be required.
isOverloaded(branchIds) returns true only if at least one of the branches among the list of IDs "linesId" has one overload threshold violated.
isOverloaded(branchIds, reduction) returns true only if at least one of the branches among the list of IDs "linesId" has one overload threshold violated with a reduction (if reduction*threshold is violated).
isOverloaded(branchIds, thresholdDuration) returns true only if at least one of the branches among the list of IDs "linesId" has one overload threshold duration (corresponding to the defined threshold) violated.
isOverloaded(branchIds, reduction, thresholdDuration) returns true only if at least one of the branches among the list of IDs "linesId" has one overload threshold duration (corresponding to the defined threshold) violated with a reduction (if reduction*threshold is violated).
Nota Bene : Mathieu suggested to create a class with all the utility functions.