Skip to content

Commit 9f02471

Browse files
committed
fix(Ingest): Long running tasks for e.g. donations was throwing an error under specific conditions.
1 parent 61d847b commit 9f02471

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

app/Console/Commands/IngestData.php

+9-4
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function __construct(BlockTimeService $blockTimeService, MetabaseService
6868
$this->blockTimeService = $blockTimeService;
6969
$this->metabaseService = $metabaseService;
7070

71-
$this->fromDate = now()->subDays(30)->timestamp;
71+
$this->fromDate = now()->subDays(365)->timestamp;
7272
$this->toDate = now()->addDays(60)->timestamp;
7373

7474
$this->notificationService = $notificationService;
@@ -117,9 +117,9 @@ private function shortRunningTasks(DirectoryParser $directoryParser)
117117
*/
118118
private function longRunningTasks()
119119
{
120+
// Loop through all the chains and update project owners
120121
$this->processAll(false);
121122

122-
123123
// Loop through all the chains and update project owners
124124
$chains = Chain::all();
125125
foreach ($chains as $chain) {
@@ -301,8 +301,13 @@ private function updateApplicationFunding(RoundApplication $application)
301301

302302
$donorAmountUSD = $this->metabaseService->getDonorAmountUSD($round->round_addr, $application->application_id);
303303
$application->donor_amount_usd = $donorAmountUSD;
304-
$application->donor_contributions_count = $metabase['contributionsCount'];
305-
$application->match_amount_usd = $metabase['matchAmountUSD'];
304+
305+
if (isset($metabase['matchAmountUSD'])) {
306+
$application->match_amount_usd = $metabase['matchAmountUSD'];
307+
}
308+
if (isset($metabase['contributionsCount'])) {
309+
$application->donor_contributions_count = $metabase['contributionsCount'];
310+
}
306311
$application->save();
307312

308313
$this->info("Successfully updated application id: {$application->id}");

0 commit comments

Comments
 (0)