From 5a270945e9404f31af4e5656aae4b28dbab25a91 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Fri, 11 Feb 2022 09:58:27 +0100 Subject: [PATCH] =?UTF-8?q?Affichage=20fct=20bonus=20si=20pas=20configur?= =?UTF-8?q?=C3=A9e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/scodoc.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/views/scodoc.py b/app/views/scodoc.py index e60fd63e..4867ecd6 100644 --- a/app/views/scodoc.py +++ b/app/views/scodoc.py @@ -264,11 +264,15 @@ def get_bonus_description(bonus_name: str): bonus_name = "" bonus_class = ScoDocSiteConfig.get_bonus_sport_class_from_name(bonus_name) text = bonus_class.__doc__ - fields = re.split(r"\n\n", text, maxsplit=1) - if len(fields) > 1: - first_line, text = fields + if text: + fields = re.split(r"\n\n", text, maxsplit=1) + if len(fields) > 1: + first_line, text = fields + else: + first_line, text = "", fields[0] else: - first_line, text = "", fields[0] + text = "" + first_line = "pas de fonction bonus configurée." return f"""
{first_line}
{text}