Minor bubbletree fixes for closed organisations
Former-commit-id: 11e49ed25ceed2240b4f051f2351140b042c5719
--- a/bubbletree.php
+++ b/bubbletree.php
@@ -24,7 +24,7 @@
$color = new Lux_Color();
$portfolios = Array();
-
+$total = 0;
$db = $server->get_db('disclosr-agencies');
try {
$rows = $db->get_view("app", "byDeptStateName", null, true)->rows;
@@ -42,10 +42,15 @@
foreach ($rows as $row) {
$employees = 0;
$portfolioid = 0;
- if ($row->value->employees) $employees = $row->value->employees;
+ if (isset($row->value->employees)) $employees = $row->value->employees;
if (isset($row->value->statistics->employees)) {
$agencyEmployeesArray = object_to_array($row->value->statistics->employees);
+if (isset($agencyEmployeesArray["2010-2011"]["value"])) {
$employees = $agencyEmployeesArray["2010-2011"]["value"];
+} else {
+ // get last year that is recorded? throw error?
+ continue;
+}
}
if (!($employees > 0)) $employees =0;
if (isset($row->value->parentOrg)) $portfolioid = $row->value->parentOrg;