Skip to content

Commit

Permalink
Revert "EAR 2291 update content for calculated summary question" (#211)
Browse files Browse the repository at this point in the history
  • Loading branch information
martyncolmer authored Feb 29, 2024
1 parent da37016 commit 18e9ba5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 51 deletions.
5 changes: 1 addition & 4 deletions src/eq_schema/schema/Block/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,7 @@ class Block {
this.page_title = processPipe(ctx)(page.pageDescription);
}
if (page.pageType === "CalculatedSummaryPage") {
this.title = processPipe(ctx)(page.title).endsWith(".")
? `${processPipe(ctx)(page.title)} Is this correct?`
: `${processPipe(ctx)(page.title)}. Is this correct?`;

this.title = processPipe(ctx)(page.title);
this.page_title =
processPipe(ctx)(page.pageDescription) || processPipe(ctx)(page.title);

Expand Down
51 changes: 4 additions & 47 deletions src/eq_schema/schema/Block/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ describe("Block", () => {
title: "Bye",
},
id: "1",
title: "Hi is your total %(total)s. Is this correct?",
title: "Hi is your total %(total)s",
type: "CalculatedSummary",
});
});
Expand Down Expand Up @@ -728,7 +728,7 @@ describe("Block", () => {
id: "summary-page1",
type: "CalculatedSummary",
page_title: "Summary page1",
title: "Summary1. Is this correct?",
title: "Summary1",
calculation: {
operation: {
"+": [
Expand All @@ -754,49 +754,6 @@ describe("Block", () => {
});
});

it("Should not add a full stop after the title if it has been added by the user", () => {
const calculatedPageGraphql = {
totalTitle: "<p>Summary title1</p>",
answers: [
{
label: "<p>Summary title1</p>",
type: "Number",
id: "9d2b3354-9751-4be4-9523-1f36345c3069",
validation: {},
properties: {},
},
],
title: "<p>Summary1.</p>",
type: "Number",
pageType: "CalculatedSummaryPage",
summaryAnswers: ["num-1"],
pageDescription: "Summary page1",
alias: null,
id: "summary-page1",
listId: undefined,
};

const block = new Block(calculatedPageGraphql, null, ctx);

expect(block).toMatchObject({
id: "summary-page1",
type: "CalculatedSummary",
page_title: "Summary page1",
title: "Summary1. Is this correct?",
calculation: {
operation: {
"+": [
{
identifier: "answernum-1",
source: "answers",
},
],
},
title: "Summary title1",
},
});
});

it("should build a calculated summary page without skip condition when it contains a normal answer", () => {
const calculatedPageGraphql = {
totalTitle: "<p>Summary title1</p>",
Expand Down Expand Up @@ -825,7 +782,7 @@ describe("Block", () => {
id: "summary-page1",
type: "CalculatedSummary",
page_title: "Summary page1",
title: "Summary1. Is this correct?",
title: "Summary1",
calculation: {
operation: {
"+": [
Expand Down Expand Up @@ -872,7 +829,7 @@ describe("Block", () => {
id: "grand-summary-1",
type: "GrandCalculatedSummary",
page_title: "Grand summary",
title: "Grand summary. Is this correct?",
title: "Grand summary",
calculation: {
operation: {
"+": [
Expand Down

0 comments on commit 18e9ba5

Please sign in to comment.