From 242b233d850cc9583c5ee697c5dd9ef943e8f177 Mon Sep 17 00:00:00 2001
From: Emmanuel Viennet <emmanuel.viennet@gmail.com>
Date: Thu, 19 Sep 2024 20:39:58 +0200
Subject: [PATCH] Fix 2 minor bugs

---
 app/scodoc/sco_debouche.py | 6 ++++--
 app/views/assiduites.py    | 9 ++++++++-
 sco_version.py             | 2 +-
 3 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/app/scodoc/sco_debouche.py b/app/scodoc/sco_debouche.py
index 52e17e16..259e8372 100644
--- a/app/scodoc/sco_debouche.py
+++ b/app/scodoc/sco_debouche.py
@@ -149,13 +149,15 @@ def table_debouche_etudids(etudids, keep_numeric=True):
         if itemsuivis:
             if keep_numeric:  # pour excel:
                 row["debouche"] = "\n".join(
-                    f"""{it.item_date.strftime(scu.DATE_FMT)}: {it.situation or ""}"""
+                    f"""{it.item_date.strftime(scu.DATE_FMT) if it.item_date else ""
+                    } : {it.situation or ""}"""
                     for it in itemsuivis
                 )
             else:
                 row["debouche"] = "<br>".join(
                     [
-                        f"""{it.item_date.strftime(scu.DATE_FMT)} : {it.situation or ""}
+                        f"""{it.item_date.strftime(scu.DATE_FMT) if it.item_date else ""
+                        } : {it.situation or ""}
                         <i>{', '.join( tag.title for tag in it.tags)}</i>
                         """
                         for it in itemsuivis
diff --git a/app/views/assiduites.py b/app/views/assiduites.py
index eb9e5969..46c47663 100644
--- a/app/views/assiduites.py
+++ b/app/views/assiduites.py
@@ -974,7 +974,14 @@ def calendrier_assi_etud():
     mode_demi: bool = scu.to_bool(request.args.get("mode_demi", "t"))
     show_pres: bool = scu.to_bool(request.args.get("show_pres", "f"))
     show_reta: bool = scu.to_bool(request.args.get("show_reta", "f"))
-    annee: int = int(request.args.get("annee", scu.annee_scolaire()))
+    annee_str = request.args.get("annee", "")
+    if not annee_str:
+        annee = scu.annee_scolaire()
+    else:
+        try:
+            annee = int(annee_str)
+        except ValueError as exc:
+            raise ScoValueError("année invalide") from exc
 
     # Récupération des années d'étude de l'étudiant
     annees: list[int] = []
diff --git a/sco_version.py b/sco_version.py
index cf12c24a..9b3ad153 100644
--- a/sco_version.py
+++ b/sco_version.py
@@ -1,7 +1,7 @@
 # -*- mode: python -*-
 # -*- coding: utf-8 -*-
 
-SCOVERSION = "9.7.23"
+SCOVERSION = "9.7.24"
 
 SCONAME = "ScoDoc"
 
-- 
GitLab