From 64948345c933e53593dee05c7483439f96d7f6a7 Mon Sep 17 00:00:00 2001 From: Karthik Date: Wed, 1 May 2024 17:55:17 -0400 Subject: [PATCH 1/2] Fix getting molecular profile ids from key --- src/pages/studyView/StudyViewUtils.tsx | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/pages/studyView/StudyViewUtils.tsx b/src/pages/studyView/StudyViewUtils.tsx index cb62d6c4e44..30ac1902341 100644 --- a/src/pages/studyView/StudyViewUtils.tsx +++ b/src/pages/studyView/StudyViewUtils.tsx @@ -883,16 +883,10 @@ function startsWithSvChartType(chartType?: string) { } export function getMolecularProfileIdsFromUniqueKey(uniqueKey: string) { - const parts = uniqueKey.split(UNIQUE_KEY_SEPARATOR); - if (!startsWithSvChartType(parts[0])) { - return parts; - } else { - return _.map( - parts, - molecularProfileId => - molecularProfileId.split(CHART_TYPE_SEPARATOR)[1] - ); - } + return (startsWithSvChartType(uniqueKey) + ? uniqueKey.substring(uniqueKey.indexOf(CHART_TYPE_SEPARATOR) + 1) + : uniqueKey + ).split(UNIQUE_KEY_SEPARATOR); } export function getCurrentDate() { From 50333dec10c98f9601d5660346722ec7ca8c152e Mon Sep 17 00:00:00 2001 From: Karthik Date: Wed, 1 May 2024 21:37:32 -0400 Subject: [PATCH 2/2] Add comment --- src/pages/studyView/StudyViewUtils.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pages/studyView/StudyViewUtils.tsx b/src/pages/studyView/StudyViewUtils.tsx index 30ac1902341..cc2318113b2 100644 --- a/src/pages/studyView/StudyViewUtils.tsx +++ b/src/pages/studyView/StudyViewUtils.tsx @@ -883,6 +883,8 @@ function startsWithSvChartType(chartType?: string) { } export function getMolecularProfileIdsFromUniqueKey(uniqueKey: string) { + // chartType is added to the uniqueKey for structural variant charts. Example: 'structural_variants;study1_structural_variants:study2_structural_variants'. + // and for other charts, it is not added. Example: 'study1_mutations:study2_mutations'. return (startsWithSvChartType(uniqueKey) ? uniqueKey.substring(uniqueKey.indexOf(CHART_TYPE_SEPARATOR) + 1) : uniqueKey