Every time the Cow Health Job runs, the commons' average cow health changes depending on whether a cow threshold is passed.
You will need to iterate over each of the commons, and each of the users, and update the cow health accordingly.
The number of cows here is the total number in each commons.
Here is the formula for adjusting cow health:
Define int carryingCapacity = 100, unless the PR that adds carrying capacity to the commons has already been merged. In that case, let carryingCapacity be commons.getCarryingCapacity();
If commons.getTotalCows() <= carryingCapacity, then increase average cow health (expressed as a percentage) by threshold, but do not let it exceed 100%.
Else (i.e. commons.getTotalCow() > carryingCapacity, then reduce average cow health (expressed as a percentage) by min( (cow - carryingCapacity) * threshold , 100 ). That is, whatever the threshold value is, that value is the percentage by which the averageCowHealth goes down, for each cow over the carrying capacity.
Acceptance Criteria
[ ] Every time the cow health job is run, average cow health for each user in the commons goes up or down by the amount specified by the formula.
You will need to iterate over each of the commons, and each of the users, and update the cow health accordingly.
The number of cows here is the total number in each commons.
Here is the formula for adjusting cow health:
Acceptance Criteria