Formatage prettier (reformatage automatique)

This commit is contained in:
Colin Maudry
2026-04-16 11:13:08 +02:00
parent 71f21b733f
commit 035e6b7ac3
@@ -14,27 +14,28 @@ Flat query parameters with short, readable keys. Multi-value filters use repeate
## URL Parameter Mapping ## URL Parameter Mapping
| Component ID | URL key | Type | Default (omitted) | | Component ID | URL key | Type | Default (omitted) |
|---|---|---|---| | -------------------------------------------------- | ---------------- | --------------- | ----------------- |
| `dashboard_year` | `annee` | single | `None` | | `dashboard_year` | `annee` | single | `None` |
| `dashboard_acheteur_id` | `acheteur_id` | single | `None` | | `dashboard_acheteur_id` | `acheteur_id` | single | `None` |
| `dashboard_acheteur_categorie` | `acheteur_cat` | single | `None` | | `dashboard_acheteur_categorie` | `acheteur_cat` | single | `None` |
| `dashboard_acheteur_departement_code` | `acheteur_dept` | multi | `[]`/`None` | | `dashboard_acheteur_departement_code` | `acheteur_dept` | multi | `[]`/`None` |
| `dashboard_titulaire_id` | `titulaire_id` | single | `None` | | `dashboard_titulaire_id` | `titulaire_id` | single | `None` |
| `dashboard_titulaire_categorie` | `titulaire_cat` | single | `None` | | `dashboard_titulaire_categorie` | `titulaire_cat` | single | `None` |
| `dashboard_titulaire_departement_code` | `titulaire_dept` | multi | `[]`/`None` | | `dashboard_titulaire_departement_code` | `titulaire_dept` | multi | `[]`/`None` |
| `dashboard_marche_type` | `type` | single | `None` | | `dashboard_marche_type` | `type` | single | `None` |
| `dashboard_marche_objet` | `objet` | single | `None` | | `dashboard_marche_objet` | `objet` | single | `None` |
| `dashboard_marche_code_cpv` | `cpv` | single | `None` | | `dashboard_marche_code_cpv` | `cpv` | single | `None` |
| `dashboard_montant_min` | `montant_min` | single (number) | `None` | | `dashboard_montant_min` | `montant_min` | single (number) | `None` |
| `dashboard_montant_max` | `montant_max` | single (number) | `None` | | `dashboard_montant_max` | `montant_max` | single (number) | `None` |
| `dashboard_marche_techniques` | `techniques` | multi | `[]`/`None` | | `dashboard_marche_techniques` | `techniques` | multi | `[]`/`None` |
| `dashboard_marche_innovant` | `innovant` | single | `"all"` | | `dashboard_marche_innovant` | `innovant` | single | `"all"` |
| `dashboard_marche_sousTraitanceDeclaree` | `sous_traitance` | single | `"all"` | | `dashboard_marche_sousTraitanceDeclaree` | `sous_traitance` | single | `"all"` |
| `dashboard_marche_considerationsSociales` | `social` | multi | `[]`/`None` | | `dashboard_marche_considerationsSociales` | `social` | multi | `[]`/`None` |
| `dashboard_marche_considerationsEnvironnementales` | `env` | multi | `[]`/`None` | | `dashboard_marche_considerationsEnvironnementales` | `env` | multi | `[]`/`None` |
Example URL: Example URL:
``` ```
/observatoire?annee=2024&acheteur_id=12345678901234&acheteur_dept=75&acheteur_dept=13&montant_min=10000&innovant=oui /observatoire?annee=2024&acheteur_id=12345678901234&acheteur_dept=75&acheteur_dept=13&montant_min=10000&innovant=oui
``` ```
@@ -79,6 +80,7 @@ FILTER_PARAMS = [
**Current:** Extracts only `acheteur_id` and `titulaire_id` from URL. **Current:** Extracts only `acheteur_id` and `titulaire_id` from URL.
**New:** **New:**
- Iterates over `FILTER_PARAMS` to extract all values from `parse_qs` - Iterates over `FILTER_PARAMS` to extract all values from `parse_qs`
- For multi-value params: reads the full list from `parse_qs` (returns lists natively) - For multi-value params: reads the full list from `parse_qs` (returns lists natively)
- For number params (`montant_min`, `montant_max`): casts to `float` - For number params (`montant_min`, `montant_max`): casts to `float`
@@ -102,12 +104,14 @@ Links generated by `add_links()` in `src/utils.py` (used on search results to li
### Fix broken test `test_010_observatoire_montant_filter` ### Fix broken test `test_010_observatoire_montant_filter`
This test imports `_apply_filters` from `pages.observatoire`, which no longer exists (replaced by `prepare_dashboard_data` in `src/utils.py`). Fix: This test imports `_apply_filters` from `pages.observatoire`, which no longer exists (replaced by `prepare_dashboard_data` in `src/utils.py`). Fix:
- Replace import with `from src.utils import prepare_dashboard_data` - Replace import with `from src.utils import prepare_dashboard_data`
- Update the call to match `prepare_dashboard_data`'s signature: rename `marche_type` keyword to `type`, and add missing params `objet`, `code_cpv`, `techniques`, `marche_innovant`, `sous_traitance_declaree` (all as `None`) - Update the call to match `prepare_dashboard_data`'s signature: rename `marche_type` keyword to `type`, and add missing params `objet`, `code_cpv`, `techniques`, `marche_innovant`, `sous_traitance_declaree` (all as `None`)
### New test: multi-param URL round-trip ### New test: multi-param URL round-trip
Add a test that navigates to `/observatoire?annee=2024&acheteur_id=<test_id>&montant_min=10000` and verifies that: Add a test that navigates to `/observatoire?annee=2024&acheteur_id=<test_id>&montant_min=10000` and verifies that:
- `dashboard_year` dropdown shows "2024" - `dashboard_year` dropdown shows "2024"
- `dashboard_acheteur_id` input contains the test ID - `dashboard_acheteur_id` input contains the test ID
- `dashboard_montant_min` input contains "10000" - `dashboard_montant_min` input contains "10000"