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

This commit is contained in:
George 2023-06-14 19:13:56 +03:00
parent 984708bac3
commit 532ee9fa06
2 changed files with 1 additions and 5 deletions

View File

@ -58,7 +58,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

@ -94,7 +94,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);
@ -127,7 +126,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) {
@ -235,12 +234,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));