-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MEM-566 ETL - Remove duplicate External Links (MMTI Project Pages) #135
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general logic is correct, however I think we'd be better suited to not reinvent the wheel and leverage _.uniqBy
var mongodb = require('mongodb'); | ||
var Promise = require('promise'); | ||
var _ = require('lodash'); | ||
var uniqueBy = require('./utils').uniqueBy; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While correct, is not necessary due to the require of lodash. Lodash has a method _.uniqBy that achieves the same result as the code in the utils file.
console.log(': found ' + originalLinkCount + ' external links'); | ||
|
||
// filter out duplicate links | ||
var links = uniqueBy(mmtiProject.externalLinks, 'link'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As noted above, you can replace this with lodash prototype _.uniqBy
* Cleanup `externalLinks` in Project model * Require Lodash v4.17.4 (for _.uniqBy)
063840f
to
187f0da
Compare
@marklise I've updated the PR. Please review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks!
No description provided.