Skip to content
Snippets Groups Projects
Commit e133a5b4 authored by Bogdan Cochior's avatar Bogdan Cochior
Browse files

Merge branch 'HIN-1072' into 'develop'

fix(helpers): When getting publons from the back-end, the array contains duplicate objects.

See merge request !120
parents 71a2a899 1417bc0b
No related branches found
No related tags found
1 merge request!120fix(helpers): When getting publons from the back-end, the array contains duplicate objects.
const { chain } = require('lodash')
module.exports = { module.exports = {
parseReviewers: ({ publonsReviewers, existingReviewers }) => parseReviewers: ({ publonsReviewers, existingReviewers }) =>
publonsReviewers chain(publonsReviewers)
.filter(rev => rev.profileUrl && rev.contact.emails.length > 0) .filter(rev => rev.profileUrl && rev.contact.emails.length > 0)
.filter( .filter(
rev => rev =>
...@@ -14,5 +16,7 @@ module.exports = { ...@@ -14,5 +16,7 @@ module.exports = {
profileUrl: reviewer.profileUrl, profileUrl: reviewer.profileUrl,
reviews: reviewer.numVerifiedReviews, reviews: reviewer.numVerifiedReviews,
affiliation: reviewer.recentOrganizations[0].name, affiliation: reviewer.recentOrganizations[0].name,
})), }))
.uniqBy('email')
.value(),
} }
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