Skip to content

Commit

Permalink
Add multiracial category
Browse files Browse the repository at this point in the history
  • Loading branch information
eberhardtm committed Sep 13, 2018
1 parent a9de517 commit 5d0cb40
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
16 changes: 13 additions & 3 deletions class/reports/ReportVisitsByRace.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,21 @@ public function execute() {
ASIAN => array("client" => 0, "visit" => 0),
BLACK => array("client" => 0, "visit" => 0),
PACIFIC_ISLANDER => array("client" => 0, "visit" => 0),
WHITE => array("client" => 0, "visit" => 0));
WHITE => array("client" => 0, "visit" => 0),
MULTI_RACIAL => array("client" => 0, "visit" => 0));
$clients = array();

foreach ($results as $key => $value) {
$race = explode(',', $value['race']);

foreach ($race as $r) {
if (count($race) > 1) {
$race_counts[MULTI_RACIAL]['visit'] ++;
if (!in_array($value['client_id'], $clients)) {
$race_counts[MULTI_RACIAL]['client'] ++;
$clients[] = $value['client_id'];
}
} else {
$r = array_pop($race);
if (!empty($r)) {
$race_counts[$r]['visit'] ++;
if (!in_array($value['client_id'], $clients)) {
Expand Down Expand Up @@ -90,9 +98,11 @@ public function decodeRace($key) {
case 500:
$race = "White";
break;
case 600:
$race = "Multiracial";
break;
default:
$race = "Unknown";

}
return $race;
}
Expand Down
1 change: 1 addition & 0 deletions inc/defines.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
define('BLACK', 300);
define('PACIFIC_ISLANDER', 400);
define('WHITE', 500);
define('MULTI_RACIAL', 600);

function getYearList(){
return array(STUDENT_FRESHMAN => 'Freshman',
Expand Down

0 comments on commit 5d0cb40

Please sign in to comment.