Skip to content
Extraits de code Groupes Projets
Valider 43ed4c23 rédigé par diosmosis's avatar diosmosis
Parcourir les fichiers

Forgot to add files in previous commit and document two more pieces of code.

parent 3435e95c
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -116,7 +116,12 @@ class Piwik ...@@ -116,7 +116,12 @@ class Piwik
} }
/** /**
* TODO * Safely compute a ratio. Returns 0 if divisor is 0 (to avoid division by 0 error).
*
* @param number $dividend
* @param number $divisor
* @param int $precision
* @return number
*/ */
public static function getQuotientSafe($dividend, $divisor, $precision = 0) public static function getQuotientSafe($dividend, $divisor, $precision = 0)
{ {
......
...@@ -10,9 +10,11 @@ namespace Piwik\Plugin; ...@@ -10,9 +10,11 @@ namespace Piwik\Plugin;
use Piwik\DataTable\Row; use Piwik\DataTable\Row;
/** /**
* TODO * Base type for metric metadata classes that describe aggregated metrics. These metrics are
* computed in the backend data store and are aggregated in PHP when Piwik archives period reports.
* *
* TODO: note that this will be filled out in another issue * Note: This class is a placeholder. It will be filled out at a later date. Right now, only
* processed metrics can be defined this way.
*/ */
abstract class AggregatedMetric extends Metric abstract class AggregatedMetric extends Metric
{ {
......
<?php
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
namespace Piwik\Plugins\MultiSites\Metrics;
use Piwik\DataTable\Row;
use Piwik\Plugins\CoreHome\Metrics\EvolutionMetric;
use Piwik\Site;
/**
* TODO
*/
class RevenueEvolution extends EvolutionMetric
{
public function compute(Row $row)
{
$columnName = $this->getWrappedName();
$currentValue = $this->getMetric($row, $columnName);
// if the site this is for doesn't support ecommerce & this is for the revenue_evolution column,
// we don't add the new column
if ($currentValue === false
&& !Site::isEcommerceEnabledFor($row->getColumn('label'))
) {
return false;
}
return parent::compute($row);
}
}
\ No newline at end of file
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter