edtechhub / zotero-edtechhub

https://github.com/edtechhub/zotero-edtechhub/projects/4
12 stars 3 forks source link

"Save Item ID" does not deduplicate entries #69

Closed bjohas closed 4 years ago

bjohas commented 4 years ago

"Save Item ID" does not deduplicate entries. With every "save item id" the string gets longer. This is because we split on ";" and then do not remove the " " at the start.

EdTechHub.ItemAlsoKnownAs:      10.5281/zenodo.3631750;   2129771:5EWDQDIA;   2405685:VM6NXYF3;   10.5281/zenodo.3631750;   10/ghgngk;   2339240:94ZP3EK4;  10/ghgngk;  2405685:VM6NXYF3;  2339240:94ZP3EK4; 10/ghgngk; 2405685:VM6NXYF3; 2339240:94ZP3EK4

Suggested solution:

if (EdTechHub.ItemAlsoKnownAs contains "; ") {
    array = EdTechHub.ItemAlsoKnownAs.split("; ");
} else {
    array = EdTechHub.ItemAlsoKnownAs.split(";");
};
var EdTechHub.ItemAlsoKnownAs.join("; ")
retorquere commented 4 years ago

propose:

if (EdTechHub.ItemAlsoKnownAs.includes('; ') {
    array = EdTechHub.ItemAlsoKnownAs.split(/; +/);
} else {
    array = EdTechHub.ItemAlsoKnownAs.split(";");
};
var EdTechHub.ItemAlsoKnownAs.sort().join("; ")
edtechbot commented 4 years ago

:robot: this is your friendly neighborhood build bot announcing test build 0.0.26.253 ("remove extra space from merge AKA then sort fixes #69")

Install in Zotero by downloading test build 0.0.26.253, opening the Zotero "Tools" menu, selecting "Add-ons", open the gear menu in the top right, and select "Install Add-on From File...".