Skip to content

Commit

Permalink
Merge pull request #4033 from cisagov/bug/autoLoadSupp-nulling-out
Browse files Browse the repository at this point in the history
fixed bug where autoLoadSupp nulls out
  • Loading branch information
inlguy authored Aug 28, 2024
2 parents aa4e4a1 + dbe39e8 commit 343c5fb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down
17 changes: 13 additions & 4 deletions CSETWebNg/src/app/services/questions.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 343c5fb

Please sign in to comment.