aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Boris Muratov <[email protected]>2021-03-19 23:35:10 +0200
committerGravatar Boris Muratov <[email protected]>2021-03-19 23:35:10 +0200
commite69e918a4309c04c3786da9c0d81e81540ffe411 (patch)
tree2ef0749e6943a29be1d7c5e9b0986666331f9ff6
parentMerge pull request #1459 from python-discord/mbaruh/autoreview (diff)
Fix review formatting when there's only one infraction type
-rw-r--r--bot/exts/recruitment/talentpool/_review.py13
1 files 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)}"