diff --git a/src/Dfe.EarlyYearsQualification.Content/Entities/CheckAdditionalRequirementsPage.cs b/src/Dfe.EarlyYearsQualification.Content/Entities/CheckAdditionalRequirementsPage.cs index 7c533ef8..71e653f2 100644 --- a/src/Dfe.EarlyYearsQualification.Content/Entities/CheckAdditionalRequirementsPage.cs +++ b/src/Dfe.EarlyYearsQualification.Content/Entities/CheckAdditionalRequirementsPage.cs @@ -19,4 +19,6 @@ public class CheckAdditionalRequirementsPage public string QuestionSectionHeading { get; init; } = string.Empty; public string ErrorMessage { get; init; } = string.Empty; + + public string ErrorSummaryHeading { get; init; } = string.Empty; } \ No newline at end of file diff --git a/src/Dfe.EarlyYearsQualification.Mock/Content/MockContentfulService.cs b/src/Dfe.EarlyYearsQualification.Mock/Content/MockContentfulService.cs index 6f79b7c7..85a5e47a 100644 --- a/src/Dfe.EarlyYearsQualification.Mock/Content/MockContentfulService.cs +++ b/src/Dfe.EarlyYearsQualification.Mock/Content/MockContentfulService.cs @@ -326,6 +326,7 @@ public Task> GetQualifications() QualificationLevelLabel = "Qualification level", InformationMessage = "Your result is dependent on the accuracy of the answers you have provided", ErrorMessage = "This is a test error message", + ErrorSummaryHeading = "There was a problem", QuestionSectionHeading = "This is the question section heading" }); } diff --git a/src/Dfe.EarlyYearsQualification.Web/Controllers/CheckAdditionalRequirementsController.cs b/src/Dfe.EarlyYearsQualification.Web/Controllers/CheckAdditionalRequirementsController.cs index 6d976e2f..4e62c54d 100644 --- a/src/Dfe.EarlyYearsQualification.Web/Controllers/CheckAdditionalRequirementsController.cs +++ b/src/Dfe.EarlyYearsQualification.Web/Controllers/CheckAdditionalRequirementsController.cs @@ -71,6 +71,10 @@ private async Task GetResponse(string qualificationId, } var mappedModel = await MapModel(content, qualification, model); + if (mappedModel.HasErrors) + { + SetQuestionErrorFlag(mappedModel); + } return View("Index", mappedModel); } @@ -93,8 +97,10 @@ private async Task MapModel(CheckAdditiona mappedModel.BackButton = content.BackButton; mappedModel.AdditionalRequirementQuestions = await MapAdditionalRequirementQuestions(qualification.AdditionalRequirementQuestions!); - mappedModel.Answers = MapQuestionsToDictionary(qualification.AdditionalRequirementQuestions!); + mappedModel.Answers = MapQuestionsToDictionary(qualification.AdditionalRequirementQuestions!, model); mappedModel.ErrorMessage = content.ErrorMessage; + mappedModel.ErrorSummaryHeading = content.ErrorSummaryHeading; + mappedModel.QuestionCount = mappedModel.AdditionalRequirementQuestions.Count; return mappedModel; } @@ -122,8 +128,24 @@ private static List MapOptions(List