From 556aada80e48f200a10c8dc4673f32e42494b9fe Mon Sep 17 00:00:00 2001 From: Ben Burgess <88810029+bx80@users.noreply.github.com> Date: Tue, 16 Nov 2021 09:08:08 +1300 Subject: [PATCH] Proportional evolution comparison for incomplete periods (#18099) * Multisite evolution metrics changed to calculate proportionally to percent of the current period which is complete * Use piwik date class, use report generated date if available, added unit test, added tooltip * Improved tooltip detail * Updated unit tested, added tests for evolution metric getRatio(), changes to allow row metadata to be preserved during datatable merges * Additional API test fixes * More test fixes * More test fixes * Remove ts_archived row metadata from final API output * Test fix reversions, added deleteRowsMetadata() method to DataTableInterface * More test fix reversions * Fixed integration test * Trigger Build * Update core/DataTable/Map.php Co-authored-by: Stefan Giehl * Update core/DataTable.php Co-authored-by: Stefan Giehl * Update core/Archive/DataCollection.php Co-authored-by: Stefan Giehl * Update core/DataTable.php Co-authored-by: Stefan Giehl * Update core/DataTable.php Co-authored-by: Stefan Giehl * Update plugins/CoreHome/Columns/Metrics/EvolutionMetric.php Co-authored-by: Stefan Giehl * Improved tooltips for translation, use NumberFormatter for percents, moved additional constructor param to end, null checks * Update plugins/CoreHome/Columns/Metrics/EvolutionMetric.php Co-authored-by: Stefan Giehl * Update plugins/CoreHome/Columns/Metrics/EvolutionMetric.php Co-authored-by: Stefan Giehl * Use localized period string, remove unnecessary tooltip percent digits * Formatting fixes * Fix for an issue where evolution values > 999% would be displayed incorrectly * Added data table processor option to provide raw copy of formatted metrics * Update plugins/MultiSites/API.php Fix for row metadata removed too early Co-authored-by: Stefan Giehl * Replace evolution metrics 'add raw copy' api parameter with _trend column * ensure to use correct metric to check if lower value is better * updates expected test files * fix some more tests * update test file Co-authored-by: Stefan Giehl --- core/API/DataTablePostProcessor.php | 6 + core/Archive.php | 4 +- core/Archive/DataCollection.php | 8 +- core/Archive/DataTableFactory.php | 11 +- core/DataTable.php | 25 ++ core/DataTable/DataTableInterface.php | 1 + core/DataTable/Map.php | 13 + .../Columns/Metrics/EvolutionMetric.php | 98 +++++- .../tests/Unit/EvolutionMetricTest.php | 63 ++++ plugins/MultiSites/API.php | 9 +- .../Metrics/EcommerceOnlyEvolutionMetric.php | 5 +- plugins/MultiSites/MultiSites.php | 6 + .../dashboard/dashboard-model.service.js | 58 +++- .../angularjs/site/site.directive.html | 9 +- plugins/MultiSites/lang/en.json | 10 +- .../tests/Integration/ControllerTest.php | 18 ++ .../tests/Integration/DashboardTest.php | 58 +++- tests/PHPUnit/Integration/ArchiveTest.php | 2 + ...woWebsitesDifferentDaysConversionsTest.php | 4 + ...atibility1XTest__MultiSites.getAll_day.xml | 12 + ...st_ImportLogs__MultiSites.getAll_month.xml | 36 +++ ...st_ImportLogs__MultiSites.getOne_month.xml | 4 + ...ancedAndLast7__MultiSites.getAll_month.xml | 294 ++++++++++++++++++ ...isitorTwoVisits__MultiSites.getAll_day.xml | 12 + ...isitorTwoVisits__MultiSites.getOne_day.xml | 4 + ...Site_lastN__API.getProcessedReport_day.xml | 68 +++- ...ays_Conversions__MultiSites.getAll_day.xml | 96 ++++++ ...s_Conversions__MultiSites.getAll_month.xml | 24 ++ ...ys_Conversions__MultiSites.getAll_week.xml | 48 +++ ...ys_Conversions__MultiSites.getAll_year.xml | 24 ++ ...ions_idSiteOne___MultiSites.getAll_day.xml | 96 ++++++ ...ns_idSiteOne___MultiSites.getAll_month.xml | 24 ++ ...ons_idSiteOne___MultiSites.getAll_week.xml | 48 +++ ...ons_idSiteOne___MultiSites.getAll_year.xml | 24 ++ ...it_PeriodIsLast__MultiSites.getOne_day.xml | 28 ++ ...t_PeriodIsLast__MultiSites.getOne_week.xml | 28 ++ .../test_noVisit__MultiSites.getOne_day.xml | 4 + ...e_IndexedByDate__MultiSites.getAll_day.xml | 12 + ...tesNotSupported__MultiSites.getAll_day.xml | 60 ++++ ...nge_Truncated__MultiSites.getAll_range.xml | 12 + ...ays_DateRange__MultiSites.getAll_range.xml | 24 ++ ...ays_DateRange__MultiSites.getOne_range.xml | 4 + ...nge_showColumns__MultiSites.getAll_day.xml | 10 + 43 files changed, 1380 insertions(+), 24 deletions(-) create mode 100644 plugins/CoreHome/tests/Unit/EvolutionMetricTest.php diff --git a/core/API/DataTablePostProcessor.php b/core/API/DataTablePostProcessor.php index 61fba565739..601018b4470 100644 --- a/core/API/DataTablePostProcessor.php +++ b/core/API/DataTablePostProcessor.php @@ -22,6 +22,7 @@ use Piwik\Plugin\Report; use Piwik\Plugin\ReportsProvider; use Piwik\Plugins\API\Filter\DataComparisonFilter; +use Piwik\Plugins\CoreHome\Columns\Metrics\EvolutionMetric; /** * Processes DataTables that should be served through Piwik's APIs. This processing handles @@ -453,6 +454,11 @@ public function computeProcessedMetrics(DataTable $dataTable) $computedValue = $processedMetric->compute($row); if ($computedValue !== false) { $row->addColumn($name, $computedValue); + + // Add a trend column for evolution metrics + if ($processedMetric instanceof EvolutionMetric) { + $row->addColumn($processedMetric->getTrendName(), $processedMetric->getTrendValue($computedValue)); + } } } } diff --git a/core/Archive.php b/core/Archive.php index 6ef1ccb09af..007ca09e53d 100644 --- a/core/Archive.php +++ b/core/Archive.php @@ -342,7 +342,7 @@ public function getDataTableFromNumeric($names) */ public function getDataTableFromNumericAndMergeChildren($names) { - $data = $this->get($names, 'numeric'); + $data = $this->get($names, 'numeric'); $resultIndexes = $this->getResultIndices(); return $data->getMergedDataTable($resultIndexes); } @@ -539,7 +539,7 @@ protected function get($archiveNames, $archiveDataType, $idSubtable = null) $result->addMetadata($row['idsite'], $periodStr, DataTable::ARCHIVED_DATE_METADATA_NAME, $row['ts_archived']); } - $result->set($row['idsite'], $periodStr, $row['name'], $row['value']); + $result->set($row['idsite'], $periodStr, $row['name'], $row['value'], [DataTable::ARCHIVED_DATE_METADATA_NAME => $row['ts_archived']]); } return $result; diff --git a/core/Archive/DataCollection.php b/core/Archive/DataCollection.php index fa045b056c0..8bb93be3ff8 100644 --- a/core/Archive/DataCollection.php +++ b/core/Archive/DataCollection.php @@ -147,11 +147,17 @@ public function &get($idSite, $period) * @param string $period eg, '2012-01-01,2012-01-31' * @param string $name eg 'nb_visits' * @param string $value eg 5 + * @param array $meta Optional metadata to add to the row */ - public function set($idSite, $period, $name, $value) + public function set($idSite, $period, $name, $value, array $meta = null) { $row = & $this->get($idSite, $period); $row[$name] = $value; + if ($meta) { + foreach ($meta as $k => $v) { + $row[self::METADATA_CONTAINER_ROW_KEY][$k] = $v; + } + } } /** diff --git a/core/Archive/DataTableFactory.php b/core/Archive/DataTableFactory.php index 1a373e1e2a8..d2c2479448b 100644 --- a/core/Archive/DataTableFactory.php +++ b/core/Archive/DataTableFactory.php @@ -575,15 +575,22 @@ private function makeMergedWithSiteIndex($index, $useSimpleDataTable, $isNumeric $this->setPrettySegmentMetadata($table); foreach ($index as $idsite => $row) { + + $meta = array(); + if (isset($row[DataCollection::METADATA_CONTAINER_ROW_KEY])) { + $meta = $row[DataCollection::METADATA_CONTAINER_ROW_KEY]; + } + $meta['idsite'] = $idsite; + if (!empty($row)) { $table->addRow(new Row(array( Row::COLUMNS => $row, - Row::METADATA => array('idsite' => $idsite)) + Row::METADATA => $meta) )); } elseif ($isNumeric) { $table->addRow(new Row(array( Row::COLUMNS => $this->defaultRow, - Row::METADATA => array('idsite' => $idsite)) + Row::METADATA => $meta) )); } } diff --git a/core/DataTable.php b/core/DataTable.php index 6da6fadaa8d..8b9291a78e5 100644 --- a/core/DataTable.php +++ b/core/DataTable.php @@ -1001,6 +1001,31 @@ public function getRowsMetadata($name) return $metadataValues; } + /** + * Delete row metadata by name in every row. + * + * @param $name + * @param bool $deleteRecursiveInSubtables + */ + public function deleteRowsMetadata($name, $deleteRecursiveInSubtables = false) + { + foreach ($this->rows as $row) { + $row->deleteMetadata($name); + + $subTable = $row->getSubtable(); + if ($subTable) { + $subTable->deleteRowsMetadata($name, $deleteRecursiveInSubtables); + } + } + if (!is_null($this->summaryRow)) { + $this->summaryRow->deleteMetadata($name); + } + if (!is_null($this->totalsRow)) { + $this->totalsRow->deleteMetadata($name); + } + + } + /** * Returns the number of rows in the table including the summary row. * diff --git a/core/DataTable/DataTableInterface.php b/core/DataTable/DataTableInterface.php index 84440dfa24a..7009be7285f 100644 --- a/core/DataTable/DataTableInterface.php +++ b/core/DataTable/DataTableInterface.php @@ -27,4 +27,5 @@ public function deleteRow($id); public function deleteColumn($name); public function getColumn($name); public function getColumns(); + public function deleteRowsMetadata($name, $deleteRecursiveInSubtables = false); } diff --git a/core/DataTable/Map.php b/core/DataTable/Map.php index 9169a361286..8700d8822df 100644 --- a/core/DataTable/Map.php +++ b/core/DataTable/Map.php @@ -513,6 +513,19 @@ public function getMetadataIntersectArray($name) return array_values($data); } + /** + * Delete row metadata by name in every row. + * + * @param $name + * @param bool $deleteRecursiveInSubtables + */ + public function deleteRowsMetadata($name, $deleteRecursiveInSubtables = false) + { + foreach ($this->getDataTables() as $table) { + $table->deleteRowsMetadata($name, $deleteRecursiveInSubtables); + } + } + /** * See {@link DataTable::getColumns()}. * diff --git a/plugins/CoreHome/Columns/Metrics/EvolutionMetric.php b/plugins/CoreHome/Columns/Metrics/EvolutionMetric.php index ab34138b8dd..d400396a96d 100644 --- a/plugins/CoreHome/Columns/Metrics/EvolutionMetric.php +++ b/plugins/CoreHome/Columns/Metrics/EvolutionMetric.php @@ -9,8 +9,12 @@ namespace Piwik\Plugins\CoreHome\Columns\Metrics; use Piwik\DataTable; +use Piwik\Archive\DataTableFactory; use Piwik\DataTable\Row; +use Piwik\Date; use Piwik\Metrics; +use Piwik\Plugins\SitesManager\API; +use Piwik\Site; use Piwik\Metrics\Formatter; use Piwik\Piwik; use Piwik\Plugin\Metric; @@ -36,6 +40,11 @@ class EvolutionMetric extends ProcessedMetric */ private $evolutionMetricName; + /** + * @var string + */ + private $evolutionMetricTrendName; + /** * @var int */ @@ -46,6 +55,11 @@ class EvolutionMetric extends ProcessedMetric */ private $pastData; + /** + * @var DataTable + */ + private $currentData; + /** * The list of labels leading to the current subtable being processed. Used to get the proper subtable in * $pastData. @@ -62,17 +76,22 @@ class EvolutionMetric extends ProcessedMetric * @param string|false $evolutionMetricName The name of the evolution processed metric. Defaults to * $wrapped's name with `'_evolution'` appended. * @param int $quotientPrecision The percent's quotient precision. + * @param DataTable|null $currentData The current datatable, optional but required to calculate the proportionate + * evolution values */ - public function __construct($wrapped, DataTable $pastData = null, $evolutionMetricName = false, $quotientPrecision = 0) + public function __construct($wrapped, ?DataTable $pastData = null, $evolutionMetricName = false, $quotientPrecision = 0, + ?DataTable $currentData = null) { $this->wrapped = $wrapped; $this->pastData = $pastData; + $this->currentData = $currentData; if (empty($evolutionMetricName)) { $wrappedName = $this->getWrappedName(); $evolutionMetricName = $wrappedName . '_evolution'; } + $this->evolutionMetricTrendName = $evolutionMetricName . '_trend'; $this->evolutionMetricName = $evolutionMetricName; $this->quotientPrecision = $quotientPrecision; } @@ -82,6 +101,11 @@ public function getName() return $this->evolutionMetricName; } + public function getTrendName() + { + return $this->evolutionMetricTrendName; + } + public function getTranslatedName() { if ($this->wrapped instanceof Metric) { @@ -93,6 +117,16 @@ public function getTranslatedName() return Piwik::translate('CoreHome_EvolutionMetricName', [$metricName]); } + public function getTrendValue($computedValue = 0) + { + $isLowerBetter = Metrics::isLowerValueBetter($this->wrapped); + if ($isLowerBetter) { + return ($computedValue < 0 ? 1 : ($computedValue > 0 ? -1 : 0)); + } + + return ($computedValue < 0 ? -1 : ($computedValue > 0 ? 1 : 0)); + } + public function compute(Row $row) { $columnName = $this->getWrappedName(); @@ -101,6 +135,16 @@ public function compute(Row $row) $currentValue = $this->getMetric($row, $columnName); $pastValue = $pastRow ? $this->getMetric($pastRow, $columnName) : 0; + // Reduce past value proportionally to match the percent of the current period which is complete, if applicable + $ratio = self::getRatio($this->currentData, $this->pastData, $row); + $period = $this->pastData->getMetadata(DataTableFactory::TABLE_METADATA_PERIOD_INDEX); + $row->setMetadata('ratio', $ratio); + $row->setMetadata('currencySymbol', $row['label'] !== DataTable::ID_SUMMARY_ROW ? Site::getCurrencySymbolFor($row['label']) : API::getInstance()->getDefaultCurrency()); + $row->setMetadata('previous_'.$columnName, $pastValue); + $row->setMetadata('periodName', $period->getLabel()); + $row->setMetadata('previousRange', $period->getLocalizedShortString()); + $pastValue = ($pastValue * $ratio); + $dividend = $currentValue - $pastValue; $divisor = $pastValue; @@ -170,4 +214,56 @@ private function getPastDataTable() } return $result; } + + /** + * Calculate the ratio of time between a past period and current incomplete period + * + * eg. if today is Thursday at 12:00pm and the past period is a week then the ratio is 0.5, exactly half of the + * current incomplete period has passed + * + * If the current period end is in the past then the ratio will always be 1, since the current period is complete. + * + * @param DataTable|null $currentData + * @param DataTable|null $pastData + * @param Row $row + * @return float|int + * @throws \Exception + */ + public static function getRatio(?DataTable $currentData, ?DataTable $pastData, Row $row) + { + $ratio = 1; + + if ($currentData != null && $pastData != null) { + + $p = $pastData->getMetadata(DataTableFactory::TABLE_METADATA_PERIOD_INDEX); + + $pStart = $p->getDateStart()->setTime('00:00:00'); + $pEnd = $p->getDateEnd()->setTime('23:59:59'); + + $c = $currentData->getMetadata(DataTableFactory::TABLE_METADATA_PERIOD_INDEX); + $cStart = $c->getDateStart()->setTime('00:00:00'); + $cEnd = $c->getDateEnd()->setTime('23:59:59'); + + $nowTS = Date::getNowTimestamp(); + + // If we know the date the the datatable data was generated then use that instead of now + $archivedDateStr = $row->getMetadata(DataTable::ARCHIVED_DATE_METADATA_NAME); + + if ($archivedDateStr) { + $archivedDate = Date::factory($archivedDateStr); + if ($archivedDate) { + $nowTS = Date::factory($archivedDate)->getTimestamp(); + } + } + + if ($cStart->getTimestamp() <= $nowTS && $cEnd->getTimestamp() >= $nowTS) { + $secsInPastPeriod = $pEnd->getTimestamp() - $pStart->getTimestamp(); + $secsInCurrentPeriod = $nowTS - $cStart->getTimestamp(); + $ratio = $secsInCurrentPeriod / $secsInPastPeriod; + } + } + + return round($ratio, 3); + + } } \ No newline at end of file diff --git a/plugins/CoreHome/tests/Unit/EvolutionMetricTest.php b/plugins/CoreHome/tests/Unit/EvolutionMetricTest.php new file mode 100644 index 00000000000..7ecdb2d0461 --- /dev/null +++ b/plugins/CoreHome/tests/Unit/EvolutionMetricTest.php @@ -0,0 +1,63 @@ +setMetadata('period', $cPeriod); + + // If the archived date meta data value exists on the row then it will be used + // as the current date for calculation purposes, we can use this to consistently test the + // ratio calculation by supplying a fixed set of dates that should result in a 0.5 ratio + + $row = new Row(); + $row->setMetadata(DataTable::ARCHIVED_DATE_METADATA_NAME, '2021-10-07 00:00:00'); + + $pastData = new DataTable(); + $sPeriod = new \Piwik\Period\Week(Date::factory('2021-10-03')); + $pastData->setMetadata('period', $sPeriod); + + $ratio = EvolutionMetric::getRatio($currentData, $pastData, $row); + + $this->assertEquals(0.429, $ratio); + } + + public function test_shouldNotDoProportionalComparision_ifCurrentPeriodComplete() + { + $currentData = new DataTable(); + $cPeriod = new \Piwik\Period\Week(Date::factory('2021-10-10')); + $currentData->setMetadata('period', $cPeriod); + + $pastData = new DataTable(); + $sPeriod = new \Piwik\Period\Week(Date::factory('2021-10-03')); + $pastData->setMetadata('period', $sPeriod); + + $ratio = EvolutionMetric::getRatio($currentData, $pastData, new Row()); + + $this->assertEquals(1, $ratio); + } + +} diff --git a/plugins/MultiSites/API.php b/plugins/MultiSites/API.php index a0e20a470c6..097725bd848 100644 --- a/plugins/MultiSites/API.php +++ b/plugins/MultiSites/API.php @@ -313,6 +313,12 @@ function ($value) { ); } + // Remove row metadata, it's already been used by any filters that needed it + $dataTable->queueFilter(function($dataTable) { + $dataTable->deleteRowsMetadata(DataTable::ARCHIVED_DATE_METADATA_NAME); + $dataTable->deleteColumn('_metadata'); + }); + if ($multipleWebsitesRequested && $dataTable->getRowsCount() === 1 && $dataTable instanceof DataTable\Simple) { $simpleTable = $dataTable; $dataTable = $simpleTable->getEmptyClone(); @@ -358,7 +364,8 @@ private function calculateEvolutionPercentages($currentData, $pastData, $apiMetr $metricSettings[self::METRIC_RECORD_NAME_KEY], $pastData, $metricSettings[self::METRIC_EVOLUTION_COL_NAME_KEY], - $quotientPrecision = 1 + $quotientPrecision = 1, + $currentData ); } $currentData->setMetadata(DataTable::EXTRA_PROCESSED_METRICS_METADATA_NAME, $extraProcessedMetrics); diff --git a/plugins/MultiSites/Columns/Metrics/EcommerceOnlyEvolutionMetric.php b/plugins/MultiSites/Columns/Metrics/EcommerceOnlyEvolutionMetric.php index 58718b01014..0a1fa627427 100644 --- a/plugins/MultiSites/Columns/Metrics/EcommerceOnlyEvolutionMetric.php +++ b/plugins/MultiSites/Columns/Metrics/EcommerceOnlyEvolutionMetric.php @@ -22,9 +22,10 @@ class EcommerceOnlyEvolutionMetric extends EvolutionMetric { private $isRevenueEvolution; - public function __construct($wrapped, DataTable $pastData, $evolutionMetricName = false, $quotientPrecision = 0) + public function __construct($wrapped, DataTable $pastData, $evolutionMetricName = false, $quotientPrecision = 0, + ?DataTable $currentData = null) { - parent::__construct($wrapped, $pastData, $evolutionMetricName, $quotientPrecision); + parent::__construct($wrapped, $pastData, $evolutionMetricName, $quotientPrecision, $currentData); $this->isRevenueEvolution = $this->getName() == 'revenue_evolution'; } diff --git a/plugins/MultiSites/MultiSites.php b/plugins/MultiSites/MultiSites.php index f5aa8bb7959..27bf4657635 100644 --- a/plugins/MultiSites/MultiSites.php +++ b/plugins/MultiSites/MultiSites.php @@ -72,6 +72,12 @@ public function getClientSideTranslationKeys(&$translations) $translations[] = 'General_Faq'; $translations[] = 'Feedback_CommunityHelp'; $translations[] = 'Feedback_ProfessionalHelp'; + $translations[] = 'MultiSites_EvolutionComparisonIncomplete'; + $translations[] = 'MultiSites_EvolutionComparisonProportional'; + $translations[] = 'MultiSites_EvolutionComparisonDay'; + $translations[] = 'MultiSites_EvolutionComparisonWeek'; + $translations[] = 'MultiSites_EvolutionComparisonMonth'; + $translations[] = 'MultiSites_EvolutionComparisonYear'; } public function getJsFiles(&$jsFiles) diff --git a/plugins/MultiSites/angularjs/dashboard/dashboard-model.service.js b/plugins/MultiSites/angularjs/dashboard/dashboard-model.service.js index a1f2936e976..32c2f404ca6 100644 --- a/plugins/MultiSites/angularjs/dashboard/dashboard-model.service.js +++ b/plugins/MultiSites/angularjs/dashboard/dashboard-model.service.js @@ -63,9 +63,57 @@ var allSites = report.sites; angular.forEach(allSites, function (site, index) { - site.visits_evolution = parseInt(site.visits_evolution, 10); - site.pageviews_evolution = parseInt(site.pageviews_evolution, 10); - site.revenue_evolution = parseInt(site.revenue_evolution, 10); + + if (site.hasOwnProperty('ratio') && site.ratio != 1) { + var percent = NumberFormatter.formatPercent(Math.round((site.ratio * 100))); + var metricName = null; + var previousTotal = 0; + var currentTotal = 0; + var evolution = 0; + var previousTotalAdjusted = 0; + if (model.sortColumn == 'nb_visits' || model.sortColumn == 'visits_evolution') { + previousTotal = NumberFormatter.formatNumber(site.previous_nb_visits); + currentTotal = NumberFormatter.formatNumber(site.nb_visits); + evolution = NumberFormatter.formatPercent(site.visits_evolution); + metricName = _pk_translate("General_ColumnNbVisits"); + previousTotalAdjusted = NumberFormatter.formatNumber(Math.round(site.previous_nb_visits * site.ratio)); + } + if (model.sortColumn == 'pageviews_evolution') { + previousTotal = site.previous_Actions_nb_pageviews; + currentTotal = site.nb_pageviews; + evolution = NumberFormatter.formatPercent(site.pageviews_evolution); + metricName = _pk_translate("General_ColumnPageviews"); + previousTotalAdjusted = NumberFormatter.formatNumber(Math.round(site.previous_Actions_nb_pageviews * site.ratio)); + } + if (model.sortColumn == 'revenue_evolution') { + previousTotal = NumberFormatter.formatCurrency(site.previous_Goal_revenue, site.currencySymbol); + currentTotal = NumberFormatter.formatCurrency(site.revenue, site.currencySymbol); + evolution = NumberFormatter.formatPercent(site.revenue_evolution); + metricName = _pk_translate("General_ColumnRevenue"); + previousTotalAdjusted = NumberFormatter.formatCurrency(Math.round(site.previous_Goal_revenue * site.ratio), site.currencySymbol); + } + + if (metricName) { + site.tooltip = _pk_translate("MultiSites_EvolutionComparisonIncomplete", [percent]) + "\n"; + site.tooltip += _pk_translate("MultiSites_EvolutionComparisonProportional", [percent, previousTotalAdjusted, metricName, previousTotal]) + "\n"; + + switch (site.periodName) { + case 'day': + site.tooltip += _pk_translate("MultiSites_EvolutionComparisonDay", [currentTotal, metricName, previousTotalAdjusted, site.previousRange, evolution]); + break; + case 'week': + site.tooltip += _pk_translate("MultiSites_EvolutionComparisonWeek", [currentTotal, metricName, previousTotalAdjusted, site.previousRange, evolution]); + break; + case 'month': + site.tooltip += _pk_translate("MultiSites_EvolutionComparisonMonth", [currentTotal, metricName, previousTotalAdjusted, site.previousRange, evolution]); + break; + case 'year': + site.tooltip += _pk_translate("MultiSites_EvolutionComparisonYear", [currentTotal, metricName, previousTotalAdjusted, site.previousRange, evolution]); + break; + } + } + + } }); model.totalVisits = report.totals.nb_visits; @@ -110,7 +158,7 @@ model.sortColumn = metric; fetchAllSites(); - }; + } function previousPage() { model.currentPage = model.currentPage - 1; @@ -145,7 +193,7 @@ filter_sort_order: 'asc', filter_limit: model.pageSize, filter_offset: getCurrentPagingOffset(), - showColumns: 'label,nb_visits,nb_pageviews,visits_evolution,pageviews_evolution,revenue_evolution,nb_actions,revenue' + showColumns: 'label,nb_visits,nb_pageviews,visits_evolution,visits_evolution_trend,pageviews_evolution,pageviews_evolution_trend,revenue_evolution,revenue_evolution_trend,nb_actions,revenue' }; if (model.searchTerm) { diff --git a/plugins/MultiSites/angularjs/site/site.directive.html b/plugins/MultiSites/angularjs/site/site.directive.html index 376d70349ac..b2b0d3780a1 100644 --- a/plugins/MultiSites/angularjs/site/site.directive.html +++ b/plugins/MultiSites/angularjs/site/site.directive.html @@ -20,11 +20,11 @@ {{ website.revenue }} - +
- {{ website[evolutionMetric] }}% - {{ website[evolutionMetric] }}% - {{ website[evolutionMetric] }}% + {{ website[evolutionMetric] }} + {{ website[evolutionMetric] }} + {{ website[evolutionMetric] }}
@@ -37,3 +37,4 @@ + diff --git a/plugins/MultiSites/lang/en.json b/plugins/MultiSites/lang/en.json index f67438a2e46..c2a351b6891 100644 --- a/plugins/MultiSites/lang/en.json +++ b/plugins/MultiSites/lang/en.json @@ -5,6 +5,14 @@ "PluginDescription": "View and compare all your websites and apps in this useful 'All Websites' dashboard.", "TopLinkTooltip": "Compare Web Analytics stats for all of your Websites.", "SingleWebsitesDashboardDocumentation": "This report gives you an informational overview for a specific website, containing the most general metrics about your visitors.", - "AllWebsitesDashboardDocumentation": "This report gives you an informational overview for each of your websites, containing the most general metrics about your visitors." + "AllWebsitesDashboardDocumentation": "This report gives you an informational overview for each of your websites, containing the most general metrics about your visitors.", + "EvolutionComparisonIncomplete": "The currently selected time period is %1$s complete.", + "EvolutionComparisonProportional": "When the previous period was also %1$s complete, there would have been an estimated %2$s %3$s\n (out of a total of %4$s %3$s in the previous period).", + "EvolutionComparisonDay": "%1$s %2$s this day compared to %3$s %2$s in the previous period (%4$s) Evolution: %5$s", + "EvolutionComparisonWeek": "%1$s %2$s this week compared to %3$s %2$s in the previous period (%4$s) Evolution: %5$s", + "EvolutionComparisonMonth": "%1$s %2$s this month compared to %3$s %2$s in the previous period (%4$s) Evolution: %5$s", + "EvolutionComparisonYear": "%1$s %2$s this year compared to %3$s %2$s in the previous period (%4$s) Evolution: %5$s" + + } } \ No newline at end of file diff --git a/plugins/MultiSites/tests/Integration/ControllerTest.php b/plugins/MultiSites/tests/Integration/ControllerTest.php index b0ac45ad8ff..dd54beefad6 100644 --- a/plugins/MultiSites/tests/Integration/ControllerTest.php +++ b/plugins/MultiSites/tests/Integration/ControllerTest.php @@ -53,6 +53,24 @@ public function test_getAllWithGroups() 'nb_conversions_evolution' => '100%', 'orders_evolution' => '100%', 'ecommerce_revenue_evolution' => '100%', + 'ratio' => 1, + 'previous_nb_visits' => 0, + 'periodName' => 'day', + 'previousRange' => 'Tue, Jan 22', + 'previous_nb_actions' => 0, + 'previous_Actions_nb_pageviews' => 0, + 'previous_Goal_revenue' => 0, + 'previous_Goal_nb_conversions' => 0, + 'previous_Goal_0_nb_conversions' => 0, + 'previous_Goal_0_revenue' => 0, + 'visits_evolution_trend' => 1, + 'actions_evolution_trend' => 1, + 'pageviews_evolution_trend' => 1, + 'revenue_evolution_trend' => 1, + 'nb_conversions_evolution_trend' => 1, + 'orders_evolution_trend' => 1, + 'ecommerce_revenue_evolution_trend' => 1, + 'currencySymbol' => '$', ), $sites['sites'][0]); unset($sites['sites']); diff --git a/plugins/MultiSites/tests/Integration/DashboardTest.php b/plugins/MultiSites/tests/Integration/DashboardTest.php index 982a6ecc37b..277f52617bf 100644 --- a/plugins/MultiSites/tests/Integration/DashboardTest.php +++ b/plugins/MultiSites/tests/Integration/DashboardTest.php @@ -80,6 +80,20 @@ public function test__construct_shouldFetchSitesWithNeededColumns_AndReturnEvenS 'main_url' => 'http://piwik.net', 'nb_conversions' => 0, 'nb_conversions_evolution' => '0%', + 'ratio' => 1, + 'previous_nb_visits' => 0, + 'periodName' => 'day', + 'previousRange' => 'Wed, Dec 12', + 'previous_nb_actions' => 0, + 'previous_Actions_nb_pageviews' => 0, + 'previous_Goal_revenue' => 0, + 'previous_Goal_nb_conversions' => 0, + 'visits_evolution_trend' => 0, + 'actions_evolution_trend' => 0, + 'pageviews_evolution_trend' => 0, + 'revenue_evolution_trend' => 0, + 'nb_conversions_evolution_trend' => 0, + 'currencySymbol' => '$', ), array ( 'label' => 'Site 2', @@ -96,7 +110,21 @@ public function test__construct_shouldFetchSitesWithNeededColumns_AndReturnEvenS 'main_url' => 'http://piwik.net', 'nb_conversions' => 0, 'nb_conversions_evolution' => '0%', - ), + 'ratio' => 1, + 'previous_nb_visits' => 0, + 'periodName' => 'day', + 'previousRange' => 'Wed, Dec 12', + 'previous_nb_actions' => 0, + 'previous_Actions_nb_pageviews' => 0, + 'previous_Goal_revenue' => 0, + 'previous_Goal_nb_conversions' => 0, + 'visits_evolution_trend' => 0, + 'actions_evolution_trend' => 0, + 'pageviews_evolution_trend' => 0, + 'revenue_evolution_trend' => 0, + 'nb_conversions_evolution_trend' => 0, + 'currencySymbol' => '$', + ), array ( 'label' => 'Site 3', 'nb_visits' => '0', @@ -112,6 +140,20 @@ public function test__construct_shouldFetchSitesWithNeededColumns_AndReturnEvenS 'main_url' => 'http://piwik.net', 'nb_conversions' => 0, 'nb_conversions_evolution' => '0%', + 'ratio' => 1, + 'previous_nb_visits' => 0, + 'periodName' => 'day', + 'previousRange' => 'Wed, Dec 12', + 'previous_nb_actions' => 0, + 'previous_Actions_nb_pageviews' => 0, + 'previous_Goal_revenue' => 0, + 'previous_Goal_nb_conversions' => 0, + 'visits_evolution_trend' => 0, + 'actions_evolution_trend' => 0, + 'pageviews_evolution_trend' => 0, + 'revenue_evolution_trend' => 0, + 'nb_conversions_evolution_trend' => 0, + 'currencySymbol' => '$', ), ); $this->assertEquals($expectedSites, $dashboard->getSites(array(), $limit = 10)); @@ -138,6 +180,20 @@ public function test__construct_shouldActuallyFindSitesWhenSeaching() 'main_url' => 'http://piwik.net', 'nb_conversions' => 0, 'nb_conversions_evolution' => '0%', + 'ratio' => 1, + 'previous_nb_visits' => 0, + 'periodName' => 'day', + 'previousRange' => 'Wed, Dec 12', + 'previous_nb_actions' => 0, + 'previous_Actions_nb_pageviews' => 0, + 'previous_Goal_revenue' => 0, + 'previous_Goal_nb_conversions' => 0, + 'visits_evolution_trend' => 0, + 'actions_evolution_trend' => 0, + 'pageviews_evolution_trend' => 0, + 'revenue_evolution_trend' => 0, + 'nb_conversions_evolution_trend' => 0, + 'currencySymbol' => '$', ), ); $dashboard->search('site 2'); diff --git a/tests/PHPUnit/Integration/ArchiveTest.php b/tests/PHPUnit/Integration/ArchiveTest.php index 14caddbcd08..820dfe019ce 100644 --- a/tests/PHPUnit/Integration/ArchiveTest.php +++ b/tests/PHPUnit/Integration/ArchiveTest.php @@ -112,6 +112,8 @@ public function test_pluginSpecificArchiveUsed_EvenIfAllArchiveExists_IfThereAre $archive = Archive::build($idSite, 'day', '2014-05-07'); $metrics = $archive->getNumeric(['ExamplePlugin_archive1metric', 'ExamplePlugin_archive2metric', 'ExamplePlugin_archive3metric']); + unset($metrics['_metadata']); + $expected = [ 'ExamplePlugin_archive1metric' => 1, 'ExamplePlugin_archive2metric' => 2, diff --git a/tests/PHPUnit/System/TwoVisitorsTwoWebsitesDifferentDaysConversionsTest.php b/tests/PHPUnit/System/TwoVisitorsTwoWebsitesDifferentDaysConversionsTest.php index 8d357aa2b37..4708ba70136 100644 --- a/tests/PHPUnit/System/TwoVisitorsTwoWebsitesDifferentDaysConversionsTest.php +++ b/tests/PHPUnit/System/TwoVisitorsTwoWebsitesDifferentDaysConversionsTest.php @@ -132,6 +132,10 @@ public function test_Archive_getNumeric_ReturnsMetricsFromDifferentPlugins_WhenT $archive = Archive::build($idSite1, 'range', $dateTimeRange); $result = $archive->getNumeric($columns); + if (isset($result['_metadata'])) { + unset($result['_metadata']); + } + $this->assertEquals( array( 'nb_visits' => 5, diff --git a/tests/PHPUnit/System/expected/test_BackwardsCompatibility1XTest__MultiSites.getAll_day.xml b/tests/PHPUnit/System/expected/test_BackwardsCompatibility1XTest__MultiSites.getAll_day.xml index 5218ad39615..98eba63273e 100644 --- a/tests/PHPUnit/System/expected/test_BackwardsCompatibility1XTest__MultiSites.getAll_day.xml +++ b/tests/PHPUnit/System/expected/test_BackwardsCompatibility1XTest__MultiSites.getAll_day.xml @@ -7,10 +7,22 @@ 4 43 100% + 1 100% + 1 100% + 1 100% + 1 1 + 1 + $ + 0 + day + Mon, Mar 5 + 0 + 0 + 0 http://site.com diff --git a/tests/PHPUnit/System/expected/test_ImportLogs__MultiSites.getAll_month.xml b/tests/PHPUnit/System/expected/test_ImportLogs__MultiSites.getAll_month.xml index 39ab78c6e90..41dc8b695a1 100644 --- a/tests/PHPUnit/System/expected/test_ImportLogs__MultiSites.getAll_month.xml +++ b/tests/PHPUnit/System/expected/test_ImportLogs__MultiSites.getAll_month.xml @@ -7,10 +7,22 @@ 45 195 100% + 1 100% + 1 100% + 1 100% + 1 1 + 1 + $ + 0 + month + Jul 2012 + 0 + 0 + 0 http://piwik.net @@ -21,10 +33,22 @@ 5 0 100% + 1 100% + 1 100% + 1 0% + 0 3 + 1 + $ + 0 + month + Jul 2012 + 0 + 0 + 0 http://example-site-three.com @@ -35,10 +59,22 @@ 1 0 100% + 1 100% + 1 100% + 1 0% + 0 2 + 1 + $ + 0 + month + Jul 2012 + 0 + 0 + 0 http://example-site-two.com diff --git a/tests/PHPUnit/System/expected/test_ImportLogs__MultiSites.getOne_month.xml b/tests/PHPUnit/System/expected/test_ImportLogs__MultiSites.getOne_month.xml index ca2db76ca11..885016c4ca5 100644 --- a/tests/PHPUnit/System/expected/test_ImportLogs__MultiSites.getOne_month.xml +++ b/tests/PHPUnit/System/expected/test_ImportLogs__MultiSites.getOne_month.xml @@ -3,9 +3,13 @@ 43 51 100% + 1 100% + 1 100% + 1 100% + 1 45 195 \ No newline at end of file diff --git a/tests/PHPUnit/System/expected/test_ImportLogs_withEnhancedAndLast7__MultiSites.getAll_month.xml b/tests/PHPUnit/System/expected/test_ImportLogs_withEnhancedAndLast7__MultiSites.getAll_month.xml index 1a70f3db7c8..d61ce4a54f6 100644 --- a/tests/PHPUnit/System/expected/test_ImportLogs_withEnhancedAndLast7__MultiSites.getAll_month.xml +++ b/tests/PHPUnit/System/expected/test_ImportLogs_withEnhancedAndLast7__MultiSites.getAll_month.xml @@ -9,11 +9,25 @@ 195 39 100% + 1 100% + 1 100% + 1 100% + 1 100% + 1 1 + 1 + $ + 0 + month + Jul 2012 + 0 + 0 + 0 + 0 http://piwik.net @@ -25,11 +39,25 @@ 0 0 100% + 1 100% + 1 100% + 1 0% + 0 0% + 0 3 + 1 + $ + 0 + month + Jul 2012 + 0 + 0 + 0 + 0 http://example-site-three.com @@ -41,11 +69,25 @@ 0 0 100% + 1 100% + 1 100% + 1 0% + 0 0% + 0 2 + 1 + $ + 0 + month + Jul 2012 + 0 + 0 + 0 + 0 http://example-site-two.com @@ -59,11 +101,25 @@ 5 1 -97.7% + -1 -80.4% + -1 -77.8% + -1 -97.4% + -1 -97.4% + -1 1 + 1 + $ + 43 + month + Aug 2012 + 51 + 45 + 195 + 39 http://piwik.net @@ -75,11 +131,25 @@ 0 0 -100% + -1 -100% + -1 -100% + -1 0% + 0 0% + 0 2 + 1 + $ + 1 + month + Aug 2012 + 1 + 1 + 0 + 0 http://example-site-two.com @@ -91,11 +161,25 @@ 0 0 -100% + -1 -100% + -1 -100% + -1 0% + 0 0% + 0 3 + 1 + $ + 3 + month + Aug 2012 + 5 + 5 + 0 + 0 http://example-site-three.com @@ -109,11 +193,25 @@ 0 0 -100% + -1 -100% + -1 -100% + -1 -100% + -1 -100% + -1 1 + 1 + $ + 1 + month + Sep 2012 + 10 + 10 + 5 + 1 http://piwik.net @@ -125,11 +223,25 @@ 0 0 0% + 0 0% + 0 0% + 0 0% + 0 0% + 0 2 + 1 + $ + 0 + month + Sep 2012 + 0 + 0 + 0 + 0 http://example-site-two.com @@ -141,11 +253,25 @@ 0 0 0% + 0 0% + 0 0% + 0 0% + 0 0% + 0 3 + 1 + $ + 0 + month + Sep 2012 + 0 + 0 + 0 + 0 http://example-site-three.com @@ -159,11 +285,25 @@ 0 0 0% + 0 0% + 0 0% + 0 0% + 0 0% + 0 1 + 1 + $ + 0 + month + Oct 2012 + 0 + 0 + 0 + 0 http://piwik.net @@ -175,11 +315,25 @@ 0 0 0% + 0 0% + 0 0% + 0 0% + 0 0% + 0 2 + 1 + $ + 0 + month + Oct 2012 + 0 + 0 + 0 + 0 http://example-site-two.com @@ -191,11 +345,25 @@ 0 0 0% + 0 0% + 0 0% + 0 0% + 0 0% + 0 3 + 1 + $ + 0 + month + Oct 2012 + 0 + 0 + 0 + 0 http://example-site-three.com @@ -209,11 +377,25 @@ 0 0 0% + 0 0% + 0 0% + 0 0% + 0 0% + 0 1 + 1 + $ + 0 + month + Nov 2012 + 0 + 0 + 0 + 0 http://piwik.net @@ -225,11 +407,25 @@ 0 0 0% + 0 0% + 0 0% + 0 0% + 0 0% + 0 2 + 1 + $ + 0 + month + Nov 2012 + 0 + 0 + 0 + 0 http://example-site-two.com @@ -241,11 +437,25 @@ 0 0 0% + 0 0% + 0 0% + 0 0% + 0 0% + 0 3 + 1 + $ + 0 + month + Nov 2012 + 0 + 0 + 0 + 0 http://example-site-three.com @@ -259,11 +469,25 @@ 0 0 0% + 0 0% + 0 0% + 0 0% + 0 0% + 0 1 + 1 + $ + 0 + month + Dec 2012 + 0 + 0 + 0 + 0 http://piwik.net @@ -275,11 +499,25 @@ 0 0 0% + 0 0% + 0 0% + 0 0% + 0 0% + 0 2 + 1 + $ + 0 + month + Dec 2012 + 0 + 0 + 0 + 0 http://example-site-two.com @@ -291,11 +529,25 @@ 0 0 0% + 0 0% + 0 0% + 0 0% + 0 0% + 0 3 + 1 + $ + 0 + month + Dec 2012 + 0 + 0 + 0 + 0 http://example-site-three.com @@ -309,11 +561,25 @@ 0 0 0% + 0 0% + 0 0% + 0 0% + 0 0% + 0 1 + 1 + $ + 0 + month + Jan 2013 + 0 + 0 + 0 + 0 http://piwik.net @@ -325,11 +591,25 @@ 0 0 0% + 0 0% + 0 0% + 0 0% + 0 0% + 0 2 + 1 + $ + 0 + month + Jan 2013 + 0 + 0 + 0 + 0 http://example-site-two.com @@ -341,11 +621,25 @@ 0 0 0% + 0 0% + 0 0% + 0 0% + 0 0% + 0 3 + 1 + $ + 0 + month + Jan 2013 + 0 + 0 + 0 + 0 http://example-site-three.com diff --git a/tests/PHPUnit/System/expected/test_OneVisitorTwoVisits__MultiSites.getAll_day.xml b/tests/PHPUnit/System/expected/test_OneVisitorTwoVisits__MultiSites.getAll_day.xml index 5218ad39615..32dc2a24b3b 100644 --- a/tests/PHPUnit/System/expected/test_OneVisitorTwoVisits__MultiSites.getAll_day.xml +++ b/tests/PHPUnit/System/expected/test_OneVisitorTwoVisits__MultiSites.getAll_day.xml @@ -7,10 +7,22 @@ 4 43 100% + 1 100% + 1 100% + 1 100% + 1 1 + 1 + $ + 0 + day + Fri, Mar 5 + 0 + 0 + 0 http://site.com diff --git a/tests/PHPUnit/System/expected/test_OneVisitorTwoVisits__MultiSites.getOne_day.xml b/tests/PHPUnit/System/expected/test_OneVisitorTwoVisits__MultiSites.getOne_day.xml index b76e6ee906d..a0cd571ea6f 100644 --- a/tests/PHPUnit/System/expected/test_OneVisitorTwoVisits__MultiSites.getOne_day.xml +++ b/tests/PHPUnit/System/expected/test_OneVisitorTwoVisits__MultiSites.getOne_day.xml @@ -3,9 +3,13 @@ 2 8 100% + 1 100% + 1 100% + 1 100% + 1 4 43 \ No newline at end of file diff --git a/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_Conversions_MultiSites.getAll_firstSite_lastN__API.getProcessedReport_day.xml b/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_Conversions_MultiSites.getAll_firstSite_lastN__API.getProcessedReport_day.xml index 109e6fb23b5..225e76eef71 100644 --- a/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_Conversions_MultiSites.getAll_firstSite_lastN__API.getProcessedReport_day.xml +++ b/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_Conversions_MultiSites.getAll_firstSite_lastN__API.getProcessedReport_day.xml @@ -209,6 +209,14 @@ 1 + 1 + $ + 0 + day + Sat, Jan 2 + 0 + 0 + 0 http://piwik.net @@ -216,11 +224,27 @@ 1 + 1 + $ + 2 + day + Sun, Jan 3 + 2 + 2 + 10 http://piwik.net 2 + 1 + $ + 0 + day + Sun, Jan 3 + 0 + 0 + 0 http://piwik.net @@ -228,6 +252,14 @@ 1 + 1 + $ + 1 + day + Mon, Jan 4 + 1 + 1 + 0 http://piwik.net @@ -235,6 +267,14 @@ 1 + 1 + $ + 1 + day + Tue, Jan 5 + 5 + 5 + 5 http://piwik.net @@ -242,6 +282,14 @@ 1 + 1 + $ + 1 + day + Wed, Jan 6 + 5 + 5 + 5 http://piwik.net @@ -249,6 +297,14 @@ 1 + 1 + $ + 1 + day + Thu, Jan 7 + 5 + 5 + 5 http://piwik.net @@ -256,15 +312,19 @@ 1 + 1 + $ + 1 + day + Fri, Jan 8 + 5 + 5 + 5 http://piwik.net - 9 - 31 - 31 - 35 \ No newline at end of file diff --git a/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_Conversions__MultiSites.getAll_day.xml b/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_Conversions__MultiSites.getAll_day.xml index 2efd1eaab3f..f974de9b540 100644 --- a/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_Conversions__MultiSites.getAll_day.xml +++ b/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_Conversions__MultiSites.getAll_day.xml @@ -8,10 +8,22 @@ 2 10 100% + 1 100% + 1 100% + 1 100% + 1 1 + 1 + $ + 0 + day + Sat, Jan 2 + 0 + 0 + 0 http://piwik.net @@ -24,10 +36,22 @@ 1 0 -50% + -1 -50% + -1 -50% + -1 -100% + -1 1 + 1 + $ + 2 + day + Sun, Jan 3 + 2 + 2 + 10 http://piwik.net @@ -38,10 +62,22 @@ 3 0 100% + 1 100% + 1 100% + 1 0% + 0 2 + 1 + $ + 0 + day + Sun, Jan 3 + 0 + 0 + 0 http://piwik.net @@ -54,10 +90,22 @@ 5 5 0% + 0 400% + 1 400% + 1 100% + 1 1 + 1 + $ + 1 + day + Mon, Jan 4 + 1 + 1 + 0 http://piwik.net @@ -70,10 +118,22 @@ 5 5 0% + 0 0% + 0 0% + 0 0% + 0 1 + 1 + $ + 1 + day + Tue, Jan 5 + 5 + 5 + 5 http://piwik.net @@ -86,10 +146,22 @@ 5 5 0% + 0 0% + 0 0% + 0 0% + 0 1 + 1 + $ + 1 + day + Wed, Jan 6 + 5 + 5 + 5 http://piwik.net @@ -102,10 +174,22 @@ 5 5 0% + 0 0% + 0 0% + 0 0% + 0 1 + 1 + $ + 1 + day + Thu, Jan 7 + 5 + 5 + 5 http://piwik.net @@ -118,10 +202,22 @@ 5 5 0% + 0 0% + 0 0% + 0 0% + 0 1 + 1 + $ + 1 + day + Fri, Jan 8 + 5 + 5 + 5 http://piwik.net diff --git a/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_Conversions__MultiSites.getAll_month.xml b/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_Conversions__MultiSites.getAll_month.xml index a06b60b0013..3fa8c0993ef 100644 --- a/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_Conversions__MultiSites.getAll_month.xml +++ b/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_Conversions__MultiSites.getAll_month.xml @@ -8,10 +8,22 @@ 43 50 100% + 1 100% + 1 100% + 1 100% + 1 1 + 1 + $ + 0 + month + Dec 2009 + 0 + 0 + 0 http://piwik.net @@ -22,10 +34,22 @@ 3 0 100% + 1 100% + 1 100% + 1 0% + 0 2 + 1 + $ + 0 + month + Dec 2009 + 0 + 0 + 0 http://piwik.net diff --git a/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_Conversions__MultiSites.getAll_week.xml b/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_Conversions__MultiSites.getAll_week.xml index 290e4f62178..5e0cf2cca76 100644 --- a/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_Conversions__MultiSites.getAll_week.xml +++ b/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_Conversions__MultiSites.getAll_week.xml @@ -8,10 +8,22 @@ 2 10 100% + 1 100% + 1 100% + 1 100% + 1 1 + 1 + $ + 0 + week + Dec 21 – 27, 2009 + 0 + 0 + 0 http://piwik.net @@ -24,10 +36,22 @@ 31 30 250% + 1 1,450% + 1 1,450% + 1 200% + 1 1 + 1 + $ + 2 + week + Dec 28, 2009 – Jan 3, 2010 + 2 + 2 + 10 http://piwik.net @@ -38,10 +62,22 @@ 3 0 100% + 1 100% + 1 100% + 1 0% + 0 2 + 1 + $ + 0 + week + Dec 28, 2009 – Jan 3, 2010 + 0 + 0 + 0 http://piwik.net @@ -54,10 +90,22 @@ 10 10 -71.4% + -1 -67.7% + -1 -67.7% + -1 -66.7% + -1 1 + 1 + $ + 7 + week + Jan 4 – 10, 2010 + 31 + 31 + 30 http://piwik.net diff --git a/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_Conversions__MultiSites.getAll_year.xml b/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_Conversions__MultiSites.getAll_year.xml index aad34392f8a..e682f253e1d 100644 --- a/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_Conversions__MultiSites.getAll_year.xml +++ b/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_Conversions__MultiSites.getAll_year.xml @@ -8,10 +8,22 @@ 43 50 100% + 1 100% + 1 100% + 1 100% + 1 1 + 1 + $ + 0 + year + 2009 + 0 + 0 + 0 http://piwik.net @@ -22,10 +34,22 @@ 3 0 100% + 1 100% + 1 100% + 1 0% + 0 2 + 1 + $ + 0 + year + 2009 + 0 + 0 + 0 http://piwik.net diff --git a/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_Conversions_idSiteOne___MultiSites.getAll_day.xml b/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_Conversions_idSiteOne___MultiSites.getAll_day.xml index 2efd1eaab3f..f974de9b540 100644 --- a/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_Conversions_idSiteOne___MultiSites.getAll_day.xml +++ b/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_Conversions_idSiteOne___MultiSites.getAll_day.xml @@ -8,10 +8,22 @@ 2 10 100% + 1 100% + 1 100% + 1 100% + 1 1 + 1 + $ + 0 + day + Sat, Jan 2 + 0 + 0 + 0 http://piwik.net @@ -24,10 +36,22 @@ 1 0 -50% + -1 -50% + -1 -50% + -1 -100% + -1 1 + 1 + $ + 2 + day + Sun, Jan 3 + 2 + 2 + 10 http://piwik.net @@ -38,10 +62,22 @@ 3 0 100% + 1 100% + 1 100% + 1 0% + 0 2 + 1 + $ + 0 + day + Sun, Jan 3 + 0 + 0 + 0 http://piwik.net @@ -54,10 +90,22 @@ 5 5 0% + 0 400% + 1 400% + 1 100% + 1 1 + 1 + $ + 1 + day + Mon, Jan 4 + 1 + 1 + 0 http://piwik.net @@ -70,10 +118,22 @@ 5 5 0% + 0 0% + 0 0% + 0 0% + 0 1 + 1 + $ + 1 + day + Tue, Jan 5 + 5 + 5 + 5 http://piwik.net @@ -86,10 +146,22 @@ 5 5 0% + 0 0% + 0 0% + 0 0% + 0 1 + 1 + $ + 1 + day + Wed, Jan 6 + 5 + 5 + 5 http://piwik.net @@ -102,10 +174,22 @@ 5 5 0% + 0 0% + 0 0% + 0 0% + 0 1 + 1 + $ + 1 + day + Thu, Jan 7 + 5 + 5 + 5 http://piwik.net @@ -118,10 +202,22 @@ 5 5 0% + 0 0% + 0 0% + 0 0% + 0 1 + 1 + $ + 1 + day + Fri, Jan 8 + 5 + 5 + 5 http://piwik.net diff --git a/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_Conversions_idSiteOne___MultiSites.getAll_month.xml b/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_Conversions_idSiteOne___MultiSites.getAll_month.xml index a06b60b0013..3fa8c0993ef 100644 --- a/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_Conversions_idSiteOne___MultiSites.getAll_month.xml +++ b/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_Conversions_idSiteOne___MultiSites.getAll_month.xml @@ -8,10 +8,22 @@ 43 50 100% + 1 100% + 1 100% + 1 100% + 1 1 + 1 + $ + 0 + month + Dec 2009 + 0 + 0 + 0 http://piwik.net @@ -22,10 +34,22 @@ 3 0 100% + 1 100% + 1 100% + 1 0% + 0 2 + 1 + $ + 0 + month + Dec 2009 + 0 + 0 + 0 http://piwik.net diff --git a/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_Conversions_idSiteOne___MultiSites.getAll_week.xml b/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_Conversions_idSiteOne___MultiSites.getAll_week.xml index 290e4f62178..5e0cf2cca76 100644 --- a/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_Conversions_idSiteOne___MultiSites.getAll_week.xml +++ b/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_Conversions_idSiteOne___MultiSites.getAll_week.xml @@ -8,10 +8,22 @@ 2 10 100% + 1 100% + 1 100% + 1 100% + 1 1 + 1 + $ + 0 + week + Dec 21 – 27, 2009 + 0 + 0 + 0 http://piwik.net @@ -24,10 +36,22 @@ 31 30 250% + 1 1,450% + 1 1,450% + 1 200% + 1 1 + 1 + $ + 2 + week + Dec 28, 2009 – Jan 3, 2010 + 2 + 2 + 10 http://piwik.net @@ -38,10 +62,22 @@ 3 0 100% + 1 100% + 1 100% + 1 0% + 0 2 + 1 + $ + 0 + week + Dec 28, 2009 – Jan 3, 2010 + 0 + 0 + 0 http://piwik.net @@ -54,10 +90,22 @@ 10 10 -71.4% + -1 -67.7% + -1 -67.7% + -1 -66.7% + -1 1 + 1 + $ + 7 + week + Jan 4 – 10, 2010 + 31 + 31 + 30 http://piwik.net diff --git a/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_Conversions_idSiteOne___MultiSites.getAll_year.xml b/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_Conversions_idSiteOne___MultiSites.getAll_year.xml index aad34392f8a..e682f253e1d 100644 --- a/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_Conversions_idSiteOne___MultiSites.getAll_year.xml +++ b/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_Conversions_idSiteOne___MultiSites.getAll_year.xml @@ -8,10 +8,22 @@ 43 50 100% + 1 100% + 1 100% + 1 100% + 1 1 + 1 + $ + 0 + year + 2009 + 0 + 0 + 0 http://piwik.net @@ -22,10 +34,22 @@ 3 0 100% + 1 100% + 1 100% + 1 0% + 0 2 + 1 + $ + 0 + year + 2009 + 0 + 0 + 0 http://piwik.net diff --git a/tests/PHPUnit/System/expected/test_noVisit_PeriodIsLast__MultiSites.getOne_day.xml b/tests/PHPUnit/System/expected/test_noVisit_PeriodIsLast__MultiSites.getOne_day.xml index b34eb3e56bd..5c94021bfcf 100644 --- a/tests/PHPUnit/System/expected/test_noVisit_PeriodIsLast__MultiSites.getOne_day.xml +++ b/tests/PHPUnit/System/expected/test_noVisit_PeriodIsLast__MultiSites.getOne_day.xml @@ -4,9 +4,13 @@ 0 0 0% + 0 0% + 0 0% + 0 0% + 0 0 0 @@ -14,9 +18,13 @@ 0 0 0% + 0 0% + 0 0% + 0 0% + 0 0 0 @@ -24,9 +32,13 @@ 0 0 0% + 0 0% + 0 0% + 0 0% + 0 0 0 @@ -34,9 +46,13 @@ 0 0 0% + 0 0% + 0 0% + 0 0% + 0 0 0 @@ -44,9 +60,13 @@ 0 0 0% + 0 0% + 0 0% + 0 0% + 0 0 0 @@ -54,9 +74,13 @@ 0 0 0% + 0 0% + 0 0% + 0 0% + 0 0 0 @@ -64,9 +88,13 @@ 0 0 0% + 0 0% + 0 0% + 0 0% + 0 0 0 diff --git a/tests/PHPUnit/System/expected/test_noVisit_PeriodIsLast__MultiSites.getOne_week.xml b/tests/PHPUnit/System/expected/test_noVisit_PeriodIsLast__MultiSites.getOne_week.xml index aca453e3635..72ef1266169 100644 --- a/tests/PHPUnit/System/expected/test_noVisit_PeriodIsLast__MultiSites.getOne_week.xml +++ b/tests/PHPUnit/System/expected/test_noVisit_PeriodIsLast__MultiSites.getOne_week.xml @@ -4,9 +4,13 @@ 0 0 0% + 0 0% + 0 0% + 0 0% + 0 0 0 @@ -14,9 +18,13 @@ 0 0 0% + 0 0% + 0 0% + 0 0% + 0 0 0 @@ -24,9 +32,13 @@ 0 0 0% + 0 0% + 0 0% + 0 0% + 0 0 0 @@ -34,9 +46,13 @@ 0 0 0% + 0 0% + 0 0% + 0 0% + 0 0 0 @@ -44,9 +60,13 @@ 0 0 0% + 0 0% + 0 0% + 0 0% + 0 0 0 @@ -54,9 +74,13 @@ 0 0 0% + 0 0% + 0 0% + 0 0% + 0 0 0 @@ -64,9 +88,13 @@ 0 0 0% + 0 0% + 0 0% + 0 0% + 0 0 0 diff --git a/tests/PHPUnit/System/expected/test_noVisit__MultiSites.getOne_day.xml b/tests/PHPUnit/System/expected/test_noVisit__MultiSites.getOne_day.xml index 2c523aeb3e0..f0a62bc6253 100644 --- a/tests/PHPUnit/System/expected/test_noVisit__MultiSites.getOne_day.xml +++ b/tests/PHPUnit/System/expected/test_noVisit__MultiSites.getOne_day.xml @@ -3,9 +3,13 @@ 0 0 0% + 0 0% + 0 0% + 0 0% + 0 0 0 \ No newline at end of file diff --git a/tests/PHPUnit/System/expected/test_oneVisitor_oneWebsite_severalDays_DateRange_IndexedByDate__MultiSites.getAll_day.xml b/tests/PHPUnit/System/expected/test_oneVisitor_oneWebsite_severalDays_DateRange_IndexedByDate__MultiSites.getAll_day.xml index a1c7e55b5f3..8d6cd9b0b9a 100644 --- a/tests/PHPUnit/System/expected/test_oneVisitor_oneWebsite_severalDays_DateRange_IndexedByDate__MultiSites.getAll_day.xml +++ b/tests/PHPUnit/System/expected/test_oneVisitor_oneWebsite_severalDays_DateRange_IndexedByDate__MultiSites.getAll_day.xml @@ -7,10 +7,22 @@ 3 0 0% + 0 0% + 0 0% + 0 0% + 0 1 + 1 + $ + 2 + day + Tue, Dec 14 + 3 + 3 + 0 http://piwik.net diff --git a/tests/PHPUnit/System/expected/test_oneVisitor_oneWebsite_severalDays_DateRange_MultipleDatesNotSupported__MultiSites.getAll_day.xml b/tests/PHPUnit/System/expected/test_oneVisitor_oneWebsite_severalDays_DateRange_MultipleDatesNotSupported__MultiSites.getAll_day.xml index f714cc123d8..0ade0fabd67 100644 --- a/tests/PHPUnit/System/expected/test_oneVisitor_oneWebsite_severalDays_DateRange_MultipleDatesNotSupported__MultiSites.getAll_day.xml +++ b/tests/PHPUnit/System/expected/test_oneVisitor_oneWebsite_severalDays_DateRange_MultipleDatesNotSupported__MultiSites.getAll_day.xml @@ -8,10 +8,22 @@ 3 0 0% + 0 0% + 0 0% + 0 0% + 0 1 + 1 + $ + 2 + day + Tue, Dec 14 + 3 + 3 + 0 http://piwik.net @@ -22,10 +34,22 @@ 1 0 0% + 0 0% + 0 0% + 0 0% + 0 2 + 1 + $ + 1 + day + Tue, Dec 14 + 1 + 1 + 0 http://piwik.net @@ -47,10 +71,22 @@ 3 0 100% + 1 100% + 1 100% + 1 0% + 0 1 + 1 + $ + 0 + day + Fri, Dec 24 + 0 + 0 + 0 http://piwik.net @@ -61,10 +97,22 @@ 1 0 100% + 1 100% + 1 100% + 1 0% + 0 2 + 1 + $ + 0 + day + Fri, Dec 24 + 0 + 0 + 0 http://piwik.net @@ -97,10 +145,22 @@ 3 0 100% + 1 100% + 1 100% + 1 0% + 0 1 + 1 + $ + 0 + day + Fri, Jan 14 + 0 + 0 + 0 http://piwik.net diff --git a/tests/PHPUnit/System/expected/test_oneVisitor_oneWebsite_severalDays_DateRange_Truncated__MultiSites.getAll_range.xml b/tests/PHPUnit/System/expected/test_oneVisitor_oneWebsite_severalDays_DateRange_Truncated__MultiSites.getAll_range.xml index 0f13a8fa50e..e43a4f41661 100644 --- a/tests/PHPUnit/System/expected/test_oneVisitor_oneWebsite_severalDays_DateRange_Truncated__MultiSites.getAll_range.xml +++ b/tests/PHPUnit/System/expected/test_oneVisitor_oneWebsite_severalDays_DateRange_Truncated__MultiSites.getAll_range.xml @@ -7,8 +7,20 @@ 11 0 100% + 1 100% + 1 100% + 1 0% + 0 + 1 + USD + 0 + range + Nov 13 – Dec 14, 2010 + 0 + 0 + 0 \ No newline at end of file diff --git a/tests/PHPUnit/System/expected/test_oneVisitor_oneWebsite_severalDays_DateRange__MultiSites.getAll_range.xml b/tests/PHPUnit/System/expected/test_oneVisitor_oneWebsite_severalDays_DateRange__MultiSites.getAll_range.xml index 22ff810189a..ea068681877 100644 --- a/tests/PHPUnit/System/expected/test_oneVisitor_oneWebsite_severalDays_DateRange__MultiSites.getAll_range.xml +++ b/tests/PHPUnit/System/expected/test_oneVisitor_oneWebsite_severalDays_DateRange__MultiSites.getAll_range.xml @@ -7,10 +7,22 @@ 9 0 200% + 1 200% + 1 200% + 1 0% + 0 1 + 1 + $ + 2 + range + Nov 13 – Dec 14, 2010 + 3 + 3 + 0 http://piwik.net @@ -21,10 +33,22 @@ 2 0 100% + 1 100% + 1 100% + 1 0% + 0 2 + 1 + $ + 1 + range + Nov 13 – Dec 14, 2010 + 1 + 1 + 0 http://piwik.net diff --git a/tests/PHPUnit/System/expected/test_oneVisitor_oneWebsite_severalDays_DateRange__MultiSites.getOne_range.xml b/tests/PHPUnit/System/expected/test_oneVisitor_oneWebsite_severalDays_DateRange__MultiSites.getOne_range.xml index e9115ba10c4..1925b7a67c9 100644 --- a/tests/PHPUnit/System/expected/test_oneVisitor_oneWebsite_severalDays_DateRange__MultiSites.getOne_range.xml +++ b/tests/PHPUnit/System/expected/test_oneVisitor_oneWebsite_severalDays_DateRange__MultiSites.getOne_range.xml @@ -3,9 +3,13 @@ 6 9 200% + 1 200% + 1 200% + 1 0% + 0 9 0 \ No newline at end of file diff --git a/tests/PHPUnit/System/expected/test_oneVisitor_oneWebsite_severalDays_DateRange_showColumns__MultiSites.getAll_day.xml b/tests/PHPUnit/System/expected/test_oneVisitor_oneWebsite_severalDays_DateRange_showColumns__MultiSites.getAll_day.xml index 1639884498b..ae23cd01c0b 100644 --- a/tests/PHPUnit/System/expected/test_oneVisitor_oneWebsite_severalDays_DateRange_showColumns__MultiSites.getAll_day.xml +++ b/tests/PHPUnit/System/expected/test_oneVisitor_oneWebsite_severalDays_DateRange_showColumns__MultiSites.getAll_day.xml @@ -5,6 +5,11 @@ 2 0% 1 + 1 + $ + 2 + day + Tue, Dec 14 http://piwik.net @@ -13,6 +18,11 @@ 1 0% 2 + 1 + $ + 1 + day + Tue, Dec 14 http://piwik.net