From dbe39e8dde5ee7aa746cb3846a751e73e05b341a Mon Sep 17 00:00:00 2001 From: Matt Winston Date: Wed, 28 Aug 2024 10:59:50 -0400 Subject: [PATCH] fixed bug where autoLoadSupp nulls out --- .../question-extras.component.ts | 2 +- CSETWebNg/src/app/services/questions.service.ts | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/CSETWebNg/src/app/assessment/questions/question-extras/question-extras.component.ts b/CSETWebNg/src/app/assessment/questions/question-extras/question-extras.component.ts index efd5dd008e..e574970be1 100644 --- a/CSETWebNg/src/app/assessment/questions/question-extras/question-extras.component.ts +++ b/CSETWebNg/src/app/assessment/questions/question-extras/question-extras.component.ts @@ -639,7 +639,7 @@ export class QuestionExtrasComponent implements OnInit { // } autoLoadSupplemental() { - return this.questionsSvc.autoLoadSupplemental(this.assessSvc.assessment.maturityModel?.modelId); + return this.questionsSvc.autoLoadSupplemental(this.assessSvc.assessment.maturityModel); } /** diff --git a/CSETWebNg/src/app/services/questions.service.ts b/CSETWebNg/src/app/services/questions.service.ts index f454900e6b..8b9f2db035 100644 --- a/CSETWebNg/src/app/services/questions.service.ts +++ b/CSETWebNg/src/app/services/questions.service.ts @@ -134,23 +134,32 @@ export class QuestionsService { /** * Analyzes the current 'auto load supplemental' preference and the maturity model */ - autoLoadSupplemental(modelId?: number) { + autoLoadSupplemental(model?: any) { // first see if it should be forced on by configuration if (this.configSvc.config.supplementalAutoloadInitialValue) { return true; } // standards (modelid is null) - check the checkbox state - if (!modelId) { + if (!model) { return this.autoLoadSuppCheckboxState; } // check the model's configuration - const modelConfiguration = this.configSvc.config.moduleBehaviors.find(x => x.modelId == modelId); - if (modelConfiguration.autoLoadSupplemental ?? false) { + const modelConfiguration = this.configSvc.config.moduleBehaviors.find(x => x.modelId == model.modelId); + if (modelConfiguration != null && (modelConfiguration.autoLoadSupplemental ?? false)) { return true; } + else { + let modelConfigurationByModelName = this.configSvc.config.moduleBehaviors.find(x => x.moduleName == model.moduleName); + if (modelConfigurationByModelName != null && (modelConfiguration.autoLoadSupplemental ?? false)) { + return true; + } + } + + + return false; }