Commit 6b8bd745 authored by Magnus Westergaard's avatar Magnus Westergaard
Browse files

DEICH-5555: Use lodash for deduplication.

parent 42a69ae7
const routes = require("express").Router();
const fetch = require("isomorphic-unfetch");
const uniqBy = require("lodash/uniqBy");
const sparqlQueries = require("../utils/sparqlQueries");
const {
parseRDFtoJsonLD,
......@@ -581,11 +582,7 @@ const filterAndSortRecommendations = (
showDraftRecommendationById = null
) => {
const allRecommendations = pubRecommendations.concat(workRecommendations);
const recommendationsById = new Map();
allRecommendations.forEach(recommendation => {
recommendationsById.set(recommendation.id, recommendation);
});
const uniqueRecommendations = Array.from(recommendationsById.values());
const uniqueRecommendations = uniqBy(allRecommendations, "id");
if (showDraftRecommendationById) {
return uniqueRecommendations.filter(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment