Skip to content

Commit

Permalink
Merge pull request #87 from nteske/FilteringOutDuplicateEvents
Browse files Browse the repository at this point in the history
Duplicate Events Filter
  • Loading branch information
hariszupcevic authored Nov 26, 2020
2 parents ea728d2 + 16ddb19 commit 324dc08
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions widget/app.services.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,16 @@
for (var i = 0; i<results.length;i++) {
finalResults.events = finalResults.events.concat(results[i].data.events);
}
//duplicated events - filter
finalResults.events=finalResults.events.filter((v,i,a)=>a.findIndex(t=>(
t.UID === v.UID &&
t.SUMMARY === v.SUMMARY &&
t.LOCATION === v.LOCATION &&
t.startDate === v.startDate &&
t.endDate === v.endDate &&
t.DESCRIPTION === v.DESCRIPTION))===i);
//duplicated events - filter

deferred.resolve(finalResults);
console.log("end getFeedEvents: " + new Date());
});
Expand Down

0 comments on commit 324dc08

Please sign in to comment.