Skip to content

Commit

Permalink
Fix wrong date displayed for historical visits comparison (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark-H committed Jul 12, 2015
1 parent 147b644 commit ab487dd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
1 change: 1 addition & 0 deletions core/components/bigbrother/docs/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Reload the page after installation to access the menu item under "Components"

- Fix wrong date displayed for historical visits comparison (#7)
- Fix issue with the first load of the widget not showing all results (#5)
- Fix assigning analytic profiles to specific users (#1)
- Fix access token being refreshed when not necessary (#3)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,27 +43,26 @@ public function process() {
if( !$this->ga->getReport($url) ){
return $this->failure( $this->ga->getOutput() );
}
$this->addSerie();
$this->addSerie(true);

$this->modx->cacheManager->set($cacheKey, $this->series, $this->ga->getOption('cache_timeout'));
return $this->success('Fetched data from Google', $this->series);
}

/**
* Set a serie for the current loaded report
* @return void
* @param bool $delayed
*/
public function addSerie(){
public function addSerie($delayed = false){
$serie = $row = array();
foreach( $this->ga->report["rows"] as $key => $value ){
// Convert date in javascript format
$date = strtotime( $value[0] ) * 1000;
if( empty( $serie ) ){
// Create entries for each requested metrics
$serie['begin'] = $date;
$labelDate = $this->ga->getDates('d M Y');
$labelDate = $this->ga->getDates('d M Y', $delayed);
$serie['name'] = strtoupper( $labelDate['begin'] .' - '.$labelDate['end'] );
//$serie['name'] = strtoupper( $this->formatDate($this->ga->report['query']['start-date'], 'd M Y') .' - '. $this->formatDate($this->ga->report['query']['end-date'], 'd M Y') );
$serie['data'] = array();
}
$row[] = $date;
Expand Down

0 comments on commit ab487dd

Please sign in to comment.