diff options
author | diosmosis <diosmosis@users.noreply.github.com> | 2019-03-13 03:13:57 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-13 03:13:57 +0300 |
commit | def74364a2d821d5dddaceece76c217547b99d14 (patch) | |
tree | cb6966a9ffec1a1b4c946d82ca0f91ec53c29b18 /plugins/Annotations | |
parent | e26f5e7a359e990b4c4d726de85839e8923619ab (diff) |
Couple assorted changes (#13935)
* Allow annotations API to accept multiple periods, so evolution graphs that use multiple periods work.
* Remove warning when rows_to_display viewdatatable config property is left at its default value.
* Allow individual cells in an html visualization to be styled (if the visualization is extended).
* Remove unneeded TODO.
* In series picker encode picked rows in case the labels have commas.
* Must decode the rows value as well (as it is not handled by API, must be done in plugin).
* Allow joins to specified through LogAggregator::queryConversionsByDimension().
* Add safety check to _idts processing: if visitor is unknown, ignore _idts value, since it is their first visit.
* In the tracker when searching by visitor ID, search through entire log_visit table instead of just in the last 30 mins.
* When tracking visitor days since first, do not round since this can result in inaccurate data when rounding up. Which can cause trouble when finding the start visit for a log.
* Allow HtmlTable descendants to add any html attributes to cells.
* Allow derived Visualizations to add custom parameters to API requests via a new RequestConfig method.
* Tweak to TODO.
* Add test for annotations API change & get to pass.
* Apply more review feedback
* Update INI config docs for window_look_back_for_visitor.
* Only copy visitor properties if action is part of an existing visit.
* Some more properties that should be copied over from known visitor even if new visit.
* Fixing some tests.
* update test
* Fix CustomEventsTest test failures.
* Fixing more tests.
* update rest of tests
* Fixing tests.
* Update some test files.
* Fix log statements.
* To better handle out of order actions, add part of last_action_time check to visitor ID search.
* Update tests.
* Updating expected screenshots.
* Fix ArchiveCronTest.
* Throw exception if idorder not unique.
* Only throw exception if idorder specified.
* Fixing a couple tests.
* Fix another test.
Diffstat (limited to 'plugins/Annotations')
3 files changed, 101 insertions, 12 deletions
diff --git a/plugins/Annotations/API.php b/plugins/Annotations/API.php index 136b4ececd..9889ff7349 100644 --- a/plugins/Annotations/API.php +++ b/plugins/Annotations/API.php @@ -320,21 +320,21 @@ class API extends \Piwik\Plugin\API return array(false, false); } - // if the range is just a normal period (or the period is a range in which case lastN is ignored) - if ($lastN === false - || $period == 'range' - ) { - if ($period == 'range') { - $oPeriod = new Range('day', $date); - } else { - $oPeriod = Period\Factory::build($period, Date::factory($date)); - } + $isMultiplePeriod = Range::isMultiplePeriod($date, $period); + // if the range is just a normal period (or the period is a range in which case lastN is ignored) + if ($period == 'range') { + $oPeriod = new Range('day', $date); + $startDate = $oPeriod->getDateStart(); + $endDate = $oPeriod->getDateEnd(); + } else if ($lastN == false && !$isMultiplePeriod) { + $oPeriod = Period\Factory::build($period, Date::factory($date)); $startDate = $oPeriod->getDateStart(); $endDate = $oPeriod->getDateEnd(); - } else // if the range includes the last N periods - { - list($date, $lastN) = EvolutionViz::getDateRangeAndLastN($period, $date, $lastN); + } else { // if the range includes the last N periods or is a multiple period + if (!$isMultiplePeriod) { + list($date, $lastN) = EvolutionViz::getDateRangeAndLastN($period, $date, $lastN); + } list($startDate, $endDate) = explode(',', $date); $startDate = Date::factory($startDate); diff --git a/plugins/Annotations/tests/System/AnnotationsTest.php b/plugins/Annotations/tests/System/AnnotationsTest.php index d385d33426..ef0a477e89 100644 --- a/plugins/Annotations/tests/System/AnnotationsTest.php +++ b/plugins/Annotations/tests/System/AnnotationsTest.php @@ -52,6 +52,10 @@ class AnnotationsTest extends SystemTestCase 'otherRequestParameters' => array('lastN' => 6), 'testSuffix' => '_lastN')), array('Annotations.getAll', array('idSite' => $idSite1, + 'date' => '2012-01-26,2012-03-01', + 'periods' => array('week'), + 'testSuffix' => '_multiplePeriod')), + array('Annotations.getAll', array('idSite' => $idSite1, 'date' => '2012-01-15,2012-02-15', 'periods' => array('range'), 'otherRequestParameters' => array('lastN' => 6), diff --git a/plugins/Annotations/tests/System/expected/test_annotations_multiplePeriod__Annotations.getAll_week.xml b/plugins/Annotations/tests/System/expected/test_annotations_multiplePeriod__Annotations.getAll_week.xml new file mode 100644 index 0000000000..d3aecc147b --- /dev/null +++ b/plugins/Annotations/tests/System/expected/test_annotations_multiplePeriod__Annotations.getAll_week.xml @@ -0,0 +1,85 @@ +<?xml version="1.0" encoding="utf-8" ?> +<result> + <row key="1"> + <row> + <date>2012-01-26</date> + <note>16: Site 1 annotation for 2012-01-26</note> + <starred>0</starred> + <user>superUserLogin</user> + <idNote>16</idNote> + <canEditOrDelete>1</canEditOrDelete> + </row> + <row> + <date>2012-01-27</date> + <note>17: Site 1 annotation for 2012-01-27</note> + <starred>0</starred> + <user>superUserLogin</user> + <idNote>17</idNote> + <canEditOrDelete>1</canEditOrDelete> + </row> + <row> + <date>2012-02-02</date> + <note>18: Site 1 annotation for 2012-02-02</note> + <starred>1</starred> + <user>superUserLogin</user> + <idNote>18</idNote> + <canEditOrDelete>1</canEditOrDelete> + </row> + <row> + <date>2012-02-03</date> + <note>19: Site 1 annotation for 2012-02-03</note> + <starred>0</starred> + <user>superUserLogin</user> + <idNote>19</idNote> + <canEditOrDelete>1</canEditOrDelete> + </row> + <row> + <date>2012-02-09</date> + <note>20: Site 1 annotation for 2012-02-09</note> + <starred>0</starred> + <user>superUserLogin</user> + <idNote>20</idNote> + <canEditOrDelete>1</canEditOrDelete> + </row> + <row> + <date>2012-02-10</date> + <note>21: Site 1 annotation for 2012-02-10</note> + <starred>1</starred> + <user>superUserLogin</user> + <idNote>21</idNote> + <canEditOrDelete>1</canEditOrDelete> + </row> + <row> + <date>2012-02-16</date> + <note>22: Site 1 annotation for 2012-02-16</note> + <starred>0</starred> + <user>superUserLogin</user> + <idNote>22</idNote> + <canEditOrDelete>1</canEditOrDelete> + </row> + <row> + <date>2012-02-17</date> + <note>23: Site 1 annotation for 2012-02-17</note> + <starred>0</starred> + <user>superUserLogin</user> + <idNote>23</idNote> + <canEditOrDelete>1</canEditOrDelete> + </row> + <row> + <date>2012-02-23</date> + <note>24: Site 1 annotation for 2012-02-23</note> + <starred>1</starred> + <user>superUserLogin</user> + <idNote>24</idNote> + <canEditOrDelete>1</canEditOrDelete> + </row> + <row> + <date>2012-02-24</date> + <note>25: Site 1 annotation for 2012-02-24</note> + <starred>0</starred> + <user>superUserLogin</user> + <idNote>25</idNote> + <canEditOrDelete>1</canEditOrDelete> + </row> + </row> +</result>
\ No newline at end of file |