Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug/cset 2937 #4311

Merged
merged 4 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ public class MaturityResponse
/// </summary>
public string ModelName { get; set; } = "";

/// <summary>
/// The ID of the grouping being returned.
/// </summary>
public int GroupingId { get; set; }

/// <summary>
/// The name of the current grouping represented in the response;
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ <h4>{{ groupingTitle }}</h4>
</div>
</div>

<div *ngIf="!!groupings && !areGroupingsVisible()"
<div *ngIf="!!groupings && !areGroupingsVisible() && modelSupportsTargetLevel"
class="alert-warning mt-4 mb-4 d-flex flex-row justify-content-center align-items-center flex-11a">
<span class="p-md-3 p-2 fs-large cset-icons-exclamation-triangle"></span>
<span class="fs-base-3 p-2 d-flex flex-column justify-content-center flex-11a">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ <h3 class="mb-3">Assessment Analytics</h3>
<p>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</p>
<div class="container">
<div class="container-fluid">
<div class="container ps-0">
<div class="container-fluid ps-0">
<div class="row">
<div class="col-sm">
<mat-card>
<mat-card-header class="d-flex justify-content-center"> <h3>{{ dataType === 'mySector' ? sectorTitle : 'All Sectors' }}</h3>
<div class="col-sm ps-0">
<mat-card class="p-3" style="background-color: transparent; box-shadow: none">
<mat-card-header class="d-flex justify-content-center"> <h4>{{ dataType === 'mySector' ? sectorTitle : 'All Sectors' }}</h4>
</mat-card-header>
<div class="p-4">
<mat-button-toggle-group [(ngModel)]="dataType" (change)="toggleData($event)">
Expand Down Expand Up @@ -40,7 +40,6 @@ <h3 class="mb-3">Assessment Analytics</h3>
</div>
</div>

<app-nav-back-next [page]="'analytics-results-page'"
[hide]="navSvc.isLastVisiblePage('analytics') ? 'next' : ''"></app-nav-back-next>
<app-nav-back-next [page]="'analytics-results-page'"></app-nav-back-next>

</div>
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down Expand Up @@ -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");
Expand Down
1 change: 1 addition & 0 deletions CSETWebNg/src/app/models/questions.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export interface MaturityQuestionResponse {
modelId: number;
modelName: string;
questionsAlias: string;
groupingId: number;
title: string;
levels: [];
maturityTargetLevel: number;
Expand Down
Loading