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

Revert "EAR 2291 update content for calculated summary question" #211

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
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
Loading