From dd229a212fa96b2590c0fe6883b7aedd14c33961 Mon Sep 17 00:00:00 2001 From: Colin Maudry Date: Tue, 23 Sep 2025 12:27:57 +0200 Subject: [PATCH 1/2] =?UTF-8?q?Bloquage=20du=20bouton=20de=20t=C3=A9l?= =?UTF-8?q?=C3=A9chargement=20si=20trop=20de=20lignes=20#38?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 8 ++++++-- src/pages/about.py | 2 +- src/pages/home.py | 31 ++++++++++++++++++++++++++++--- 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 69733e6..5c35fdc 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,11 @@ python run.py ## Notes de version -### 2.0.1 (23 septembre 2025) +#### 2.0.1 (23 septembre 2025) + +- Bloquage du bouton de téléchargement si trop de lignes (+ 65000) [#38](https://github.com/ColinMaudry/decp.info/issues/38) +- Meilleures instructions d'installation et lancement +- Coquilles 🐚 ### 2.0.0 (23 septembre 2025) @@ -39,7 +43,7 @@ python run.py - section "À propos" plus développée - correction de bugs dans les filtres de la data table -### 2.0.0-alpha +#### 2.0.0-alpha - Data table fonctionnelle diff --git a/src/pages/about.py b/src/pages/about.py index 72fe357..bdae8df 100644 --- a/src/pages/about.py +++ b/src/pages/about.py @@ -19,7 +19,7 @@ layout = [ children=[ html.H2(title), dcc.Markdown( - """Outil d'exploration libre et gratuit des [Données Essentielles de la Commande Publique](), développé par Colin Maudry. + """Outil d'exploration libre et gratuit des données de marchés publics, développé par Colin Maudry. Ce projet vise à démocratiser l'accès aux données des marchés publics et à un outil performant et gratuit. Si vous le trouvez utile j'aimerais beaucoup échanger avec vous pour comprendre vos cas d'usages et vos besoins. Cet outil ne peut rester performant que si je comprends les problèmes qu'il peut aider à résoudre. Ce projet ne peut rester gratuit que grâce au financement du développement de nouvelles fonctionnalités. diff --git a/src/pages/home.py b/src/pages/home.py index d7c3e44..a33fae3 100644 --- a/src/pages/home.py +++ b/src/pages/home.py @@ -141,7 +141,11 @@ layout = [ html.Div( [ html.P("lignes", id="nb_rows"), - html.Button("Télécharger au format Excel", id="btn-download-data"), + html.Button( + "Téléchargement désactivé au-delà de 65 000 lignes", + id="btn-download-data", + disabled=True, + ), dcc.Download(id="download-data"), html.P("Données mises à jour le " + str(update_date)), ], @@ -157,6 +161,9 @@ layout = [ Output("table", "data"), Output("table", "data_timestamp"), Output("nb_rows", "children"), + Output("btn-download-data", "disabled"), + Output("btn-download-data", "children"), + Output("btn-download-data", "title"), Input("table", "page_current"), Input("table", "page_size"), Input("table", "filter_query"), @@ -215,7 +222,9 @@ def update_table(page_current, page_size, filter_query, sort_by, data_timestamp) df_filtered = dff.clone() - nb_rows = f"{format_number(dff.height)} lignes" + height = dff.height + + nb_rows = f"{format_number(height)} lignes" # Pagination des données start_row = page_current * page_size @@ -223,7 +232,23 @@ def update_table(page_current, page_size, filter_query, sort_by, data_timestamp) dff = dff.slice(start_row, page_size) dicts = dff.to_dicts() - return dicts, data_timestamp + 1, nb_rows + if height > 65000: + download_disabled = True + download_text = "Téléchargement désactivé au-delà de 65 000 lignes" + download_title = "Excel ne supporte pas d'avoir plus de 65 000 URLs dans une même feuille de calcul. Contactez-moi pour me présenter votre besoin en téléchargement afin que je puisse adapter la solution." + else: + download_disabled = False + download_text = "Télécharger au format Excel" + download_title = "" + + return ( + dicts, + data_timestamp + 1, + nb_rows, + download_disabled, + download_text, + download_title, + ) @callback( From 5c90b5f350820af6b17a113851e0c14b3d834936 Mon Sep 17 00:00:00 2001 From: Colin Maudry Date: Tue, 23 Sep 2025 17:40:05 +0200 Subject: [PATCH 2/2] bump version number --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 021fa6e..5d086ef 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "decp.info" description = "" -version = "2.0.0" +version = "2.0.1" requires-python = ">= 3.10" authors = [ { name = "Colin Maudry", email = "colin+decp@maudry.com" }