chg: [statistics shell] yearly growth now takes a local only flag as parameter

pull/6498/head
iglocska 2020-10-25 09:11:45 +01:00
parent ecda5c3f7b
commit 3c8b9c0fe4
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
1 changed files with 12 additions and 0 deletions

View File

@ -214,6 +214,18 @@ class StatisticsShell extends AppShell {
],
'fields' => ['Log.model_id', 'Log.created']
]);
$localOnly = empty($this->args[0]) ? false : true;
if ($localOnly) {
$orgs = $this->Organisation->find('list', [
'recursive' => -1,
'fields' => ['Organisation.id', 'Organisation.local']
]);
foreach ($orgs as $org_id => $local) {
if (!$local && isset($orgCreations[$org_id])) {
unset($orgCreations[$org_id]);
}
}
}
$years = [];
foreach ($orgCreations as $orgCreation) {
$year = substr($orgCreation, 0, 4);