-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '5.x-dev' into example-plugin-record-builder
- Loading branch information
Showing
135 changed files
with
3,379 additions
and
974 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Stylelint | ||
|
||
on: pull_request | ||
|
||
permissions: | ||
actions: none | ||
checks: none | ||
contents: none | ||
deployments: none | ||
issues: none | ||
packages: none | ||
pull-requests: read | ||
repository-projects: none | ||
security-events: none | ||
statuses: none | ||
|
||
jobs: | ||
phpcs: | ||
name: stylelinter | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
lfs: false | ||
persist-credentials: false | ||
- name: stylelint | ||
run: | | ||
npm install | ||
npx stylelint "**/*.{css,less}" -f github |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"overrides": [ | ||
{ | ||
"files": ["**/*.less"], | ||
"customSyntax": "postcss-less" | ||
} | ||
], | ||
"ignoreFiles": ["node_modules/**/*", "vendor/**/*", "tests/**/*", "tmp/**/*", "misc/**/*", "plugins/*/vue/dist/*"], | ||
"rules": { | ||
"color-no-invalid-hex": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?php | ||
/** | ||
* Matomo - free/libre analytics platform | ||
* | ||
* @link https://matomo.org | ||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later | ||
* | ||
*/ | ||
|
||
namespace Piwik\DataTable\Filter; | ||
|
||
use Piwik\DataTable\BaseFilter; | ||
use Piwik\Metrics; | ||
use Piwik\Tracker\GoalManager; | ||
|
||
/** | ||
* This filter will check for goal metrics in every row in a DataTable (that is, the Metrics::INDEX_GOALS | ||
* column), and if found, adds the sum of all goal conversions and sum of revenue as two new fields. | ||
* | ||
* This filter is used by RecordBuilders during archiving. | ||
*/ | ||
class EnrichRecordWithGoalMetricSums extends BaseFilter | ||
{ | ||
public function filter($table) | ||
{ | ||
foreach ($table->getRows() as $row) { | ||
$columns = $row->getColumns(); | ||
self::enrichWithConversions($columns); | ||
$row->setColumns($columns); | ||
|
||
$subtable = $row->getSubtable(); | ||
if ($subtable) { | ||
$this->filter($subtable); | ||
} | ||
} | ||
} | ||
|
||
public static function enrichWithConversions(&$values): void | ||
{ | ||
if (!isset($values[Metrics::INDEX_GOALS])) { | ||
return; | ||
} | ||
|
||
$revenue = $conversions = 0; | ||
foreach ($values[Metrics::INDEX_GOALS] as $idgoal => $goalValues) { | ||
// Do not sum Cart revenue since it is a lost revenue | ||
if ($idgoal >= GoalManager::IDGOAL_ORDER) { | ||
$revenue += $goalValues[Metrics::INDEX_GOAL_REVENUE]; | ||
$conversions += $goalValues[Metrics::INDEX_GOAL_NB_CONVERSIONS]; | ||
} | ||
} | ||
$values[Metrics::INDEX_NB_CONVERSIONS] = $conversions; | ||
|
||
// 25.00 recorded as 25 | ||
if (round($revenue) == $revenue) { | ||
$revenue = round($revenue); | ||
} | ||
$values[Metrics::INDEX_REVENUE] = $revenue; | ||
|
||
// if there are no "visit" column, we force one to prevent future complications | ||
// eg. This helps the setDefaultColumnsToDisplay() call | ||
if (!isset($values[Metrics::INDEX_NB_VISITS])) { | ||
$values[Metrics::INDEX_NB_VISITS] = 0; | ||
} | ||
} | ||
} |
Oops, something went wrong.