Skip to content

Commit

Permalink
Stats wrong way round.
Browse files Browse the repository at this point in the history
  • Loading branch information
edwh committed Oct 23, 2023
1 parent edae6ef commit 72cf09a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
6 changes: 3 additions & 3 deletions app/Party.php
Original file line number Diff line number Diff line change
Expand Up @@ -588,13 +588,13 @@ public function getEventStats($eEmissionRatio = null, $uEmissionratio = null, $i
}

switch ($device->repair_status) {
case 1:
case Device::REPAIR_STATUS_FIXED:
$result['fixed_devices']++;
break;
case 2:
case Device::REPAIR_STATUS_REPAIRABLE:
$result['repairable_devices']++;
break;
case 3:
case Device::REPAIR_STATUS_ENDOFLIFE:
$result['dead_devices']++;
break;
default:
Expand Down
18 changes: 14 additions & 4 deletions resources/views/group/view.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,20 @@
$showCalendar = Auth::check() && (($group && $group->isVolunteer()) || App\Helpers\Fixometer::hasRole(Auth::user(), 'Administrator'));
$device_stats = [
'fixed' => isset($group_device_count_status[0]) ? (int) $group_device_count_status[0]->counter : 0,
'repairable' => isset($group_device_count_status[1]) ? (int) $group_device_count_status[1]->counter : 0,
'dead' => isset($group_device_count_status[2]) ? (int) $group_device_count_status[2]->counter : 0,
];
'fixed' => 0,
'repairable' => 0,
'dead' => 0
];
foreach ($group_device_count_status as $count) {
if ($count->status == \App\Device::REPAIR_STATUS_FIXED) {
$device_stats['fixed'] = $count->counter;
} else if ($count->status == \App\Device::REPAIR_STATUS_REPAIRABLE) {
$device_stats['repairable'] = $count->counter;
} else if ($count->status == \App\Device::REPAIR_STATUS_ENDOFLIFE) {
$device_stats['dead'] = $count->counter;
}
}
$category_clusters = [
1 => 'Computers and Home Office',
Expand Down

0 comments on commit 72cf09a

Please sign in to comment.