Skip to content

Commit

Permalink
refs #57 destroy all tables but the insights tables
Browse files Browse the repository at this point in the history
  • Loading branch information
tsteur committed Mar 3, 2014
1 parent c2fbcfe commit cbe88c1
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions plugins/Insights/API.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,25 @@ public function getInsightsOverview($idSite, $period, $date)
'Referrers_getCampaigns',
'Referrers_getAll'
);

// post event to add other reports?
$reportTableIds = array();
$dataTableManager = DataTable\Manager::getInstance();

$tables = array();
foreach ($reports as $report) {
$tableId = DataTable\Manager::getInstance()->getMostRecentTableId();
$tables[] = $this->getInsightOverview($idSite, $period, $date, $report);
DataTable\Manager::getInstance()->deleteAll($tableId);
$firstTableId = $dataTableManager->getMostRecentTableId();
$table = $this->getInsightOverview($idSite, $period, $date, $report);
$reportTableIds[] = $table->getId();
$lastTableId = $dataTableManager->getMostRecentTableId();

for ($index = $firstTableId; $index < $lastTableId; $index++) {
if (!in_array($index, $reportTableIds)) {
DataTable\Manager::getInstance()->deleteTable($index);
}
}

$tables[] = $table;
}

$map = new DataTable\Map();
Expand Down

0 comments on commit cbe88c1

Please sign in to comment.