plan editor fix

This commit is contained in:
Diamantis Tziotzios 2024-07-11 10:05:40 +03:00
parent cea2911e8b
commit 0ac77b6fa9
1 changed files with 2 additions and 1 deletions

View File

@ -47,6 +47,7 @@ export class PlanEditorModel extends BaseEditorModel implements PlanPersist {
item.blueprint.definition.sections.forEach(section => {
if (section.hasTemplates) {
const isNew = (item.id == null);
const sectionTemplatesFromPlan = item.planDescriptionTemplates?.filter(x => x.sectionId == section.id && x.isActive == IsActive.Active) || [];
if (sectionTemplatesFromPlan.length > 0) {
@ -57,7 +58,7 @@ export class PlanEditorModel extends BaseEditorModel implements PlanPersist {
descriptionTemplateGroupId: planDescriptionTemplate?.descriptionTemplateGroupId,
}));
});
} else if (section.descriptionTemplates?.length > 0) {
} else if (section.descriptionTemplates?.length > 0 && isNew) {
section.descriptionTemplates.forEach(blueprintDefinedDescriptionTemplate => {
this.descriptionTemplates.push(new PlanDescriptionTemplateEditorModel(this.validationErrorModel).fromModel(
{