diff options
author | 2021-03-19 21:45:20 +0000 | |
---|---|---|
committer | 2021-03-19 21:45:20 +0000 | |
commit | b4c891606dd754376aa94ccb51f10705cc6fea0e (patch) | |
tree | 2ef0749e6943a29be1d7c5e9b0986666331f9ff6 | |
parent | Merge pull request #1459 from python-discord/mbaruh/autoreview (diff) | |
parent | Fix review formatting when there's only one infraction type (diff) |
Merge pull request #1475 from python-discord/mbaruh/review_fix
Fix review formatting when there's only one infraction type
-rw-r--r-- | bot/exts/recruitment/talentpool/_review.py | 13 |
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)}" |