Skip to content

Commit

Permalink
If you added a new source, you would be missing history and your grap…
Browse files Browse the repository at this point in the history
…h would crash.

That has been resolved now.
  • Loading branch information
Coen Coppens committed Jan 20, 2014
1 parent 8f7ea20 commit a709ed5
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions Model/Ticketsource.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,24 +59,42 @@ public function getTotals(Array $aQueueIds) {
if (!in_array($sRecordDate, $aList['dates'])) {
$aList['dates'][] = $sRecordDate;
}
// End

// Add the # of tickets for the source to the list.
// All history records are kept in an array of their respective source.
$sSourceName = $aHistoryRecord['Ticketsource']['name'];

if (!isset($aList[$sSourceName][$sRecordDate])) {
if (!isset($aList[$sSourceName])) {
$aList[$sSourceName] = array();
}
// End

// Add the # of tickets for the source to the list.
if (!isset($aList[$sSourceName][$sRecordDate])) {
$aList[$sSourceName][$sRecordDate] = 0;

}

$aList[$sSourceName][$sRecordDate] += $aHistoryRecord['Ticketsourcecount']['count'];
// End

}

}

// If we're missing any data (because you've added a new source for example) we fill
// it up with 0's.
if (count($aList[$sSourceName]) < count($aList['dates'])) {

foreach ($aList['dates'] as $sDate) {

if (!isset($aList[$sSourceName][$sDate])) {
$aList[$sSourceName][$sDate] = 0;
}

}

}

ksort($aList[$sSourceName]);

}

}
Expand Down

0 comments on commit a709ed5

Please sign in to comment.