0👍
✅
A friend helped me find a solution…
teams() {
return this.trackers.reduce((teams, tracker) => {
if (teams.find(team => team.info.team_id === tracker.team.info.team_id) === undefined) {
teams.push(tracker.team);
} else {
let index = teams.findIndex(team => team.info.team_id === tracker.team.info.team_id);
if (tracker.team.tracker.timestamp > teams[index].tracker.timestamp) {
teams[index] = tracker.team;
}
}
teams.sort(function(a, b){
return a.tracker.diff-b.tracker.diff
})
return teams;
}, []);
}
Source:stackexchange.com