SPB Git

Repository Public

Commit

stats/report : les 5 modes v2 honorés (la route avait été ramenée à la logique v1 complet/synthese) + filename avec suffixe de mode

Simon-Pierre Boucher committed · Aug 19, 2026 parent 28057fe
1 changed file +6 −3 Browse files
modified jobka/web.py +6 −3
@@ -366,19 +366,22 @@ def stats_report(period: str = "30j",
366 from_: str | None = Query(None, alias="from"), 366 from_: str | None = Query(None, alias="from"),
367 to: str | None = None, 367 to: str | None = None,
368 mode: str = "complet"): 368 mode: str = "complet"):
369− """Rapport PDF estampillé Groupe-KA (complet ou synthèse 2 pages).""" 369+ """Rapport PDF estampillé Groupe-KA — 5 modes : complet | synthese |
370+ tendances | repartitions | donnees (mode inconnu -> complet)."""
370 from . import kapdf, statsdash 371 from . import kapdf, statsdash
371 if period not in ("auj", "7j", "30j", "3m", "6m", "12m", "annee", "tout"): 372 if period not in ("auj", "7j", "30j", "3m", "6m", "12m", "annee", "tout"):
372 period = "30j" 373 period = "30j"
374+ if mode not in kapdf.REPORT_MODES:
375+ mode = "complet"
373 dash = statsdash.compute(period, from_, to) 376 dash = statsdash.compute(period, from_, to)
374 data = kapdf.GroupeKAReport( 377 data = kapdf.GroupeKAReport(
375 site={"wordmark": "Job·Ka", "accent": "#0c8599", 378 site={"wordmark": "Job·Ka", "accent": "#0c8599",
376 "domain": "www.job-ka.com", 379 "domain": "www.job-ka.com",
377 "tagline": "Tous les emplois des employeurs québécois"}, 380 "tagline": "Tous les emplois des employeurs québécois"},
378 dashboard=dash, 381 dashboard=dash,
379− mode="synthese" if mode == "synthese" else "complet", 382+ mode=mode,
380 ).build() 383 ).build()
381− fname = kapdf.filename("job-ka", period) 384+ fname = kapdf.filename("job-ka", period, mode)
382 return Response( 385 return Response(
383 content=data, media_type="application/pdf", 386 content=data, media_type="application/pdf",
384 headers={"Content-Disposition": f'attachment; filename="{fname}"'}) 387 headers={"Content-Disposition": f'attachment; filename="{fname}"'})
385 388
Menu

Theme