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

Initial commit of the new ratios text field #497

Merged
merged 3 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from 2 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 @@ -55,6 +55,8 @@ public class DetailsPage
public string QualificationStartDateLabel { get; init; } = string.Empty;

public Document? RatiosTextNotFullAndRelevant { get; init; }

public Document? RatiosTextL3PlusNotFrBetweenSep14Aug19 { get; init; }
RobertGHippo marked this conversation as resolved.
Show resolved Hide resolved

public FeedbackBanner? FeedbackBanner { get; init; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ await Task.FromResult(CreateAdvicePage("Level 7 qualification after aug 2019",
var furtherInfoText = ContentfulContentHelper.Paragraph("Test Further Info Text");
var ratioText = ContentfulContentHelper.Paragraph("This is the ratio text");
var ratioTextForNotFullAndRelevant = ContentfulContentHelper.Paragraph("This is not F&R");
var ratioTextL3PlusNotFullAndRelevantBetweenSep14AndAug19 = ContentfulContentHelper.Paragraph("This is not F&R for L3 between Sep14 & Aug19");
var requirementsText = ContentfulContentHelper.Paragraph("This is the requirements text");
return await Task.FromResult(new DetailsPage
{
Expand Down Expand Up @@ -159,6 +160,7 @@ await Task.FromResult(CreateAdvicePage("Level 7 qualification after aug 2019",
RatiosHeading = "Test ratio heading",
RatiosText = ratioText,
RatiosTextNotFullAndRelevant = ratioTextForNotFullAndRelevant,
RatiosTextL3PlusNotFrBetweenSep14Aug19 = ratioTextL3PlusNotFullAndRelevantBetweenSep14AndAug19,
RequirementsHeading = "Test requirements heading",
RequirementsText = requirementsText,
CheckAnotherQualificationLink = new NavigationLink
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,13 @@ public async Task<IActionResult> Index(string qualificationId)
if (!validateAdditionalRequirementQuestions.isValid)
{
await qualificationDetailsService.QualificationLevel3OrAboveMightBeRelevantAtLevel2(model, qualification);
await qualificationDetailsService.SetRatioText(model, detailsPageContent);
return validateAdditionalRequirementQuestions.actionResult!;
}

await qualificationDetailsService.CheckRatioRequirements(qualification, model);
await qualificationDetailsService.QualificationLevel3OrAboveMightBeRelevantAtLevel2(model, qualification);
await qualificationDetailsService.SetRatioText(model, detailsPageContent);

return View(model);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ public static QualificationDetailsModel Map(
string checkAnotherQualificationTextHtml,
string furtherInfoTextHtml,
string requirementsTextHtml,
string ratiosTextHtml,
string ratiosTextNotFullAndRelevantHtml,
string? feedbackBodyHtml)
{
return new QualificationDetailsModel
Expand Down Expand Up @@ -46,8 +44,6 @@ public static QualificationDetailsModel Map(
RequirementsHeading = content.RequirementsHeading,
RequirementsText = requirementsTextHtml,
RatiosHeading = content.RatiosHeading,
RatiosText = ratiosTextHtml,
RatiosTextNotFullAndRelevant = ratiosTextNotFullAndRelevantHtml,
CheckAnotherQualificationLink = NavigationLinkMapper.Map(content.CheckAnotherQualificationLink),
PrintButtonText = content.PrintButtonText,
QualificationNameLabel = content.QualificationNameLabel,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ public class DetailsPageModel

public string RatiosHeading { get; init; } = string.Empty;

public string RatiosText { get; init; } = string.Empty;

public string RatiosTextNotFullAndRelevant { get; init; } = string.Empty;
public string RatiosText { get; set; } = string.Empty;

public string RequirementsHeading { get; init; } = string.Empty;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ public interface IQualificationDetailsService
NavigationLink? CalculateBackButton(DetailsPage content, string qualificationId);
List<AdditionalRequirementAnswerModel>? MapAdditionalRequirementAnswers(List<AdditionalRequirementQuestion>? additionalRequirementQuestions);
Task<QualificationDetailsModel> MapDetails(Qualification qualification, DetailsPage content);
Task SetRatioText(QualificationDetailsModel model, DetailsPage content);
}
Original file line number Diff line number Diff line change
Expand Up @@ -309,14 +309,27 @@ public async Task<QualificationDetailsModel> MapDetails(Qualification qualificat
var checkAnotherQualificationText = await contentParser.ToHtml(content.CheckAnotherQualificationText);
var furtherInfoText = await contentParser.ToHtml(content.FurtherInfoText);
var requirementsText = await contentParser.ToHtml(content.RequirementsText);
var ratiosText = await contentParser.ToHtml(content.RatiosText);
var ratiosTextNotFullAndRelevant = await contentParser.ToHtml(content.RatiosTextNotFullAndRelevant);
var feedbackBodyHtml = await GetFeedbackBannerBodyToHtml(content.FeedbackBanner);

return QualificationDetailsMapper.Map(qualification, content, backNavLink,
MapAdditionalRequirementAnswers(qualification.AdditionalRequirementQuestions),
dateStarted, checkAnotherQualificationText, furtherInfoText,
requirementsText, ratiosText, ratiosTextNotFullAndRelevant,
feedbackBodyHtml);
requirementsText, feedbackBodyHtml);
}

public async Task SetRatioText(QualificationDetailsModel model, DetailsPage content)
{
switch (model.RatioRequirements.IsNotFullAndRelevant)
{
case true when model.QualificationLevel >= 3 && userJourneyCookieService.WasStartedBetweenSeptember2014AndAugust2019():
model.Content!.RatiosText = await contentParser.ToHtml(content.RatiosTextL3PlusNotFrBetweenSep14Aug19);
break;
case true:
model.Content!.RatiosText = await contentParser.ToHtml(content.RatiosTextNotFullAndRelevant);
break;
default:
model.Content!.RatiosText = await contentParser.ToHtml(content.RatiosText);
break;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,8 @@
</div>
<div class="govuk-grid-column-full govuk-!-static-margin-top-6">
<h2 class="govuk-heading-l" id="ratio-heading">@Model.Content.RatiosHeading</h2>
@{
if (Model.RatioRequirements.IsNotFullAndRelevant)
{
@Html.Raw(Model.Content.RatiosTextNotFullAndRelevant)
}
else
{
@Html.Raw(Model.Content.RatiosText)
}
}
@Html.Raw(Model.Content.RatiosText)

@{
if (Model.RatioRequirements.ApprovedForLevel2 == QualificationApprovalStatus.Approved
|| Model.RatioRequirements.ApprovedForLevel3 == QualificationApprovalStatus.Approved
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,20 @@ describe("A spec used to test the qualification details page", () => {
cy.get(".govuk-tag").eq(4).should("have.class", "govuk-tag--red");
})

it("Checks the staff ratio text shows correctly when not full and relevant", () => {
it("Checks the staff ratio text shows correctly when not full and relevant for a L3+ qualification started between Sep14 & Aug19", () => {
// Value is '{"WhereWasQualificationAwarded":"england","WhenWasQualificationStarted":"7/2015","LevelOfQualification":"3","WhatIsTheAwardingOrganisation":"NCFE","SearchCriteria":"","AdditionalQuestionsAnswers":{"Test question":"yes","Test question 2":"yes"}}' encoded
cy.setCookie('user_journey', '%7B%22WhereWasQualificationAwarded%22%3A%22england%22%2C%22WhenWasQualificationStarted%22%3A%227%2F2015%22%2C%22LevelOfQualification%22%3A%223%22%2C%22WhatIsTheAwardingOrganisation%22%3A%22NCFE%22%2C%22SearchCriteria%22%3A%22%22%2C%22AdditionalQuestionsAnswers%22%3A%7B%22Test%20question%22%3A%22yes%22%2C%22Test%20question%202%22%3A%22yes%22%7D%7D');
cy.visit("/qualifications/qualification-details/eyq-240");

cy.get("#ratio-heading").should("contain.text", "Test ratio heading");
cy.get("#ratio-heading + p[class='govuk-body']").should("contain.text", "This is not F&R for L3 between Sep14 & Aug19");
})

it("Checks the staff ratio text shows correctly when not full and relevant for a L3+ qualification started after Sep19", () => {
// Value is '{"WhereWasQualificationAwarded":"england","WhenWasQualificationStarted":"10/2019","LevelOfQualification":"3","WhatIsTheAwardingOrganisation":"NCFE","SearchCriteria":"","AdditionalQuestionsAnswers":{"Test question":"yes","Test question 2":"yes"}}' encoded
cy.setCookie('user_journey', '%7B%22WhereWasQualificationAwarded%22%3A%22england%22%2C%22WhenWasQualificationStarted%22%3A%2210%2F2019%22%2C%22LevelOfQualification%22%3A%223%22%2C%22WhatIsTheAwardingOrganisation%22%3A%22NCFE%22%2C%22SearchCriteria%22%3A%22%22%2C%22AdditionalQuestionsAnswers%22%3A%7B%22Test%20question%22%3A%22yes%22%2C%22Test%20question%202%22%3A%22yes%22%7D%7D');
cy.visit("/qualifications/qualification-details/eyq-240");

cy.get("#ratio-heading").should("contain.text", "Test ratio heading");
cy.get("#ratio-heading + p[class='govuk-body']").should("contain.text", "This is not F&R");
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<PackageReference Include="moq" Version="4.20.72"/>
<PackageReference Include="MSTest.TestAdapter" Version="3.7.0" />
<PackageReference Include="MSTest.TestFramework" Version="3.7.0" />
<PackageReference Include="coverlet.collector" Version="6.0.3">
<PackageReference Include="coverlet.collector" Version="6.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ public void Map_PassInParameters_ReturnsModel()
const string checkAnotherQualificationText = "Check another qualification text";
const string furtherInfoText = "Further info text";
const string requirementsText = "Requirements text";
const string ratiosText = "Ratios text";
const string ratiosTextNotFullAndRelevant = "Ratios text not full and relevant";
var detailsPage = new DetailsPage
{
AwardingOrgLabel = "Awarding org label",
Expand All @@ -46,8 +44,6 @@ public void Map_PassInParameters_ReturnsModel()
RequirementsHeading = "Requirements heading",
RequirementsText = ContentfulContentHelper.Paragraph(requirementsText),
RatiosHeading = "Ratios heading",
RatiosText = ContentfulContentHelper.Paragraph(ratiosText),
RatiosTextNotFullAndRelevant = ContentfulContentHelper.Paragraph(ratiosTextNotFullAndRelevant),
PrintButtonText = "Print button text",
QualificationNameLabel = "Qualification name label",
QualificationStartDateLabel = "Qualifications start date label",
Expand Down Expand Up @@ -81,8 +77,7 @@ public void Map_PassInParameters_ReturnsModel()

var result = QualificationDetailsMapper.Map(qualification, detailsPage, backNavLink,
additionalRequirementAnswers, dateStarted,
checkAnotherQualificationText, furtherInfoText, requirementsText,
ratiosText, ratiosTextNotFullAndRelevant, feedbackBannerBody);
checkAnotherQualificationText, furtherInfoText, requirementsText, feedbackBannerBody);

result.Should().NotBeNull();
result.QualificationId.Should().BeSameAs(qualification.QualificationId);
Expand Down Expand Up @@ -117,7 +112,6 @@ public void Map_PassInParameters_ReturnsModel()
result.Content.RequirementsHeading.Should().BeSameAs(detailsPage.RequirementsHeading);
result.Content.RequirementsText.Should().BeSameAs(requirementsText);
result.Content.RatiosHeading.Should().BeSameAs(detailsPage.RatiosHeading);
result.Content.RatiosTextNotFullAndRelevant.Should().BeSameAs(ratiosTextNotFullAndRelevant);
result.Content.CheckAnotherQualificationLink.Should().BeEquivalentTo(detailsPage.CheckAnotherQualificationLink, options => options.Excluding(x => x.Sys));
result.Content.PrintButtonText.Should().BeSameAs(detailsPage.PrintButtonText);
result.Content.QualificationNameLabel.Should().BeSameAs(detailsPage.QualificationNameLabel);
Expand Down
Loading
Loading