From 27001faf957775ac461690f65e28e2c37eff001a Mon Sep 17 00:00:00 2001 From: Jeroen De Meerleer Date: Fri, 27 Sep 2019 18:00:28 +0200 Subject: [PATCH 1/2] Fixed a Division by zero warning --- src/Tournament.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Tournament.php b/src/Tournament.php index cf06cb7..f5b53be 100644 --- a/src/Tournament.php +++ b/src/Tournament.php @@ -650,7 +650,11 @@ class Tournament } sort($allratings); $allratings = array_slice($allratings, $cut); - return round(array_sum($allratings) / count($allratings)); + $tiebreak = 0; + if (count($allratings) > 0) { + $tiebreak = round(array_sum($allratings) / count($allratings)); + } + return $tiebreak; } From 4cf5da9d7251a2f0596a0f0627b39e08f944b8e3 Mon Sep 17 00:00:00 2001 From: Jeroen De Meerleer Date: Fri, 27 Sep 2019 18:02:04 +0200 Subject: [PATCH 2/2] Updated changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c458ccc..c6788b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ * BUGFIX: `Tournament::calculateBuchholz()` did not return the correct score when player had unplayed rounds * BUGFIX: `Tournament::calculateMutualResult()` returned NULL if result was invalid * BUGFIX: `Tournament::calculateBaumbach()` treated bye as won +* BUGFIX: `Tournament::calculateAverageRating()` returned NaN if no games were played ## v1.1.2 (Release: 21-jun-2019) * ENHANCEMENT: Added update section to dist/readme.md