From 6d0804b6157f343cdcb759bacba8476f20b633ca Mon Sep 17 00:00:00 2001 From: ke4tch Date: Fri, 22 May 2026 12:33:29 -0400 Subject: [PATCH] Support Research Status --- lib/biocheck-api/README.md | 12 +++++++ lib/biocheck-api/src/BioCheckPerson.js | 48 ++++++++++++++++++++++++++ lib/biocheck-api/src/SourceRules.js | 4 +-- 3 files changed, 61 insertions(+), 3 deletions(-) diff --git a/lib/biocheck-api/README.md b/lib/biocheck-api/README.md index 531b9ace..cb677682 100644 --- a/lib/biocheck-api/README.md +++ b/lib/biocheck-api/README.md @@ -175,6 +175,18 @@ Get the privacy as a string to be displayed to the user Returns **[String][8]** privacy string (i.e., the color) +### getResearchStatus + +Get the research status + +Returns **[Number][9]** numeric research status + +### getResearchStatusString + +Get the research status as a string to be displayed to the user + +Returns **[String][8]** research status string + ### isUncheckedDueToPrivacy Was profile not checked due to privacy diff --git a/lib/biocheck-api/src/BioCheckPerson.js b/lib/biocheck-api/src/BioCheckPerson.js index 2a0d5803..e1cd0795 100644 --- a/lib/biocheck-api/src/BioCheckPerson.js +++ b/lib/biocheck-api/src/BioCheckPerson.js @@ -65,6 +65,7 @@ export class BioCheckPerson { bio: "", hasName: false, privacyLevel: 0, + researchStatus: 0, isMember: false, isOrphan: false, hasLocation: false, @@ -188,6 +189,12 @@ export class BioCheckPerson { this.person.motherDnaConfirmed = true; } } + + // Populate researchStatus from returned value + if (profileObj.ResearchStatus != null) { + this.person.researchStatus = profileObj.ResearchStatus; + } + // can use if logged in user is the same as Manager if (this.person.privacyLevel < BioCheckPerson.MIN_PRIVACY) { if (userId === 0) { @@ -403,6 +410,45 @@ export class BioCheckPerson { } return privacyString; } + /** + * Get the research status + * @returns {Number} numeric research status + */ + getResearchStatus() { + return this.person.researchStatus; + } + /** + * Get the research status as a string to be displayed to the user + * @returns {String} research status string + */ + getResearchStatusString() { + let researchString = ""; + switch (this.person.researchStatus) { + case 0: + researchString = " "; // No status + break; + case 10: // Unfinished + researchString = "Unfinished"; + break; + case 20: // Help Requested + researchString = "Help Requested"; + break; + case 30: // Sources to Review + researchString = "Sources to Review"; + break; + case 40: // Silver Standard + researchString = "Silver Research"; + break; + case 50: // Gold Standard Candidate + researchString = "Pending Review"; + break; + case 60: // Gold Standard: Genealogically Complete and Peer Reviewed + researchString = "Peer Reviewed "; + break; + } + return researchString; + } + /** * Was profile not checked due to privacy * @returns {Boolean} true if profile could not be checked due to privacy @@ -511,6 +557,8 @@ export class BioCheckPerson { if (emailElements.length > 0) { this.person.isMember = true; } + + // TODO set researchStatus } /* diff --git a/lib/biocheck-api/src/SourceRules.js b/lib/biocheck-api/src/SourceRules.js index a30c0620..3212b4f3 100644 --- a/lib/biocheck-api/src/SourceRules.js +++ b/lib/biocheck-api/src/SourceRules.js @@ -1001,9 +1001,7 @@ class SourceRules { projectBox.status = templates[i].status.toLowerCase().trim(); this.#projectBox.push(projectBox); } - // TODO hack that Notability may be set to the wrong type - if ((templates[i].type.toLowerCase().trim() === 'formatting') || - (templates[i].type.toLowerCase().trim() === 'formattingtemplate')) { + if (templates[i].type.toLowerCase().trim() === 'formattingtemplate') { let formattingTemplate = { name: "", status: "",