RED-6910: fix adding causing deleting of current items.

This commit is contained in:
Dan Percic 2023-06-14 19:28:11 +03:00
parent 34f2e3102f
commit d288f9c7bc
2 changed files with 1 additions and 5 deletions

View File

@ -55,7 +55,6 @@ export class DictionaryScreenComponent implements OnInit {
null, null,
true, true,
DICTIONARY_TO_ENTRY_TYPE_MAP[this.type], DICTIONARY_TO_ENTRY_TYPE_MAP[this.type],
false,
); );
await this._loadEntries(); await this._loadEntries();
} catch (e) { } catch (e) {

View File

@ -103,7 +103,6 @@ export class DictionaryService extends EntitiesService<IDictionary, Dictionary>
dossierId: string, dossierId: string,
showToast = true, showToast = true,
dictionaryEntryType = DictionaryEntryTypes.ENTRY, dictionaryEntryType = DictionaryEntryTypes.ENTRY,
removeCurrent = true,
) { ) {
const entriesToAdd: Array<string> = []; const entriesToAdd: Array<string> = [];
const initialEntriesSet = new Set(initialEntries); const initialEntriesSet = new Set(initialEntries);
@ -136,7 +135,7 @@ export class DictionaryService extends EntitiesService<IDictionary, Dictionary>
await this._deleteEntries(deletedEntries, dossierTemplateId, type, dictionaryEntryType, dossierId); await this._deleteEntries(deletedEntries, dossierTemplateId, type, dictionaryEntryType, dossierId);
} }
if (entriesToAdd.length) { if (entriesToAdd.length) {
await this._addEntries(entriesToAdd, dossierTemplateId, type, dictionaryEntryType, dossierId, removeCurrent); await this._addEntries(entriesToAdd, dossierTemplateId, type, dictionaryEntryType, dossierId);
} }
if (showToast) { if (showToast) {
@ -258,12 +257,10 @@ export class DictionaryService extends EntitiesService<IDictionary, Dictionary>
type: string, type: string,
dictionaryEntryType: DictionaryEntryType, dictionaryEntryType: DictionaryEntryType,
dossierId: string, dossierId: string,
removeCurrent = true,
) { ) {
const queryParams: List<QueryParam> = [ const queryParams: List<QueryParam> = [
{ key: 'dossierId', value: dossierId }, { key: 'dossierId', value: dossierId },
{ key: 'dictionaryEntryType', value: dictionaryEntryType }, { key: 'dictionaryEntryType', value: dictionaryEntryType },
{ key: 'removeCurrent', value: removeCurrent },
]; ];
const url = `${this._defaultModelPath}/${type}/${dossierTemplateId}`; const url = `${this._defaultModelPath}/${type}/${dossierTemplateId}`;
return firstValueFrom(this._post(entries, url, queryParams)); return firstValueFrom(this._post(entries, url, queryParams));