diff --git a/src/Entity/Place.php b/src/Entity/Place.php index 1f77238..bbf1e54 100644 --- a/src/Entity/Place.php +++ b/src/Entity/Place.php @@ -312,7 +312,7 @@ class Place $noteContent .= "FIXME: " . $tags['fixme']; $hasNote = true; } - $this->setNoteContent($noteContent ?: null); + $this->setNoteContent($noteContent ? $noteContent : null); $this->setHasNote($hasNote); } diff --git a/src/Service/Motocultrice.php b/src/Service/Motocultrice.php index a07f217..b6bcbed 100644 --- a/src/Service/Motocultrice.php +++ b/src/Service/Motocultrice.php @@ -11,7 +11,7 @@ class Motocultrice public $overpass_base_places = ' ( - nw["amenity"~"^(cafe|bar|restaurant|library|cinema|fast_food|post_office|marketplace|community_centre|theatre|bank|townhall|animal_boarding|animal_breeding|animal_shelter|animal_training|archive|arts_centre|bank|bar|bicycle_rental|biergarten|boat_rental|boat_storage|bureau_de_change|cafe|canteen|car_rental|car_wash|casino|childcare|clinic|college|conference_centre|courthouse|coworking_space|crematorium|dancing_school|dentist|dive_centre|doctors)$"](area.searchArea); + nw["amenity"~"^(cafe|bar|restaurant|library|cinema|fast_food|post_office|marketplace|community_centre|theatre|bank|townhall|animal_boarding|animal_breeding|animal_shelter|animal_training|archive|arts_centre|bicycle_rental|biergarten|boat_rental|boat_storage|bureau_de_change|canteen|car_rental|car_wash|casino|childcare|clinic|college|conference_centre|courthouse|coworking_space|crematorium|dancing_school|dentist|dive_centre|doctors)$"](area.searchArea); nw["shop"](area.searchArea); nw["tourism"~"^(hotel|hostel|motel|wilderness_hut|yes|chalet|gallery|guest_house|museum|zoo|theme_park|aquarium|alpine_hut|apartment)$"](area.searchArea); nw["healthcare"](area.searchArea); @@ -85,23 +85,25 @@ public function find_siret($tags) { public function export($zone) { $query = $this->get_export_query($zone); try { - $response = $this->client->request('GET', 'https://overpass-api.de/api/interpreter', [ - 'query' => [ - 'data' => $query - ] + $response = $this->client->request('POST', 'https://overpass-api.de/api/interpreter', [ + 'body' => ['data' => $query], + 'timeout' => 120 // Augmenter le timeout pour les exports CSV ]); + if ($response->getStatusCode() !== 200) { + throw new \Exception('L\'API Overpass a retourné un code de statut non-200 : ' . $response->getStatusCode()); + } + return $response->getContent(); } catch (\Exception $e) { return "Erreur lors de la requête Overpass : " . $e->getMessage(); } - } public function get_export_query($zone) { return <<.searchArea; +[out:csv(::id,::type,::lat,::lon,::timestamp,::version,::user,::uid,::changeset,name,amenity,shop,office,healthcare,"contact:email",email,"contact:phone",phone,"contact:website",website,image,url,wikidata,opening_hours,"contact:housenumber","addr:housenumber","contact:street","addr:street",note,fixme,harassment_prevention,cuisine,brand,tourism,source,zip_code,"ref:FR:SIRET")]; +area["ref:INSEE"="{$zone}"]->.searchArea; {$this->overpass_base_places} out meta; QUERY; diff --git a/templates/admin/stats.html.twig b/templates/admin/stats.html.twig index 4125a06..07e569d 100644 --- a/templates/admin/stats.html.twig +++ b/templates/admin/stats.html.twig @@ -208,33 +208,7 @@ -
-
-
-
- - - - -
-
-
-
-
- - - -
-
-
-
-
+
{% include 'admin/stats/table-head.html.twig' %}