mirror of
https://forge.chapril.org/tykayn/osm-commerces
synced 2025-06-20 01:44:42 +02:00
handle missing elements in scripts, simplify stats page
This commit is contained in:
parent
1e30f360a1
commit
344e71d38f
9 changed files with 247 additions and 47 deletions
|
@ -76,7 +76,29 @@ class Place
|
|||
#[ORM\Column(nullable: true)]
|
||||
private ?bool $has_note = null;
|
||||
|
||||
public function update_place_from_overpass_data(array $overpass_data) {
|
||||
public function getCompletionPercentage(): ?int
|
||||
{
|
||||
$completion_percentage = 0;
|
||||
$total_fields = 5;
|
||||
$filled_fields = 0;
|
||||
if ($this->has_opening_hours) {
|
||||
$filled_fields += 1;
|
||||
}
|
||||
if ($this->has_address) {
|
||||
$filled_fields += 1;
|
||||
}
|
||||
if ($this->has_website) {
|
||||
$filled_fields += 1;
|
||||
}
|
||||
if ($this->has_wheelchair) {
|
||||
$filled_fields += 1;
|
||||
}
|
||||
if ($this->has_note) {
|
||||
$filled_fields += 1;
|
||||
}
|
||||
return round($filled_fields / $total_fields * 100);
|
||||
}
|
||||
public function update_place_from_overpass_data(array $overpass_data) {
|
||||
$overpass_data = $overpass_data['tags_converted'] ;
|
||||
|
||||
// Remplir les clés attendues avec des valeurs par défaut si non définies
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue