From 55f65576f0f8df93dd313a4d5c2ebcd80afd4911 Mon Sep 17 00:00:00 2001 From: Sean Date: Thu, 18 Jun 2020 15:51:51 +0200 Subject: [PATCH] Allow to import the same topic multiple times Remove checking for duplicated topic names. Allows to import topics more than once, usefull if you have to import an agenda over and over again. --- .../src/app/core/ui-services/base-import.service.ts | 2 +- .../app/site/topics/services/topic-import.service.ts | 11 ----------- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/client/src/app/core/ui-services/base-import.service.ts b/client/src/app/core/ui-services/base-import.service.ts index 5ef1a9791..20185e64b 100644 --- a/client/src/app/core/ui-services/base-import.service.ts +++ b/client/src/app/core/ui-services/base-import.service.ts @@ -26,7 +26,7 @@ export interface NewEntry { newEntry: V; status: CsvImportStatus; errors: string[]; - hasDuplicates: boolean; + hasDuplicates?: boolean; importTrackId?: number; } diff --git a/client/src/app/site/topics/services/topic-import.service.ts b/client/src/app/site/topics/services/topic-import.service.ts index a0cc672c8..659d358b3 100644 --- a/client/src/app/site/topics/services/topic-import.service.ts +++ b/client/src/app/site/topics/services/topic-import.service.ts @@ -30,7 +30,6 @@ export class TopicImportService extends BaseImportService { */ public errorList = { NoTitle: 'A Topic needs a title', - Duplicates: 'A topic with this title already exists', ParsingErrors: 'Some csv values could not be read correctly.' }; @@ -99,7 +98,6 @@ export class TopicImportService extends BaseImportService { newEntry[this.expectedHeader[idx]] = line[idx]; } } - const hasDuplicates = this.repo.getViewModelList().some(topic => topic.title === newEntry.title); // set type to 'public' if none is given in import if (!newEntry.agenda_type) { @@ -107,13 +105,9 @@ export class TopicImportService extends BaseImportService { } const mappedEntry: NewEntry = { newEntry: newEntry, - hasDuplicates: hasDuplicates, status: 'new', errors: [] }; - if (hasDuplicates) { - this.setError(mappedEntry, 'Duplicates'); - } if (hasErrors) { this.setError(mappedEntry, 'ParsingErrors'); } @@ -196,16 +190,11 @@ export class TopicImportService extends BaseImportService { agenda_type: 1 // set type to 'public item' by default }) ); - const hasDuplicates = this.repo.getViewModelList().some(topic => topic.title === newTopic.title); const newEntry: NewEntry = { newEntry: newTopic, - hasDuplicates: hasDuplicates, status: 'new', errors: [] }; - if (hasDuplicates) { - this.setError(newEntry, 'Duplicates'); - } newEntries.push(newEntry); }); this.setParsedEntries(newEntries);