mirror of
https://forge.chapril.org/tykayn/osm-commerces
synced 2025-10-09 17:02:46 +02:00
up décompte de suivi des lieux et arbres
This commit is contained in:
parent
6c457986ad
commit
949dc71fb8
4 changed files with 65 additions and 23 deletions
|
@ -183,20 +183,24 @@ class FollowUpService
|
|||
});
|
||||
} elseif ($type === 'tree') {
|
||||
$completed = array_filter($data['objects'], function($el) {
|
||||
// Complet si le tag "species" ou "ref" est présent
|
||||
return !empty($el['tags']['species'] ?? null) || !empty($el['tags']['ref'] ?? null);
|
||||
$tags = $el['tags'] ?? [];
|
||||
$hasTaxonomy = !empty($tags['species'] ?? null)
|
||||
|| !empty($tags['genus'] ?? null)
|
||||
|| !empty($tags['taxon'] ?? null)
|
||||
|| !empty($tags['taxon:binomial'] ?? null);
|
||||
$hasLeaf = !empty($tags['leaf_type'] ?? null)
|
||||
|| !empty($tags['leaf_cycle'] ?? null)
|
||||
|| !empty($tags['leaf_shape'] ?? null)
|
||||
|| !empty($tags['leaf_color'] ?? null)
|
||||
|| !empty($tags['leaf_fall'] ?? null);
|
||||
return $hasTaxonomy && $hasLeaf;
|
||||
});
|
||||
}
|
||||
if ($type === 'lieux') {
|
||||
// Si le type est "lieux", on utilise la méthode completionPercent() de $stats
|
||||
if (method_exists($stats, 'getCompletionPercent')) {
|
||||
$completion = $stats->getCompletionPercent();
|
||||
} else {
|
||||
$completion = 0;
|
||||
}
|
||||
if ($type === 'places') {
|
||||
$completion = $stats->getCompletionPercent();
|
||||
} else {
|
||||
$completion = count($data['objects']) > 0 ? round(count($completed) / count($data['objects']) * 100) : 0;
|
||||
}
|
||||
|
||||
$completion = count($data['objects']) > 0 ? round(count($completed) / count($data['objects']) * 100) : 0;
|
||||
$followupCompletion = new CityFollowUp();
|
||||
$followupCompletion->setName($type . '_completion')
|
||||
->setMeasure($completion)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue