Skip to content

Commit

Permalink
Merge pull request #21 from TheDMSGroup/ENG-904-unable-to-pull-jan-21…
Browse files Browse the repository at this point in the history
…-snapchat

[ENG-904] unable to pull jan 21 snapchat
  • Loading branch information
Heath Dutton ☕ authored May 27, 2019
2 parents 98ff9e7 + 4e2a682 commit 33d5783
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Helper/SnapchatHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ public function pullData()
while ($date >= $this->getDateFrom()) {
/** @var AdAccount $account */
foreach ($accounts as $account) {
$isComplete = true;
$spend = 0;
$clicksTotal = 0;
$impressionsTotal = 0;
Expand All @@ -252,6 +253,9 @@ public function pullData()
$this->getDateTo()
) as $campaign) {
$adStats = $this->getCampaignStats($campaign->id, $since, $until);
if (empty($adStats)) {
$isComplete = false;
}
foreach ($adStats as $adStat) {
if (!$adStat) {
continue;
Expand Down Expand Up @@ -331,7 +335,7 @@ public function pullData()
$clicksTotal,
$impressionsTotal,
// @todo - Add validation for completion for Snapchat data sets.
true
$isComplete
);
}
$date->sub($oneDay);
Expand Down Expand Up @@ -483,6 +487,8 @@ private function getRequest(
$this->refreshToken();
sleep(self::$betweenOpSleep);
} else {
// We're not sure to handle this, nop.
$done = true;
sleep(self::$betweenOpSleep);
}
}
Expand Down

0 comments on commit 33d5783

Please sign in to comment.