Skip to content

Commit

Permalink
PLAT-2272 #time 5m
Browse files Browse the repository at this point in the history
  • Loading branch information
blItzkrIg1o1 committed Dec 17, 2014
1 parent cae91ed commit c5f22b4
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ protected function printHeaders($fp) {
$values[] = "City";
$values[] = "latitude";
$values[] = "longitude";
$values[] = "Plays";
$values[] = "Audience";
$values[] = "Average bitrate";
$values[] = "Buffer time";
$values[] = "Seconds viewed";
Expand All @@ -99,16 +99,16 @@ protected function printRows($fp, &$objects, $lastTimeGroup) {
$values[] = $firstRecord->city->latitude;
$values[] = $firstRecord->city->longitude;

$plays = $avgBitrate = $bufferTime = $secondsViewed = 0;
$audience = $avgBitrate = $bufferTime = $secondsViewed = 0;
foreach ($records as $record) {
$plays += $record->plays;
$audience += $record->audience;
$avgBitrate += $record->avgBitrate;
$bufferTime += $record->bufferTime;
$secondsViewed += $record->secondsViewed;
}

$nObj = count($records);
$values[] = round($plays / $nObj, 2);
$values[] = round($audience / $nObj, 2);
$values[] = round($avgBitrate / $nObj, 2);
$values[] = round($bufferTime / $nObj, 2);
$values[] = round($secondsViewed / $nObj, 2);
Expand Down

0 comments on commit c5f22b4

Please sign in to comment.