diff options
author | diosmosis <diosmosis@users.noreply.github.com> | 2020-01-03 05:30:23 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-03 05:30:23 +0300 |
commit | 3f760fec68332962b3647167df18317fc759482d (patch) | |
tree | 64c1991fb81590a7aa12bf7f5843416e191b227d /core | |
parent | 7a371a057a46f4fc0ec3ead1c4c9b394aa542a40 (diff) |
Compute row percentages in PHP before metrics are formatted to avoid percentage formatting WARNINGS. (#15304)
* Compute row percentages in PHP before metrics are formatted to avoid percentage formatting WARNINGS.
* do not fail if site summary is not available
* Make sure siteSummary requests total data without segment.
* Make sure proper precision is used.
* try to fix tests
* update expected screenshots
Diffstat (limited to 'core')
-rw-r--r-- | core/Twig.php | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/core/Twig.php b/core/Twig.php index b8b92f283e..afb6a1cdc2 100644 --- a/core/Twig.php +++ b/core/Twig.php @@ -198,6 +198,7 @@ class Twig $this->addTest_false(); $this->addTest_true(); $this->addTest_emptyString(); + $this->addTest_isNumeric(); $this->twig->addExtension(new PiwikTwigFilterExtension()); } @@ -575,4 +576,15 @@ class Twig }); $this->twig->addFilter($safelink); } + + private function addTest_isNumeric() + { + $test = new Twig_SimpleTest( + 'numeric', + function ($value) { + return is_numeric($value); + } + ); + $this->twig->addTest($test); + } } |