From 08746d6f1e38917bbd7a567785e2d16a934b157b Mon Sep 17 00:00:00 2001 From: Jacob Clark Date: Thu, 18 Jan 2024 16:12:30 -0800 Subject: [PATCH] fix: Fixed GM contributor modification + switching --- .../guided-mode/guided-curate-dataset.js | 24 +++++++++++-------- .../src/scripts/others/contributor-storage.js | 8 +++---- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/renderer/src/scripts/guided-mode/guided-curate-dataset.js b/src/renderer/src/scripts/guided-mode/guided-curate-dataset.js index 192eb4a15..3466178f9 100644 --- a/src/renderer/src/scripts/guided-mode/guided-curate-dataset.js +++ b/src/renderer/src/scripts/guided-mode/guided-curate-dataset.js @@ -9216,8 +9216,12 @@ window.openGuidedEditContributorSwal = async (contibuttorOrcidToEdit) => { ); } + // If a contributor has already been marked as Principal Investigator, make sure that the + // current contributor is the one marked as Principal Investigator + // otherwise, show an error message if (contributorRoles.includes("PrincipalInvestigator")) { - if (getContributorMarkedAsPrincipalInvestigator()) { + const currentPIsOrcid = getContributorMarkedAsPrincipalInvestigator(); + if (currentPIsOrcid && currentPIsOrcid !== contributorOrcid) { return Swal.showValidationMessage( "Only one contributor can be marked as Principal Investigator" ); @@ -9278,7 +9282,7 @@ const handleAddContributorHeaderUI = () => { return !existingContributorORCiDs.includes(contributor.ORCiD); }); - // If no stored contribturs are found, use the default header + // If no stored contributors are found, use the default header if (locallyStoredContributorArray.length === 0) { return `