Piwik - Archiver.php: Archiving data for future days -


i'm developing new plugin, archiver.php has these functions:

class archiver extends \piwik\plugin\archiver {     const readings_record_name = "readings_archive_record";     const readings_field = "page_id";      public function aggregatedayreport(){         $data = array(           array("label" => "primer artículo", "visits" => "1", "readings" => "0"),           array("label" => "segundo artículo", "visits" => "2", "readings" => "0"),           array("label" => "tercer artículo", "visits" => "3", "readings" => "1")         );          $datatable = new datatable();         $datatable->addrowsfromsimplearray($data);         $serializeddatatable = $datatable->getserialized();          $archiveprocessor = $this->getprocessor();         $archiveprocessor->insertblobrecord(self::readings_record_name, $serializeddatatable);     }      public function aggregatemultiplereports() {         $archiveprocessor = $this->getprocessor();         $archiveprocessor->aggregatedatatablerecords(self::readings_record_name);     } } 

the first function supposed create daily record using $data variable. , second function should sum these records created in previous function , create new records different periods (week, month, year, date range).

today 2017-04-07 , when call api method:

public function getlecturas($segment = false) {     $archive = archive::build($idsite, $period, $date, $segment);     $datatable = $archive->getdatatable(archiver::readings_record_name);     return $datatable; } 

...using date=2017-04-07&period=day, works fine, expected result (the $data array aggregatedayreport function), when call api method these dates: 2017-04-08 , 2017-04-09, returns same $data array. not happen when consult other dates, 2 next days. , in piwik_archive_blob_2017_04 table see these registers created:

  • 902 / readings_archive_record / 1 / 2017-04-07 / 2017-04-07 / 1 / 2017-04-07 10:25:00 / [blob - 137 b]
  • 901 / readings_archive_record / 1 / 2017-04-09 / 2017-04-09 / 1 / 2017-04-07 10:22:42 / [blob - 137 b]
  • 900 / readings_archive_record / 1 / 2017-04-08 / 2017-04-08 / 1 / 2017-04-07 10:22:42 / [blob - 137 b]
  • 899 / readings_archive_record / 1 / 2017-04-03 / 2017-04-09 / 2 / 2017-04-07 10:22:45 / [blob - 135 b]
  • 898 / readings_archive_record / 1 / 2017-04-07 / 2017-04-07 / 1 / 2017-04-07 10:21:23 / [blob - 137 b]

why being recorded registers future dates? understand when select period=week/month/year/daterange happens, daily records future dates? please, me. reports showing wrong data because of this.


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -