From f335c0720b85c9e478e2cfff5930b4a0f8f21b00 Mon Sep 17 00:00:00 2001 From: Daniel Manta Date: Mon, 29 Nov 2021 14:13:15 +0000 Subject: [PATCH 1/2] DLSV2-421 Only check assessment questions marked as Required when deciding whether to show the Request Sign-off button in SelfAssessmentOverview --- ...iredToCompetencyAssessmentQuestionsTable.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 DigitalLearningSolutions.Data.Migrations/202111291243_AddRequiredToCompetencyAssessmentQuestionsTable.cs diff --git a/DigitalLearningSolutions.Data.Migrations/202111291243_AddRequiredToCompetencyAssessmentQuestionsTable.cs b/DigitalLearningSolutions.Data.Migrations/202111291243_AddRequiredToCompetencyAssessmentQuestionsTable.cs new file mode 100644 index 0000000000..67fec5e95b --- /dev/null +++ b/DigitalLearningSolutions.Data.Migrations/202111291243_AddRequiredToCompetencyAssessmentQuestionsTable.cs @@ -0,0 +1,18 @@ +namespace DigitalLearningSolutions.Data.Migrations +{ + using FluentMigrator; + + [Migration(202111291243)] + public class AddRequiredToCompetencyAssessmentQuestionsTable : Migration + { + public override void Up() + { + Alter.Table("CompetencyAssessmentQuestions").AddColumn("Required").AsBoolean().NotNullable().WithDefaultValue(true); + } + + public override void Down() + { + Delete.Column("Required").FromTable("CompetencyAssessmentQuestions"); + } + } +} From bb8c33f3726a7a677697cb2c7bff282bc099aea7 Mon Sep 17 00:00:00 2001 From: Daniel Manta Date: Mon, 29 Nov 2021 16:34:37 +0000 Subject: [PATCH 2/2] DLSV2-421 Only check assessment questions marked as Required when deciding whether to show the Request Sign-off button in SelfAssessmentOverview --- .../Models/SelfAssessments/AssessmentQuestion.cs | 1 + .../Services/SelfAssessmentService.cs | 1 + .../SelfAssessmentOverviewViewModel.cs | 12 ++++++------ .../SelfAssessments/SelfAssessmentOverview.cshtml | 2 +- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/DigitalLearningSolutions.Data/Models/SelfAssessments/AssessmentQuestion.cs b/DigitalLearningSolutions.Data/Models/SelfAssessments/AssessmentQuestion.cs index 5c7e6e9111..ff7062bc40 100644 --- a/DigitalLearningSolutions.Data/Models/SelfAssessments/AssessmentQuestion.cs +++ b/DigitalLearningSolutions.Data/Models/SelfAssessments/AssessmentQuestion.cs @@ -22,6 +22,7 @@ public class AssessmentQuestion public int? SelfAssessmentResultSupervisorVerificationId { get; set; } public DateTime? Requested { get; set; } public DateTime? Verified { get; set; } + public bool Required { get; set; } public string? SupervisorComments { get; set; } public bool? SignedOff { get; set; } public bool? UserIsVerifier { get; set; } diff --git a/DigitalLearningSolutions.Data/Services/SelfAssessmentService.cs b/DigitalLearningSolutions.Data/Services/SelfAssessmentService.cs index d3e3f656bd..3e1c28d609 100644 --- a/DigitalLearningSolutions.Data/Services/SelfAssessmentService.cs +++ b/DigitalLearningSolutions.Data/Services/SelfAssessmentService.cs @@ -129,6 +129,7 @@ LEFT OUTER JOIN CompetencyAssessmentQuestionRoleRequirements rr DENSE_RANK() OVER (ORDER BY SAS.Ordering) as RowNo, C.Name AS Name, C.Description AS Description, + CAQ.Required, CG.Name AS CompetencyGroup, CG.ID AS CompetencyGroupID, COALESCE((SELECT TOP(1) FrameworkConfig FROM Frameworks F INNER JOIN FrameworkCompetencies AS FC ON FC.FrameworkID = F.ID WHERE FC.CompetencyID = C.ID), 'Capability') AS Vocabulary, diff --git a/DigitalLearningSolutions.Web/ViewModels/LearningPortal/SelfAssessments/SelfAssessmentOverviewViewModel.cs b/DigitalLearningSolutions.Web/ViewModels/LearningPortal/SelfAssessments/SelfAssessmentOverviewViewModel.cs index b8995c678c..9760c9307f 100644 --- a/DigitalLearningSolutions.Web/ViewModels/LearningPortal/SelfAssessments/SelfAssessmentOverviewViewModel.cs +++ b/DigitalLearningSolutions.Web/ViewModels/LearningPortal/SelfAssessments/SelfAssessmentOverviewViewModel.cs @@ -18,24 +18,24 @@ public string VocabPlural() { return FrameworkVocabularyHelper.VocabularyPlural(SelfAssessment.Vocabulary); } - public bool AllQuestionsVerified() + public bool AllQuestionsVerifiedOrNotRequired() { - bool allVerified = true; + bool allVerifiedOrNotRequired = true; foreach (var competencyGroup in CompetencyGroups) { foreach (var competency in competencyGroup) { foreach (var assessmentQuestion in competency.AssessmentQuestions) { - if (assessmentQuestion.Result == null || assessmentQuestion.Verified == null ) + if ((assessmentQuestion.Result == null || assessmentQuestion.Verified == null) && assessmentQuestion.Required) { - allVerified = false; + allVerifiedOrNotRequired = false; break; } - } + } } } - return allVerified; + return allVerifiedOrNotRequired; } } } diff --git a/DigitalLearningSolutions.Web/Views/LearningPortal/SelfAssessments/SelfAssessmentOverview.cshtml b/DigitalLearningSolutions.Web/Views/LearningPortal/SelfAssessments/SelfAssessmentOverview.cshtml index 32b477fda6..62db4063d6 100644 --- a/DigitalLearningSolutions.Web/Views/LearningPortal/SelfAssessments/SelfAssessmentOverview.cshtml +++ b/DigitalLearningSolutions.Web/Views/LearningPortal/SelfAssessments/SelfAssessmentOverview.cshtml @@ -75,7 +75,7 @@

@Model.SelfAssessment.SignOffRoleName Sign-off

- @if (Model.AllQuestionsVerified()) + @if (Model.AllQuestionsVerifiedOrNotRequired()) { @if (!Model.SupervisorSignOffs.Any()) {