new version ui small fix

This commit is contained in:
amentis 2024-05-29 09:40:07 +03:00
parent d7719d4299
commit 9edec938df
1 changed files with 2 additions and 2 deletions

View File

@ -34,14 +34,14 @@ export class DmpNewVersionDialogEditorModel implements NewVersionDmpPersist {
if (item.dmpDescriptionTemplates?.length > 0 && blueprint.id === item.blueprint.id) { if (item.dmpDescriptionTemplates?.length > 0 && blueprint.id === item.blueprint.id) {
item.descriptions.forEach(description => { item.descriptions.forEach(description => {
const matchingSection = item.dmpDescriptionTemplates.find(dmpDescriptionTemplate => dmpDescriptionTemplate.descriptionTemplateGroupId === description.descriptionTemplate.groupId); const matchingSection = item.dmpDescriptionTemplates.find(dmpDescriptionTemplate => dmpDescriptionTemplate.descriptionTemplateGroupId === description.descriptionTemplate.groupId) || null;
this.descriptions.push(new NewVersionDmpDescriptionEditorModel(this.validationErrorModel).fromModel(description.id, matchingSection != null ? matchingSection.sectionId : null)); this.descriptions.push(new NewVersionDmpDescriptionEditorModel(this.validationErrorModel).fromModel(description.id, matchingSection != null ? matchingSection.sectionId : null));
}) })
} else{ } else{
const selectedBlueprintSections = blueprint.definition?.sections?.filter(x => x.hasTemplates) || null; const selectedBlueprintSections = blueprint.definition?.sections?.filter(x => x.hasTemplates) || null;
if (selectedBlueprintSections != null){ if (selectedBlueprintSections != null){
item.descriptions.forEach(description => { item.descriptions.forEach(description => {
const matchingSection = selectedBlueprintSections.find(blueprintSection => blueprintSection.descriptionTemplates.map(y => y.descriptionTemplateGroupId).includes(description.descriptionTemplate.groupId)); const matchingSection = selectedBlueprintSections.find(blueprintSection => blueprintSection.descriptionTemplates != null && blueprintSection.descriptionTemplates.map(y => y.descriptionTemplateGroupId).includes(description.descriptionTemplate.groupId)) || null;
this.descriptions.push(new NewVersionDmpDescriptionEditorModel(this.validationErrorModel).fromModel(description.id, matchingSection != null ? matchingSection.id : null)); this.descriptions.push(new NewVersionDmpDescriptionEditorModel(this.validationErrorModel).fromModel(description.id, matchingSection != null ? matchingSection.id : null));
}) })
} }