Skip to content

Commit

Permalink
Handle sorting manually vs. using lodash
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron Caldwell committed Oct 2, 2020
1 parent b9d75bd commit 523de58
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,12 @@ export function transformResults(
});
})
.orderBy(['entityName', 'dateInShape'], ['asc', 'desc'])
.sortedUniqBy('entityName')
.reduce((accu, el) => {
if (!accu.length || el.entityName !== accu[accu.length - 1].entityName) {
accu.push(el);
}
return accu;
}, [])
.value()
);
}
Expand Down Expand Up @@ -288,7 +293,12 @@ export const getGeoThresholdExecutor = ({ logger: log }: { logger: Logger }) =>
const prevLocationArr = _.chain(currLocationArr)
.concat(state.prevLocationArr)
.orderBy(['entityName', 'dateInShape'], ['asc', 'desc'])
.sortedUniqBy('entityName')
.reduce((accu, el) => {
if (!accu.length || el.entityName !== accu[accu.length - 1].entityName) {
accu.push(el);
}
return accu;
}, [])
.value();

return {
Expand Down

0 comments on commit 523de58

Please sign in to comment.