From 3f828210e11cf05b8929a21e6c0a9899b874bc62 Mon Sep 17 00:00:00 2001
From: Remi  PLANEL <rplanel@pasteur.fr>
Date: Wed, 20 Dec 2023 15:38:51 +0100
Subject: [PATCH] correct toSystemName

---
 components/content/StructureDb.vue | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/components/content/StructureDb.vue b/components/content/StructureDb.vue
index 6fc5a9c8..34e66936 100644
--- a/components/content/StructureDb.vue
+++ b/components/content/StructureDb.vue
@@ -5,7 +5,7 @@ import type { SortItem } from "@/components/ServerDbTable.vue"
 import { ServerDbTable } from "#components"
 const sortBy: Ref<SortItem[]> = ref([{ key: 'system', order: "asc" }])
 const itemValue = ref("id");
-const facets: Ref<string[]> = ref(["system", "completed", "prediction_type", ])
+const facets: Ref<string[]> = ref(["system", "completed", "prediction_type",])
 const headers: Ref<Object[]> = ref([
     { title: 'Structure', key: 'structure', sortable: false, removable: false },
     { title: "Type", key: "system", removable: false },
@@ -56,7 +56,14 @@ function pdbNameToCif(pdbPath: string) {
 
 
 function toSystemName(rawName: string) {
-    return rawName.split(/_|-0/)[0].toLocaleLowerCase()
+    // split on -0 if exists else on _
+    if (rawName.includes("-0")) {
+
+        return rawName.split("-0")[0].toLocaleLowerCase()
+    } else {
+        return rawName.split("_")[0].toLocaleLowerCase()
+    }
+    
 
 }
 
-- 
GitLab