diff --git a/CSETWebApi/CSETWeb_Api/CSETWebCore.Business/Assessment/AssessmentBusiness.cs b/CSETWebApi/CSETWeb_Api/CSETWebCore.Business/Assessment/AssessmentBusiness.cs index 6f18b74fca..3c5fc2f8ea 100644 --- a/CSETWebApi/CSETWeb_Api/CSETWebCore.Business/Assessment/AssessmentBusiness.cs +++ b/CSETWebApi/CSETWeb_Api/CSETWebCore.Business/Assessment/AssessmentBusiness.cs @@ -524,7 +524,7 @@ join aa in _context.ASSESSMENTS on ii.Id equals aa.Assessment_Id if (assessment.BaselineAssessmentId != null) { var baseInfo = _context.INFORMATION.FirstOrDefault(x => x.Id == assessment.BaselineAssessmentId); - assessment.BaselineAssessmentName = baseInfo.Assessment_Name; + assessment.BaselineAssessmentName = baseInfo?.Assessment_Name; } diff --git a/CSETWebApi/CSETWeb_Api/CSETWebCore.Model/Maturity/MaturityResponse.cs b/CSETWebApi/CSETWeb_Api/CSETWebCore.Model/Maturity/MaturityResponse.cs index af156eb611..f3a54fd65f 100644 --- a/CSETWebApi/CSETWeb_Api/CSETWebCore.Model/Maturity/MaturityResponse.cs +++ b/CSETWebApi/CSETWeb_Api/CSETWebCore.Model/Maturity/MaturityResponse.cs @@ -20,6 +20,11 @@ public class MaturityResponse /// public string ModelName { get; set; } = ""; + /// + /// The ID of the grouping being returned. + /// + public int GroupingId { get; set; } + /// /// The name of the current grouping represented in the response; /// diff --git a/CSETWebApi/CSETWeb_Api/CSETWeb_ApiCore/Controllers/MaturityController.cs b/CSETWebApi/CSETWeb_Api/CSETWeb_ApiCore/Controllers/MaturityController.cs index f0c2fe0e2b..4aabde9152 100644 --- a/CSETWebApi/CSETWeb_Api/CSETWeb_ApiCore/Controllers/MaturityController.cs +++ b/CSETWebApi/CSETWeb_Api/CSETWeb_ApiCore/Controllers/MaturityController.cs @@ -383,6 +383,7 @@ public IActionResult GetGrouping([FromQuery] int groupingId) resp.AnswerOptions.ForEach(x => x = x.Trim()); } + resp.GroupingId = groupingId; resp.Title = grouping.Title; resp.Description = grouping.Description; resp.Description_Extended = grouping.Description_Extended; diff --git a/CSETWebNg/src/app/assessment/questions/maturity-questions/maturity-questions.component.html b/CSETWebNg/src/app/assessment/questions/maturity-questions/maturity-questions.component.html index f42a5c0c30..8f2c2ecc0b 100644 --- a/CSETWebNg/src/app/assessment/questions/maturity-questions/maturity-questions.component.html +++ b/CSETWebNg/src/app/assessment/questions/maturity-questions/maturity-questions.component.html @@ -53,7 +53,7 @@

{{ groupingTitle }}

