Piwik\Plugins\Insights\Model::getRelevantTotalValue PHP Method

getRelevantTotalValue() public method

If the metric total (2500) is much lower than $totalValue, the metric total will be returned, otherwise the $totalValue
public getRelevantTotalValue ( DataTable $currentReport, $metric, $totalValue )
$currentReport Piwik\DataTable
    public function getRelevantTotalValue(DataTable $currentReport, $metric, $totalValue)
    {
        $totalMetric = $this->getMetricTotalValue($currentReport, $metric);
        if ($totalMetric > $totalValue) {
            return $totalMetric;
        }
        if ($totalMetric * 2 < $totalValue) {
            return $totalMetric;
        }
        return $totalValue;
    }

Usage Example

Example #1
0
 public function test_getRelevantTotalValue_shouldReturnMetricTotal_IfMetricTotalIsTooLow()
 {
     $table = $this->getTableWithTotal(24);
     $total = $this->model->getRelevantTotalValue($table, 'nb_visits', 50);
     $this->assertEquals(24, $total);
     $table = $this->getTableWithTotal(0);
     $total = $this->model->getRelevantTotalValue($table, 'nb_visits', 50);
     $this->assertEquals(0, $total);
 }
All Usage Examples Of Piwik\Plugins\Insights\Model::getRelevantTotalValue