diff --git a/src/com/jdbernard/teammaker/WeightedChooser.groovy b/src/com/jdbernard/teammaker/WeightedChooser.groovy index 5b80149..eafd5b4 100644 --- a/src/com/jdbernard/teammaker/WeightedChooser.groovy +++ b/src/com/jdbernard/teammaker/WeightedChooser.groovy @@ -45,6 +45,12 @@ public class WeightedChooser extends PlayerChooser { } protected int getThreshold(def players) { - return (players.max { it.gamesSat }).gamesSat - hardLimit + int highest = (players.max { it.gamesSat }).gamesSat + + // everyone has 0 games sat, no threshold + if (highest == 0) return 0; + + // if any players have sat at least one game, exclude those that haven't + return Math.max(highest - hardLimit, 1) } }