From 6cb4963cdd0f4848be10dd8eab44639b7bc12e9c Mon Sep 17 00:00:00 2001 From: eric-intuitem <71850047+eric-intuitem@users.noreply.github.com> Date: Tue, 9 Apr 2024 13:46:16 +0200 Subject: [PATCH] Update +page.svelte --- .../[id=uuid]/+page.svelte | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/frontend/src/routes/(app)/requirement-assessments/[id=uuid]/+page.svelte b/frontend/src/routes/(app)/requirement-assessments/[id=uuid]/+page.svelte index 44095b514..7a46fa9cc 100644 --- a/frontend/src/routes/(app)/requirement-assessments/[id=uuid]/+page.svelte +++ b/frontend/src/routes/(app)/requirement-assessments/[id=uuid]/+page.svelte @@ -39,19 +39,12 @@ if (nextValue) window.location.href = nextValue; } - const child_pattern = (data.requirement.ref_id ? 2 : 0) + (data.requirement.name ? 1 : 0) - const child_title: string = - child_pattern == 3 ? `${data.requirement.ref_id} - ${data.requirement.name}` : - child_pattern == 2 ? data.requirement.ref_id : - child_pattern == 1 ? data.requirement.name : ''; - - const parent_pattern = data.parent ? ((data.parent.ref_id ? 2 : 0) + (data.parent.name ? 1 : 0)) : 0 - const parent_title: string = - parent_pattern == 3 ? `${data.parent.ref_id} - ${data.parent.name}` : - parent_pattern == 2 ? data.parent.ref_id : - parent_pattern == 1 ? data.parent.name : ''; - console.log("coucou", data.parent) - const title = parent_title + child_title; + function short_name(node): string { + return node ? (node.ref_id ? node.ref_id : node.name ? node.name : '') : ''; + } + const s1 = short_name(data.parent) + const s2 = short_name(data.requirement) + const title = s2 == '' ? s1 : s2; breadcrumbObject.set({ id: data.requirementAssessment.id, name: title ?? 'Requirement assessment',