Skip to content

Commit

Permalink
sorting ad pools (#601)
Browse files Browse the repository at this point in the history
  • Loading branch information
hichri-louay authored Oct 5, 2023
1 parent 2454242 commit b4ac1c9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/app/campaigns/ad-pools/ad-pools.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ export class AdPoolsComponent implements OnInit, OnDestroy {

const draftsArray = newCampaigns.filter((element: Campaign) => element.type === "draft");
const applyCampaigns = newCampaigns.filter((element: Campaign) => element.type === 'apply');
const campaignsArray = newCampaigns.filter((element: Campaign) => element.type != "draft" && element.type != 'apply');
const campaignsPendingFinished = newCampaigns.filter((element: Campaign) => element.type != "draft" && element.type != 'apply');
draftsArray.sort((a: any, b: any) => {
return <any>new Date(b.createdAt) - <any>new Date(a.createdAt);
});
Expand All @@ -223,7 +223,9 @@ export class AdPoolsComponent implements OnInit, OnDestroy {


})
const newCampaignsArray = concat(draftsArray, applyCampaigns, campaignsArray);
const draftsAndApplyElements = concat(draftsArray, applyCampaigns);

const newCampaignsArray = concat(draftsAndApplyElements, campaignsPendingFinished);
this.campaignsList = newCampaignsArray;
this.campaignsList2 = newCampaignsArray;
console.log({newCampaignsArray})
Expand Down

0 comments on commit b4ac1c9

Please sign in to comment.