Skip to content

Commit

Permalink
[PLA-1440] Return empty object (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
enjinabner authored Nov 23, 2023
1 parent f5fe526 commit 42c6995
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Support/ClaimProbabilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
use Illuminate\Support\Arr;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Cache;
use stdClass;

class ClaimProbabilities
{
use IntegerRange;

public const FORMAT_VERSION = 'v1';
public const FORMAT_VERSION = 'v2';

/**
* Create or update the probabilities for a claim.
Expand Down Expand Up @@ -125,10 +126,10 @@ public function computeProbabilities(string $code, array $fts, array $nfts): voi
}

$probabilities = [
'ft' => collect($fts)->mapWithKeys(fn ($quantity, $key) => [$key => ($quantity / $total) * 100])->toArray(),
'ft' => collect($fts)->mapWithKeys(fn ($quantity, $key) => [$key => ($quantity / $total) * 100])->toArray() ?: new stdClass(),
'nft' => ($totalNft / $total) * 100,
'ftTokenIds' => $this->extractTokenIds($fts, $total),
'nftTokenIds' => $this->extractTokenIds($nfts, $total),
'ftTokenIds' => $this->extractTokenIds($fts, $total) ?: new stdClass(),
'nftTokenIds' => $this->extractTokenIds($nfts, $total) ?: new stdClass(),
];

$data = [
Expand Down

0 comments on commit 42c6995

Please sign in to comment.