Skip to content

Commit

Permalink
Merge pull request #37 from aMarcireau/update-all
Browse files Browse the repository at this point in the history
Update all
  • Loading branch information
Alexandre Marcireau authored Dec 8, 2017
2 parents 5b66280 + f3a4741 commit 29a8486
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion source/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Origami",
"version": "0.7.3",
"version": "0.7.4",
"main": "main.js",
"private": true,
"devDependencies": {
Expand Down
19 changes: 12 additions & 7 deletions source/reducers/publications.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,18 +231,23 @@ export default function publications(state = new Map(), action, appState) {
}
const newState = new Map(state);
for (const doi of updatableDois.values()) {
const publication = {
newState.set(doi, {
...newState.get(doi),
updated: action.timestamp,
bibtex: null,
};
citers: [],
});
}
const citers = new Set();
for (const publication of newState.values()) {
for (const citer of publication.citers) {
if (newState.get(citer).status !== PUBLICATION_STATUS_IN_COLLECTION) {
newState.delete(citer);
}
citers.add(citer);
}
}
for (const [doi, publication] of newState.entries()) {
if (publication.status === PUBLICATION_STATUS_DEFAULT && !citers.has(doi)) {
newState.delete(doi);
}
publication.citers = [];
newState.set(doi, publication);
}
return newState;
}
Expand Down

0 comments on commit 29a8486

Please sign in to comment.