Skip to content

Commit

Permalink
Bounty num (#542)
Browse files Browse the repository at this point in the history
handle null bounty value
  • Loading branch information
HamdiBenK authored Sep 19, 2023
1 parent d0ae6eb commit ae87f67
Showing 1 changed file with 21 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ enum EOraclesID {
'instagram',
'twitter',
'linkedin',
'tiktok'
'tiktok',
'threads'
}
@Component({
selector: 'app-password-modal',
Expand Down Expand Up @@ -113,13 +114,6 @@ export class PasswordModalComponent implements OnInit {
this.passwordForm = this._formBuilder.group({
password: ['', Validators.required]
});

// if (!this.campaign.id) {
// this.route.queryParams.subscribe((params: any) => {
// this.router.navigate(["home/campaign", params["id"], "edit"]);
// console.log(params["id"]);
// });
// }
this.parentFunction().subscribe();
if(!!this.campaign) this.network = this.campaign.currency.type;

Expand Down Expand Up @@ -578,7 +572,7 @@ let dateInSeconds = Math.floor(date.getTime() / 1000);
// Convert the start date to Unix timestamp
// const startDateUnix = Math.floor(campaign_info.startDate.getTime() / 1000);
// campaign_info.startDate = startDateUnix;

console.log(campaign_info.startDate)
if (campaign_info.currency === 'BNB') {
campaign_info.tokenAddress = null;
}
Expand Down Expand Up @@ -734,22 +728,26 @@ let dateInSeconds = Math.floor(date.getTime() / 1000);
}

handleBounties() {
let array: any[] = [];
if (!!this.campaign) {
this.campaign.bounties.forEach((bounty: any) => {
bounty.categories.forEach((category: any) => {
array.push(
category.minFollowers,
category.maxFollowers,
this.eOraclesID[bounty.oracle],
category.reward
);
});
});
if (!this.campaign) {
return [];
}

return array;

const bountyData: any[] = [];

for (const bounty of this.campaign.bounties) {
for (const category of bounty.categories) {
bountyData.push(
category.minFollowers,
category.maxFollowers,
this.eOraclesID[bounty.oracle],
category.reward
);
}
}

return bountyData;
}

ngOnDestroy(): void {
this.isDestroyed.next('');
this.isDestroyed.unsubscribe();
Expand Down

0 comments on commit ae87f67

Please sign in to comment.