Skip to content

Commit

Permalink
feat(openalex): Enhance ROR addition logic to prevent duplicates in a…
Browse files Browse the repository at this point in the history
…ddList and rors
  • Loading branch information
jerem1508 committed Nov 27, 2024
1 parent f1d8162 commit aafd542
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion client/src/pages/openalex-ror/results/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,10 @@ export default function Affiliations() {

const addRor = () => {
const updatedAffiliations = affiliations.map((affiliation) => {
if (affiliation.selected && !affiliation.addList.some((item) => item.rorId === cleanRor.rorId)) {
if (affiliation.selected
&& !affiliation.addList.some((item) => item.rorId === cleanRor.rorId)
&& !affiliation.rors.some((item) => item.rorId === cleanRor.rorId)
) {
return {
...affiliation,
addList: [...affiliation.addList, cleanRor],
Expand Down

0 comments on commit aafd542

Please sign in to comment.