From e755bbce3d1de95b7470731009b7b7073456c043 Mon Sep 17 00:00:00 2001 From: Georg Dangl Date: Tue, 23 Jul 2024 16:54:05 +0200 Subject: [PATCH] Add feature to update status for clashes when importing again --- .../components/bcf-file/bcf-file.component.ts | 20 ++++++++++++++++++- .../navisworks-clash-selection.component.html | 2 +- .../navisworks-clash-selection.component.ts | 2 +- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/ipa-bcfier-ui/src/app/components/bcf-file/bcf-file.component.ts b/src/ipa-bcfier-ui/src/app/components/bcf-file/bcf-file.component.ts index f2ce5d4..f7d1c14 100644 --- a/src/ipa-bcfier-ui/src/app/components/bcf-file/bcf-file.component.ts +++ b/src/ipa-bcfier-ui/src/app/components/bcf-file/bcf-file.component.ts @@ -278,7 +278,25 @@ export class BcfFileComponent { ); } - this.bcfFile.topics.push(...createdTopics); + // Now we're trying to change topics that we have already imported if their status + // has changed, so we don't import them again but just update their status + + const topicsToAdd: BcfTopic[] = []; + createdTopics.forEach((createdTopic) => { + // We'll check if it exists already, and if it does, we'll just update the status + var existingTopic = this.bcfFile.topics.find( + (existing) => + existing.serverAssignedId === + createdTopic.serverAssignedId + ); + if (existingTopic) { + existingTopic.topicStatus = createdTopic.topicStatus; + } else { + topicsToAdd.push(createdTopic); + } + }); + + this.bcfFile.topics.push(...topicsToAdd); this.filteredTopics = [...this.bcfFile.topics]; this.bcfFileAutomaticallySaveService.saveCurrentActiveBcfFileAutomatically(); diff --git a/src/ipa-bcfier-ui/src/app/components/navisworks-clash-selection/navisworks-clash-selection.component.html b/src/ipa-bcfier-ui/src/app/components/navisworks-clash-selection/navisworks-clash-selection.component.html index 2b7e899..0fa5f89 100644 --- a/src/ipa-bcfier-ui/src/app/components/navisworks-clash-selection/navisworks-clash-selection.component.html +++ b/src/ipa-bcfier-ui/src/app/components/navisworks-clash-selection/navisworks-clash-selection.component.html @@ -26,7 +26,7 @@

Select Clash Test

Only Import New Clashes diff --git a/src/ipa-bcfier-ui/src/app/components/navisworks-clash-selection/navisworks-clash-selection.component.ts b/src/ipa-bcfier-ui/src/app/components/navisworks-clash-selection/navisworks-clash-selection.component.ts index 7f26554..26d98b6 100644 --- a/src/ipa-bcfier-ui/src/app/components/navisworks-clash-selection/navisworks-clash-selection.component.ts +++ b/src/ipa-bcfier-ui/src/app/components/navisworks-clash-selection/navisworks-clash-selection.component.ts @@ -31,7 +31,7 @@ import { MatTooltipModule } from '@angular/material/tooltip'; export class NavisworksClashSelectionComponent { viewpointsClient = inject(ViewpointsClient); loadingService = inject(LoadingService); - onlyImportNew = true; + onlyImportNew = false; constructor( public dialogRef: MatDialogRef ) {