-
diff --git a/CSETWebNg/src/app/assessment/questions/maturity-questions/maturity-questions.component.ts b/CSETWebNg/src/app/assessment/questions/maturity-questions/maturity-questions.component.ts index a17294d11d..a53d5e69c7 100644 --- a/CSETWebNg/src/app/assessment/questions/maturity-questions/maturity-questions.component.ts +++ b/CSETWebNg/src/app/assessment/questions/maturity-questions/maturity-questions.component.ts @@ -58,6 +58,7 @@ export class MaturityQuestionsComponent implements OnInit, AfterViewInit { groupingTitle: string = ''; questionsAlias: string = ''; showTargetLevel = false; // TODO: set this from a new column in the DB + modelSupportsTargetLevel = false; loaded = false; @@ -196,6 +197,9 @@ export class MaturityQuestionsComponent implements OnInit, AfterViewInit { this.groupings = response.groupings; this.assessSvc.assessment.maturityModel.maturityTargetLevel = response.maturityTargetLevel; + // 100 is the default level if the model does not support a target + this.modelSupportsTargetLevel = response.maturityTargetLevel < 100; + this.assessSvc.assessment.maturityModel.answerOptions = response.answerOptions; this.filterSvc.answerOptions = response.answerOptions.slice(); this.filterSvc.maturityModelId = response.modelId; @@ -237,9 +241,9 @@ export class MaturityQuestionsComponent implements OnInit, AfterViewInit { } this.completionSvc.reset(); + this.groupings = null; this.maturitySvc.getGroupingQuestions(groupingId).subscribe((response: MaturityQuestionResponse) => { - this.modelId = response.modelId; this.modelName = response.modelName; this.questionsAlias = response.questionsAlias; @@ -387,6 +391,6 @@ export class MaturityQuestionsComponent implements OnInit, AfterViewInit { * @returns */ areGroupingsVisible() { - return this.groupings.some(g => g.visible); + return this.groupings?.some(g => g.visible); } } diff --git a/CSETWebNg/src/app/assessment/results/analytics-results/analytics-results.component.html b/CSETWebNg/src/app/assessment/results/analytics-results/analytics-results.component.html index a06d49ce18..918915db8d 100644 --- a/CSETWebNg/src/app/assessment/results/analytics-results/analytics-results.component.html +++ b/CSETWebNg/src/app/assessment/results/analytics-results/analytics-results.component.html @@ -3,12 +3,12 @@

Assessment Analytics

This chart displays the implementation scoring of the current assessment in relation to other assessments of the same type. Each category is scored, with the minimum, maximum, and median scores charted to illustrate how the current assessment compares to other assessments within the same sector or across all sectors

-
-
+
+
-
- -

{{ dataType === 'mySector' ? sectorTitle : 'All Sectors' }}

+
+ +

{{ dataType === 'mySector' ? sectorTitle : 'All Sectors' }}

@@ -40,7 +40,6 @@

Assessment Analytics

- +
\ No newline at end of file diff --git a/CSETWebNg/src/app/initial/my-assessments/my-assessments.component.ts b/CSETWebNg/src/app/initial/my-assessments/my-assessments.component.ts index 1474d2edb2..78e576e126 100644 --- a/CSETWebNg/src/app/initial/my-assessments/my-assessments.component.ts +++ b/CSETWebNg/src/app/initial/my-assessments/my-assessments.component.ts @@ -247,18 +247,11 @@ export class MyAssessmentsComponent implements OnInit { assessmentiDs.push(item.assessmentId); item.isEntry = false; } - let type = ''; - if (item.useDiagram) type += ', Diagram'; - item.questionAlias = 'questions'; - if (item.useMaturity) { - type += ', ' + item.selectedMaturityModel; - if (item.selectedMaturityModel === 'ISE') { - item.questionAlias = 'statements'; - } - } - if (item.useStandard && item.selectedStandards) type += ', ' + item.selectedStandards; - if (type.length > 0) type = type.substring(2); - item.type = type; + + // determine assessment type display + item.type = this.determineAssessmentType(item); + + let currentAssessmentStats = assessmentsCompletionData.find(x => x.assessmentId === item.assessmentId); item.completedQuestionsCount = currentAssessmentStats?.completedCount; item.totalAvailableQuestionsCount = @@ -298,6 +291,43 @@ export class MyAssessmentsComponent implements OnInit { ))).subscribe(); } + /** + * + */ + determineAssessmentType(item: UserAssessment) { + let type = ''; + + if (item.useDiagram) type += ', Diagram'; + item.questionAlias = 'questions'; + + if (item.useMaturity) { + type += ', ' + this.getMaturityModelShortName(item); + if (item.selectedMaturityModel === 'ISE') { + item.questionAlias = 'statements'; + } + } + if (item.useStandard && item.selectedStandards) type += ', ' + item.selectedStandards; + if (type.length > 0) type = type.substring(2); + + return type; + } + + /** + * Tries to find a "model short title" in the language files. + * If it can't find a defintion, just use the selected model's title. + */ + getMaturityModelShortName(a: UserAssessment) { + const key = `${a.selectedMaturityModel.toLowerCase()}.model short title`; + const val = this.tSvc.translate(key); + if (key == val) { + return a.selectedMaturityModel; + } + return val; + } + + /** + * + */ hasPath(rpath: string) { if (rpath != null) { localStorage.removeItem("returnPath"); diff --git a/CSETWebNg/src/app/models/questions.model.ts b/CSETWebNg/src/app/models/questions.model.ts index 916b5f6394..729e0477ab 100644 --- a/CSETWebNg/src/app/models/questions.model.ts +++ b/CSETWebNg/src/app/models/questions.model.ts @@ -45,6 +45,7 @@ export interface MaturityQuestionResponse { modelId: number; modelName: string; questionsAlias: string; + groupingId: number; title: string; levels: []; maturityTargetLevel: number;