Skip to content

Commit a2be6b4

Browse files
committed
Update ROR API scheme
1 parent fba786f commit a2be6b4

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

app/views/registers/_editorial_checks.html.erb

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,9 @@
146146
if (r["family-names"] != $("#user-" + user + "-family").val()) {
147147
$("#user-" + user + "-family-orcid").addClass("text-danger");
148148
}
149+
if (!r["institution-name"].include($("#user-" + user + "-affiliation").val())) {
150+
$("#user-" + user + "-affiliation-orcid").addClass("text-danger");
151+
}
149152
}
150153
submit.removeClass("disabled");
151154
}
@@ -199,16 +202,19 @@
199202
success: function(data) {
200203
if(data["id"]) {
201204
var r = data;
202-
var tag = " <span class=text-muted>(from ROR)</span>"
205+
var names = r["names"].map((x) => x["value"]);
206+
var tag = " <span class=text-muted>(from ROR)</span>";
203207

204208
// Report results
205-
$("#user-" + user + "-affiliation-ror").html(r["name"] + tag);
209+
$("#user-" + user + "-affiliation-ror").html(names.join(", ") + tag);
206210

207211
// Highlight inconsistencies
208-
if (r["name"] != $("#user-" + user + "-affiliation").val()) {
212+
if (!names.include($("#user-" + user + "-affiliation").val())) {
209213
$("#user-" + user + "-affiliation-ror").addClass("text-danger");
210214
}
211-
if (r["id"] != "https://ror.org/" + $("#user-" + user + "-affiliation_ror").val()) {
215+
var ror_url = "https://ror.org/" +
216+
$("#user-" + user + "-affiliation_ror").val();
217+
if (r["id"] != ror_url) {
212218
$("#user-" + user + "-affiliation_ror-ror").html(r["id"] + tag);
213219
$("#user-" + user + "-affiliation_ror-ror").addClass("text-danger");
214220
}

0 commit comments

Comments
 (0)