From e69e918a4309c04c3786da9c0d81e81540ffe411 Mon Sep 17 00:00:00 2001 From: Boris Muratov <8bee278@gmail.com> Date: Fri, 19 Mar 2021 23:35:10 +0200 Subject: Fix review formatting when there's only one infraction type --- bot/exts/recruitment/talentpool/_review.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/bot/exts/recruitment/talentpool/_review.py b/bot/exts/recruitment/talentpool/_review.py index c2c1312d9..57e18af9a 100644 --- a/bot/exts/recruitment/talentpool/_review.py +++ b/bot/exts/recruitment/talentpool/_review.py @@ -180,11 +180,14 @@ class Reviewer: infr_stats = list(Counter(infr["type"] for infr in infraction_list).items()) # Format into a sentence. - infractions = ", ".join( - f"{count} {self._format_infr_name(infr_type, count)}" - for infr_type, count in infr_stats[:-1] - ) - if len(infr_stats) > 1: + if len(infr_stats) == 1: + infr_type, count = infr_stats[0] + infractions = f"{count} {self._format_infr_name(infr_type, count)}" + else: # We already made sure they have infractions. + infractions = ", ".join( + f"{count} {self._format_infr_name(infr_type, count)}" + for infr_type, count in infr_stats[:-1] + ) last_infr, last_count = infr_stats[-1] infractions += f", and {last_count} {self._format_infr_name(last_infr, last_count)}" -- cgit v1.2.3