public function markMoversAndShakers(DataTable $insight, $currentReport, $lastReport, $totalValue, $lastTotalValue)
    {
        if (!$insight->getRowsCount()) {
            return;
        }

        $limitIncreaser = max($insight->getRowsCount(), 3);
        $limitDecreaser = max($insight->getRowsCount(), 3);

        $lastDate = $insight->getMetadata('lastDate');
        $date     = $insight->getMetadata('date');
        $period   = $insight->getMetadata('period');
        $metric   = $insight->getMetadata('metric');
        $orderBy  = $insight->getMetadata('orderBy');
        $reportMetadata = $insight->getMetadata('report');

        $shakers = $this->generateMoverAndShaker($reportMetadata, $period, $date, $lastDate, $metric, $currentReport, $lastReport, $totalValue, $lastTotalValue, $orderBy, $limitIncreaser, $limitDecreaser);

        foreach ($insight->getRows() as $row) {
            $label = $row->getColumn('label');

            if ($shakers->getRowFromLabel($label)) {
                $row->setColumn('isMoverAndShaker', true);
            } else {
                $row->setColumn('isMoverAndShaker', false);
            }
        }

        $this->addMoversAndShakersMetadata($insight, $totalValue, $lastTotalValue);
    }
public function markMoversAndShakers(DataTable $insight, $currentReport, $lastReport, $totalValue, $lastTotalValue)
    {
        if (!$insight->getRowsCount()) {
            return;
        }

        $limitIncreaser = max($insight->getRowsCount(), 3);
        $limitDecreaser = max($insight->getRowsCount(), 3);

        $lastDate = $insight->getMetadata('lastDate');
        $date     = $insight->getMetadata('date');
        $period   = $insight->getMetadata('period');
        $metric   = $insight->getMetadata('metric');
        $orderBy  = $insight->getMetadata('orderBy');
        $reportMetadata = $insight->getMetadata('report');

        $shakers = $this->generateMoverAndShaker($reportMetadata, $period, $date, $lastDate, $metric, $currentReport, $lastReport, $totalValue, $lastTotalValue, $orderBy, $limitIncreaser, $limitDecreaser);

        foreach ($insight->getRows() as $row) {
            $label = $row->getColumn('label');

            if ($shakers->getRowFromLabel($label)) {
                $row->setColumn('isMoverAndShaker', true);
            } else {
                $row->setColumn('isMoverAndShaker', false);
            }
        }

        $this->addMoversAndShakersMetadata($insight, $totalValue, $lastTotalValue);
    }
public function markMoversAndShakers ( DataTable $ insight , $ currentReport , $ lastReport , $ totalValue , $ lastTotalValue ) { if ( ! $ insight -> getRowsCount ( ) ) { return ; } $ limitIncreaser = max ( $ insight -> getRowsCount ( ) , 3 ) ; $ limitDecreaser = max ( $ insight -> getRowsCount ( ) , 3 ) ; $ lastDate = $ insight -> getMetadata ( 'lastDate' ) ; $ date = $ insight -> getMetadata ( 'date' ) ; $ period = $ insight -> getMetadata ( 'period' ) ; $ metric = $ insight -> getMetadata ( 'metric' ) ; $ orderBy = $ insight -> getMetadata ( 'orderBy' ) ; $ reportMetadata = $ insight -> getMetadata ( 'report' ) ; $ shakers = $ this -> generateMoverAndShaker ( $ reportMetadata , $ period , $ date , $ lastDate , $ metric , $ currentReport , $ lastReport , $ totalValue , $ lastTotalValue , $ orderBy , $ limitIncreaser , $ limitDecreaser ) ; foreach ( $ insight -> getRows ( ) as $ row ) { $ label = $ row -> getColumn ( 'label' ) ; if ( $ shakers -> getRowFromLabel ( $ label ) ) { $ row -> setColumn ( 'isMoverAndShaker' , true ) ; } else { $ row -> setColumn ( 'isMoverAndShaker' , false ) ; } } $ this -> addMoversAndShakersMetadata ( $ insight , $ totalValue , $ lastTotalValue ) ; }
Extends an already generated insight report by adding a column "isMoverAndShaker" whether a row is also a
"Mover and Shaker" or not.

Avoids the need to fetch all reports again when we already have the currentReport/lastReport
Extends an already generated insight report by adding a column isMoverAndShaker whether a row is also a Mover and Shaker or not .