diff --git a/src/IsaacApiTypes.tsx b/src/IsaacApiTypes.tsx index da235d0d86..d9119d06a3 100644 --- a/src/IsaacApiTypes.tsx +++ b/src/IsaacApiTypes.tsx @@ -615,7 +615,7 @@ export interface GroupMembershipDTO { created?: Date; } -export type Stage = "year_7_and_8" | "year_9" | "gcse" | "a_level" | "further_a" | "university" | "scotland_national_5" | "scotland_higher" | "scotland_advanced_higher" | "core" | "advanced" | "all"; +export type Stage = "year_7_and_8" | "year_9" | "gcse" | "a_level" | "further_a" | "university" | "scotland_national_5" | "scotland_higher" | "scotland_advanced_higher" | "core" | "advanced" | "post_18" | "all"; export type ExamBoard = "aqa" | "cie" | "edexcel" | "eduqas" | "ocr" | "wjec" | "sqa" | "ada" | "all"; diff --git a/src/app/components/pages/ExamSpecifications.tsx b/src/app/components/pages/ExamSpecifications.tsx index eb64fc557c..8b48ebcfc2 100644 --- a/src/app/components/pages/ExamSpecifications.tsx +++ b/src/app/components/pages/ExamSpecifications.tsx @@ -79,6 +79,7 @@ export const ExamSpecifications = ({stageFilter, examBoardFilter, title}: ExamSp [STAGE.SCOTLAND_ADVANCED_HIGHER]: "Discover our free Advanced Higher computer science topics and questions. Learn or revise for your exams with us today.", [STAGE.CORE]: "Discover our free Core computer science topics and questions. Learn or revise for your exams with us today.", [STAGE.ADVANCED]: "Discover our free Advanced computer science topics and questions. Learn or revise for your exams with us today.", + [STAGE.POST_18]: "Discover our free Post-18 computer science topics and questions. Learn or revise for your exams with us today.", // Not used, but needed for typing })[stageTab]; const examBoardTabs = Object.keys(FILTERED_EXAM_BOARDS_BY_STAGE).reduce((acc: {[stage: string]: React.JSX.Element}, stage) => ({ diff --git a/src/app/services/constants.ts b/src/app/services/constants.ts index c8d263f940..467b92680c 100644 --- a/src/app/services/constants.ts +++ b/src/app/services/constants.ts @@ -277,11 +277,12 @@ export enum STAGE { SCOTLAND_ADVANCED_HIGHER = "scotland_advanced_higher", CORE = "core", ADVANCED = "advanced", + POST_18 = "post_18", ALL = "all", } export const STAGE_NULL_OPTIONS = [STAGE.ALL]; export const STAGES_PHY = [STAGE.YEAR_7_AND_8, STAGE.YEAR_9, STAGE.GCSE, STAGE.A_LEVEL, STAGE.FURTHER_A, STAGE.UNIVERSITY] as const; -export const STAGES_CS = [STAGE.GCSE, STAGE.A_LEVEL, STAGE.SCOTLAND_NATIONAL_5, STAGE.SCOTLAND_HIGHER, STAGE.SCOTLAND_ADVANCED_HIGHER, STAGE.CORE, STAGE.ADVANCED] as const; +export const STAGES_CS = [STAGE.GCSE, STAGE.A_LEVEL, STAGE.SCOTLAND_NATIONAL_5, STAGE.SCOTLAND_HIGHER, STAGE.SCOTLAND_ADVANCED_HIGHER, STAGE.CORE, STAGE.ADVANCED, STAGE.POST_18] as const; export const stagesOrdered: Stage[] = [...siteSpecific(STAGES_PHY, STAGES_CS), STAGE.ALL]; export const stageLabelMap: {[stage in Stage]: string} = { year_7_and_8: "Year\u00A07&8", @@ -295,6 +296,7 @@ export const stageLabelMap: {[stage in Stage]: string} = { scotland_advanced_higher: "Adv Higher", core: "Core", advanced: "Advanced", + post_18: "Post-18", all: "All stages", }; @@ -330,6 +332,7 @@ export const CS_EXAM_BOARDS_BY_STAGE: {[stage in typeof STAGES_CS[number]]: Exam scotland_advanced_higher: [EXAM_BOARD.SQA], core: [EXAM_BOARD.ADA], advanced: [EXAM_BOARD.ADA], + post_18: [EXAM_BOARD.ADA], }; export const EXAM_BOARD_NULL_OPTIONS = [EXAM_BOARD.ALL]; @@ -470,13 +473,14 @@ export const STAGE_TO_LEARNING_STAGE: {[stage in STAGE]: LearningStage | undefin scotland_advanced_higher: "a_level", core: "gcse", advanced: "a_level", + post_18: "university", }; export const LEARNING_STAGE_TO_STAGES: {[stage in LearningStage]: STAGE[]} = { "11_14": [STAGE.YEAR_7_AND_8, STAGE.YEAR_9], gcse: [STAGE.GCSE, STAGE.SCOTLAND_NATIONAL_5, STAGE.CORE], a_level: [STAGE.A_LEVEL, STAGE.FURTHER_A, STAGE.SCOTLAND_HIGHER, STAGE.SCOTLAND_ADVANCED_HIGHER, STAGE.ADVANCED], - university: [STAGE.UNIVERSITY], + university: [STAGE.UNIVERSITY, STAGE.POST_18], }; export const HUMAN_STAGES: {[key: string]: string} = { diff --git a/src/app/services/userViewingContext.ts b/src/app/services/userViewingContext.ts index 378aeb35b4..cfb44ce323 100644 --- a/src/app/services/userViewingContext.ts +++ b/src/app/services/userViewingContext.ts @@ -228,6 +228,7 @@ const _STAGE_ITEM_OPTIONS = siteSpecific([ /* best not to export - use getFilter {label: "All Stages (Default)", value: STAGE.ALL}, {label: "Core", value: STAGE.CORE}, {label: "Advanced", value: STAGE.ADVANCED}, + {label: "Post-18", value: STAGE.POST_18}, {label: "GCSE", value: STAGE.GCSE}, {label: "A Level", value: STAGE.A_LEVEL}, {label: "National 5", value: STAGE.SCOTLAND_NATIONAL_5}, @@ -471,8 +472,8 @@ export function audienceStyle(audienceString: string): string { case stageLabelMap.scotland_advanced_higher: return "stage-label-advanced"; + case stageLabelMap.post_18: case stageLabelMap.scotland_higher: - // Scotland higher has a unique styling return "stage-label-higher"; default: @@ -508,14 +509,15 @@ export function stringifyAudience(audience: ContentDTO["audience"], userContext: // - Advanced Higher // with intra-group separation by commas, inter-group separation by newlines - const coreOrAdvanced = audienceStages.includes(STAGE.CORE) ? [STAGE.CORE] : [STAGE.ADVANCED]; - const defaultStage = (audienceStages.includes(STAGE.CORE) && audienceStages.includes(STAGE.ADVANCED)) ? [STAGE.CORE, STAGE.ADVANCED] : coreOrAdvanced; + const adaStages = [STAGE.CORE, STAGE.ADVANCED, STAGE.POST_18]; + const adaAudienceStages = audienceStages.filter(s => adaStages.includes(s as STAGE)); + stagesToView = userContext.hasDefaultPreferences || !intendedAudience - ? defaultStage + ? adaAudienceStages : stagesFilteredByUserContext.length > 0 ? stagesFilteredByUserContext - // only show Core and Advanced intentionally - : audienceStages.filter(s => ![STAGE.CORE, STAGE.ADVANCED].includes(s as STAGE)); + // only show Ada exam board stages intentionally + : audienceStages.filter(s => !adaStages.includes(s as STAGE)); const result = stagesToView.reduce((acc, label) => { if ([STAGE.GCSE, STAGE.A_LEVEL].includes(label as STAGE)) { @@ -524,7 +526,7 @@ export function stringifyAudience(audience: ContentDTO["audience"], userContext: acc[1].push(label); } else if ([STAGE.SCOTLAND_ADVANCED_HIGHER].includes(label as STAGE)) { acc[2].push(label); - } else if ([STAGE.CORE, STAGE.ADVANCED].includes(label as STAGE)) { + } else if (adaStages.includes(label as STAGE)) { acc[3].push(label); } return acc; diff --git a/src/mocks/data.ts b/src/mocks/data.ts index ff75256957..9c0fe67763 100644 --- a/src/mocks/data.ts +++ b/src/mocks/data.ts @@ -4929,6 +4929,9 @@ export const mockConceptPage = "id": "_mock_accordion_", "audience": [ { + "examBoard": [ + "aqa" + ], "stage": [ "a_level" ] diff --git a/src/test/pages/Concept.cy.tsx b/src/test/pages/Concept.cy.tsx index c176d505b5..dda76923f7 100644 --- a/src/test/pages/Concept.cy.tsx +++ b/src/test/pages/Concept.cy.tsx @@ -1,11 +1,16 @@ import React from "react"; import { Concept } from "../../app/components/pages/Concept"; +import { isAda } from "../../app/services"; it('Concept pages should have no visual regressions', () => { // @ts-ignore cy.mountWithStoreAndRouter(, ["/concepts/_mock_concept_page_"]); + if (isAda) { + cy.get('select[id="uc-exam-board-select"]').select('All Exam Boards'); + } + cy.get('[data-testid="loading"]').should('not.exist'); // open accordion diff --git a/src/test/pages/__image_snapshots__/ada/Concept pages should have no visual regressions #0.png b/src/test/pages/__image_snapshots__/ada/Concept pages should have no visual regressions #0.png index bcce992e1d..2e411097c6 100644 Binary files a/src/test/pages/__image_snapshots__/ada/Concept pages should have no visual regressions #0.png and b/src/test/pages/__image_snapshots__/ada/Concept pages should have no visual regressions #0.png differ diff --git a/src/test/pages/__image_snapshots__/ada/Question finder page should have no visual regressions #0.png b/src/test/pages/__image_snapshots__/ada/Question finder page should have no visual regressions #0.png index 25679cdbe4..799fedc124 100644 Binary files a/src/test/pages/__image_snapshots__/ada/Question finder page should have no visual regressions #0.png and b/src/test/pages/__image_snapshots__/ada/Question finder page should have no visual regressions #0.png differ