chg: [statistics] Added Attribute count

pull/5404/head
mokaddem 2019-11-16 13:12:37 -05:00
parent 2f3c4778f4
commit a8b5da4be2
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
2 changed files with 4 additions and 1 deletions

View File

@ -1756,10 +1756,11 @@ class UsersController extends AppController
'group' => 'Event.orgc_id',
'conditions' => array('Event.orgc_id' => array_keys($orgs)),
'recursive' => -1,
'fields' => array('Event.orgc_id', 'count(*)')
'fields' => array('Event.orgc_id', 'count(*)', 'sum(Event.attribute_count) as attributeCount')
));
foreach ($events as $event) {
$orgs[$event['Event']['orgc_id']]['eventCount'] = $event[0]['count(*)'];
$orgs[$event['Event']['orgc_id']]['attributeCount'] = $event[0]['attributeCount'];
}
unset($events);
$orgs = Set::combine($orgs, '{n}.name', '{n}');

View File

@ -31,6 +31,7 @@
<th><?php echo __('Name');?></th>
<th><?php echo __('Users');?></th>
<th><?php echo __('Events');?></th>
<th><?php echo __('Attributes');?></th>
<th><?php echo __('Nationality');?></th>
<th><?php echo __('Type');?></th>
<th><?php echo __('Sector');?></th>
@ -47,6 +48,7 @@
<td class="short"><?php echo h($data['name']); ?></td>
<td class="short"><span class="<?php echo isset($data['userCount']) ? 'blue bold' : 'grey'; ?>"><?php echo isset($data['userCount']) ? h($data['userCount']) : '0';?></span></td>
<td class="short"><span class="<?php echo isset($data['eventCount']) ? 'blue bold' : 'grey'; ?>"><?php echo isset($data['eventCount']) ? h($data['eventCount']) : '0';?></span></td>
<td class="short"><span class="<?php echo isset($data['attributeCount']) ? 'blue bold' : 'grey'; ?>"><?php echo isset($data['attributeCount']) ? h($data['attributeCount']) : '0';?></span></td>
<td class="shortish"><?php echo isset($data['nationality']) && $data['nationality'] !== 'Not specified' ? h($data['nationality']) : '&nbsp;'; ?></td>
<td class="shortish"><?php echo isset($data['type']) ? h($data['type']) : '&nbsp;'; ?></td>
<td class="shortish"><?php echo isset($data['sector']) ? h($data['sector']) : '&nbsp;'; ?></td>