]> git.sesse.net Git - ultimatescore/commitdiff
Only show thirds if we have exactly two.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 22 Feb 2020 10:25:17 +0000 (11:25 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 22 Feb 2020 10:25:53 +0000 (11:25 +0100)
update_sheets.js

index a9dcfe53c15942b83faa82a4903a0b1e5a827a8d..00e4388ad1bc43b296666aeced8eb07ea65f847f 100644 (file)
@@ -450,7 +450,11 @@ function publish_best_thirds() {
                                let text = "";
                                if (candidates.length >= 2) {
                                        let ranked = rank_thirds([], candidates, 1, tiebreakers);
-                                       text = "Best thirds: " + ranked[0].mediumname + ", " + ranked[1].mediumname + "\n" + tiebreakers.join("\n");
+                                       let best_thirds = ranked.filter(function(team) { return team.rank <= 2; });
+                                       if (best_thirds.length == 2) {
+                                               text = "Best thirds: " + best_thirds.map(function(team) { return team.mediumname }).join(', ') + "\n";
+                                               text += tiebreakers.join("\n");
+                                       }
                                }
                                let updates = [];
                                updates.push({ "range": ultimateconfig['explain_third_cell'], "values": [ [ text ] ] });