Skip to content

Commit

Permalink
555 feednotificationcampaign (#558)
Browse files Browse the repository at this point in the history
* wip add space for start date in notification

* add the views stats
  • Loading branch information
hichri-louay authored Sep 25, 2023
1 parent 84ef181 commit 7c60ae5
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions src/app/notifications/notification.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -983,16 +983,16 @@ closeModal(content: any) {
// Construct the result string
let result = '';
if (years > 0) {
result += `${years} y `;
result += `${years}y `;
}
if (months > 0) {
result += `${months} m `;
result += `${months}m `;
}
if (days > 0) {
result += `${days} d `;
result += `${days}d `;
}
if (remainingHours > 0) {
result += `${remainingHours} h`;
result += `${remainingHours}h`;
}

return result.trim();
Expand Down Expand Up @@ -1043,7 +1043,8 @@ closeModal(content: any) {
return token.name.startsWith('SATT') ? 'SaTT' : token.name
}
getStatistics(hash:string) {
this.campaignService.getStatisticsCampaign(hash)

return this.campaignService.getStatisticsCampaign(hash)
.pipe(
map((response: any) => {
if (response.message === 'success' && response.code === 200) {
Expand All @@ -1052,16 +1053,8 @@ closeModal(content: any) {
}
}),

)
.subscribe((data: any) => {
let sumOfViews = 0;
for (const platform in data) {
if (data.hasOwnProperty(platform)) {
sumOfViews += data[platform].views;
}
}
return sumOfViews;
});
);

}
getRetrieveBudget(cmp:any) {
return parseFloat(cmp.cost) / 10 **18
Expand Down Expand Up @@ -1181,7 +1174,13 @@ closeModal(content: any) {
}
switchFunction(item: any) {
if(item.type === 'create_campaign') {
item.label.views = this.getStatistics(item.label.cmp_update.hash)
this.getStatistics(item.label.cmp_update.hash).subscribe((data: any) => {
let sumOfViews = 0;
for (const platform in data) {
sumOfViews += data[platform].views;
}
item.label.views = sumOfViews;
});
}
if(item.type === 'cmp_candidate_reject_link') item.label.showReason = false
const etherInWei = new Big(1000000000000000000);
Expand Down

0 comments on commit 7c60ae5

Please sign in to comment.