From 554faef75c063c5e12c31b482788feba34f7808d Mon Sep 17 00:00:00 2001 From: M <120020483+VWSCoronaDashboard30@users.noreply.github.com> Date: Wed, 13 Dec 2023 16:16:19 +0100 Subject: [PATCH 1/5] task(sync-after-release): Executed the script (#4949) --- packages/cms/src/lokalize/key-mutations.csv | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/cms/src/lokalize/key-mutations.csv b/packages/cms/src/lokalize/key-mutations.csv index 1bc76fe8c1..a7c6419a8a 100644 --- a/packages/cms/src/lokalize/key-mutations.csv +++ b/packages/cms/src/lokalize/key-mutations.csv @@ -1,3 +1 @@ timestamp,action,key,document_id,move_to -2023-12-06T14:06:27.293Z,add,pages.hospitals_and_care_page.nl.icu.chart_beds_occupied.legend_inaccurate_labels,CFKdIPVDhosWzjhr2xUv19,__ -2023-12-06T14:06:27.294Z,delete,pages.hospitals_and_care_page.nl.icu.chart_beds_occupied.legend_inaccurate_label,PKXdxxxKAnTg0F1ZCrIxVz,__ From 7b2c6faea45f91447a64431bcdabf18848c37dfb Mon Sep 17 00:00:00 2001 From: yorickdevries Date: Mon, 18 Dec 2023 13:59:30 +0100 Subject: [PATCH 2/5] feature/fix ts node esm+upgrade sharp (#4952) * change to node 18 * fix ts-node script with esm * update sharp to 0.32.6 * format node-version --- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/main.yml | 6 +- .github/workflows/sync-sanity-lokalize.yml | 2 +- Dockerfile | 2 +- packages/app/package.json | 3 +- packages/cli/package.json | 4 +- packages/cms-v2/package.json | 18 ++-- packages/cms/package.json | 18 ++-- yarn.lock | 113 ++++++++++++++++----- 9 files changed, 114 insertions(+), 54 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index bdae86da83..de402b3d7e 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -32,7 +32,7 @@ jobs: strategy: fail-fast: false matrix: - node-version: [ 18.18.2 ] + node-version: [ 18 ] language: ['javascript'] # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] # Learn more: diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8fdf111530..2c1551a9c1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-22.04 strategy: matrix: - node-version: [18.18.2] + node-version: [ 18 ] needs: init steps: - name: Check out repository @@ -49,7 +49,7 @@ jobs: runs-on: ubuntu-22.04 strategy: matrix: - node-version: [18.18.2] + node-version: [ 18 ] needs: init steps: - name: Get target branch name (pull request) @@ -102,7 +102,7 @@ jobs: runs-on: ubuntu-22.04 strategy: matrix: - node-version: [18.18.2] + node-version: [ 18 ] needs: init steps: - name: Check out repository diff --git a/.github/workflows/sync-sanity-lokalize.yml b/.github/workflows/sync-sanity-lokalize.yml index e4f275ce5a..af052a8366 100644 --- a/.github/workflows/sync-sanity-lokalize.yml +++ b/.github/workflows/sync-sanity-lokalize.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-22.04 strategy: matrix: - node-version: [18.18.2] + node-version: [ 18 ] steps: - name: Check out repository uses: actions/checkout@v2 diff --git a/Dockerfile b/Dockerfile index 917d11dc45..848a594156 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Install dependencies only when needed -FROM node:18.18.2-alpine AS deps +FROM node:18-alpine AS deps ENV NODE_ENV="production" ENV NEXT_TELEMETRY_DISABLED=1 diff --git a/packages/app/package.json b/packages/app/package.json index 4a1a0a4b9f..234dfbefc0 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -56,7 +56,7 @@ "react-markdown": "^5.0.3", "resize-observer-polyfill": "^1.5.1", "sanitize-filename": "^1.6.3", - "sharp": "^0.30.5", + "sharp": "^0.32.6", "styled-components": "^5.3.5", "styled-system": "^5.1.5", "svgo-loader": "^3.0.0", @@ -86,7 +86,6 @@ "@types/react-dom": "^17.0.11", "@types/react-is": "^17.0.3", "@types/react-test-renderer": "^17.0.1", - "@types/sharp": "^0.29.4", "@types/sinon": "^10.0.6", "@types/styled-components": "^5.1.25", "@types/styled-system": "^5.1.15", diff --git a/packages/cli/package.json b/packages/cli/package.json index 9a3ef5b049..5546ea4b91 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -21,7 +21,7 @@ "ts-node": "^10.9.1" }, "scripts": { - "prepare-release": "ts-node src/release/prepare-release.ts", + "prepare-release": "node --loader ts-node/esm src/release/prepare-release.ts", "bootstrap": "yarn generate-data-types", "clean": "echo 'No clean command available for @corona-dashboard/cli'", "nuke": "yarn clean && npx rimraf node_modules", @@ -36,7 +36,7 @@ "validate-json-single": "yarn workspace @corona-dashboard/common build && ts-node src/scripts/validate-json-single.ts", "validate-last-values": "yarn workspace @corona-dashboard/common build && ts-node src/scripts/validate-last-values.ts", "generate-data-types": "yarn workspace @corona-dashboard/common build && ts-node src/scripts/generate-data-types.ts", - "generate-data-structures": "ts-node src/scripts/generate-data-structures.ts" + "generate-data-structures": "node --loader ts-node/esm src/scripts/generate-data-structures.ts" }, "devDependencies": { "@types/node": "^16.11.11", diff --git a/packages/cms-v2/package.json b/packages/cms-v2/package.json index 8b96bc02de..4cbdd12b7c 100644 --- a/packages/cms-v2/package.json +++ b/packages/cms-v2/package.json @@ -13,16 +13,16 @@ "test:ci": "echo 'Sanity check is deprecated \n@TODO add sanity test ci script'", "typecheck": "tsc --pretty --noEmit", "lint": "eslint .", - "lokalize:import": "ts-node src/lokalize/import.ts", - "lokalize:add": "ts-node src/lokalize/lokalize-add.ts", - "lokalize:dedupe": "ts-node src/lokalize/clean-duplicates.ts", - "lokalize:apply-json-edits": "ts-node src/lokalize/apply-json-edits.ts", - "lokalize:generate-types": "ts-node src/lokalize/generate-types.ts", - "lokalize:sync-after-release": "ts-node src/lokalize/sync-after-release.ts", - "lokalize:sync-after-feature": "ts-node src/lokalize/sync-after-feature.ts", - "lokalize:sync-prd-to-dev": "ts-node src/lokalize/sync-prd-to-dev.ts", + "lokalize:import": "node --loader ts-node/esm src/lokalize/import.ts", + "lokalize:add": "node --loader ts-node/esm src/lokalize/lokalize-add.ts", + "lokalize:dedupe": "node --loader ts-node/esm src/lokalize/clean-duplicates.ts", + "lokalize:apply-json-edits": "node --loader ts-node/esm src/lokalize/apply-json-edits.ts", + "lokalize:generate-types": "node --loader ts-node/esm src/lokalize/generate-types.ts", + "lokalize:sync-after-release": "node --loader ts-node/esm src/lokalize/sync-after-release.ts", + "lokalize:sync-after-feature": "node --loader ts-node/esm src/lokalize/sync-after-feature.ts", + "lokalize:sync-prd-to-dev": "node --loader ts-node/esm src/lokalize/sync-prd-to-dev.ts", "lokalize:strip-unused-keys": "yarn lokalize:import --clean-json && ts-node src/lokalize/strip-unused-keys.ts && yarn lokalize:import --clean-json && yarn workspace @corona-dashboard/app typecheck", - "elements:add": "ts-node src/elements/add.ts", + "elements:add": "node --loader ts-node/esm src/elements/add.ts", "format": "prettier --write \"src/**/*.{js,ts,tsx}\" \"*.{js,json,md,yml}\"" }, "dependencies": { diff --git a/packages/cms/package.json b/packages/cms/package.json index 497ccac7ad..404903bffe 100644 --- a/packages/cms/package.json +++ b/packages/cms/package.json @@ -13,15 +13,15 @@ "deploy": "yarn workspace @corona-dashboard/common build && yarn workspace @corona-dashboard/icons build && yarn workspace @corona-dashboard/cli generate-data-structures && sanity deploy", "typecheck": "tsc --pretty --noEmit", "lint": "eslint .", - "lokalize:import": "ts-node src/lokalize/scripts/import.ts", - "lokalize:add": "ts-node src/lokalize/scripts/add-new-lokalize-document.ts", - "lokalize:apply-json-edits": "ts-node src/lokalize/scripts/apply-json-edits.ts", - "lokalize:generate-types": "ts-node src/lokalize/scripts/generate-types.ts", - "lokalize:sync-after-release": "ts-node src/lokalize/scripts/sync-after-release.ts", - "lokalize:sync-after-feature": "ts-node src/lokalize/scripts/sync-after-feature.ts", - "lokalize:sync-prd-to-dev": "ts-node src/lokalize/scripts/sync-prd-to-dev.ts", - "elements:add": "ts-node src/studio/scripts/add-chart.ts", - "elements:remove": "ts-node src/studio/scripts/remove-chart.ts", + "lokalize:import": "node --loader ts-node/esm src/lokalize/scripts/import.ts", + "lokalize:add": "node --loader ts-node/esm src/lokalize/scripts/add-new-lokalize-document.ts", + "lokalize:apply-json-edits": "node --loader ts-node/esm src/lokalize/scripts/apply-json-edits.ts", + "lokalize:generate-types": "node --loader ts-node/esm src/lokalize/scripts/generate-types.ts", + "lokalize:sync-after-release": "node --loader ts-node/esm src/lokalize/scripts/sync-after-release.ts", + "lokalize:sync-after-feature": "node --loader ts-node/esm src/lokalize/scripts/sync-after-feature.ts", + "lokalize:sync-prd-to-dev": "node --loader ts-node/esm src/lokalize/scripts/sync-prd-to-dev.ts", + "elements:add": "node --loader ts-node/esm src/studio/scripts/add-chart.ts", + "elements:remove": "node --loader ts-node/esm src/studio/scripts/remove-chart.ts", "format": "prettier --write \"src/**/*.{js,ts,tsx}\" \"*.{js,json,md,yml}\"" }, "keywords": [ diff --git a/yarn.lock b/yarn.lock index 99c9d593cb..914b599135 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3964,7 +3964,6 @@ __metadata: "@types/react-dom": ^17.0.11 "@types/react-is": ^17.0.3 "@types/react-test-renderer": ^17.0.1 - "@types/sharp": ^0.29.4 "@types/sinon": ^10.0.6 "@types/styled-components": ^5.1.25 "@types/styled-system": ^5.1.15 @@ -4045,7 +4044,7 @@ __metadata: react-test-renderer: ^17.0.2 resize-observer-polyfill: ^1.5.1 sanitize-filename: ^1.6.3 - sharp: ^0.30.5 + sharp: ^0.32.6 sinon: ^11.1.2 styled-components: ^5.3.5 styled-system: ^5.1.5 @@ -10291,15 +10290,6 @@ __metadata: languageName: node linkType: hard -"@types/sharp@npm:^0.29.4": - version: 0.29.4 - resolution: "@types/sharp@npm:0.29.4" - dependencies: - "@types/node": "*" - checksum: 155313a87f720248c0b14a0cd2eab44b3319a160133e308d3ec643a2b0e2a430dd54183eb4f349d7ccd1c10306c40dbd82752260812c87caea36749c3e0b186c - languageName: node - linkType: hard - "@types/sinon@npm:^10.0.6": version: 10.0.6 resolution: "@types/sinon@npm:10.0.6" @@ -12262,6 +12252,13 @@ __metadata: languageName: node linkType: hard +"b4a@npm:^1.6.4": + version: 1.6.4 + resolution: "b4a@npm:1.6.4" + checksum: 81b086f9af1f8845fbef4476307236bda3d660c158c201db976f19cdce05f41f93110ab6b12fd7a2696602a490cc43d5410ee36a56d6eef93afb0d6ca69ac3b2 + languageName: node + linkType: hard + "babel-code-frame@npm:^6.26.0": version: 6.26.0 resolution: "babel-code-frame@npm:6.26.0" @@ -16099,13 +16096,20 @@ __metadata: languageName: node linkType: hard -"detect-libc@npm:^2.0.0, detect-libc@npm:^2.0.1": +"detect-libc@npm:^2.0.0": version: 2.0.1 resolution: "detect-libc@npm:2.0.1" checksum: ccb05fcabbb555beb544d48080179c18523a343face9ee4e1a86605a8715b4169f94d663c21a03c310ac824592f2ba9a5270218819bb411ad7be578a527593d7 languageName: node linkType: hard +"detect-libc@npm:^2.0.2": + version: 2.0.2 + resolution: "detect-libc@npm:2.0.2" + checksum: 2b2cd3649b83d576f4be7cc37eb3b1815c79969c8b1a03a40a4d55d83bc74d010753485753448eacb98784abf22f7dbd3911fd3b60e29fda28fed2d1a997944d + languageName: node + linkType: hard + "detect-node-es@npm:^1.1.0": version: 1.1.0 resolution: "detect-node-es@npm:1.1.0" @@ -18169,6 +18173,13 @@ __metadata: languageName: node linkType: hard +"fast-fifo@npm:^1.1.0, fast-fifo@npm:^1.2.0": + version: 1.3.2 + resolution: "fast-fifo@npm:1.3.2" + checksum: 6bfcba3e4df5af7be3332703b69a7898a8ed7020837ec4395bb341bd96cc3a6d86c3f6071dd98da289618cf2234c70d84b2a6f09a33dd6f988b1ff60d8e54275 + languageName: node + linkType: hard + "fast-glob@npm:^3.0.3, fast-glob@npm:^3.1.1, fast-glob@npm:^3.2.7": version: 3.2.7 resolution: "fast-glob@npm:3.2.7" @@ -23694,12 +23705,12 @@ __metadata: languageName: node linkType: hard -"node-addon-api@npm:^5.0.0": - version: 5.0.0 - resolution: "node-addon-api@npm:5.0.0" +"node-addon-api@npm:^6.1.0": + version: 6.1.0 + resolution: "node-addon-api@npm:6.1.0" dependencies: node-gyp: latest - checksum: 7c5e2043ac37f6108784d94ed73a44ae6d3e68eb968de60680922fc6bc3d17fa69448c0feb4e0c9d3f4c74a0324822e566a8340a56916d9d6f23cb3e85620334 + checksum: 3a539510e677cfa3a833aca5397300e36141aca064cdc487554f2017110709a03a95da937e98c2a14ec3c626af7b2d1b6dabe629a481f9883143d0d5bff07bf2 languageName: node linkType: hard @@ -26436,7 +26447,7 @@ __metadata: languageName: node linkType: hard -"prebuild-install@npm:^7.1.0": +"prebuild-install@npm:^7.1.1": version: 7.1.1 resolution: "prebuild-install@npm:7.1.1" dependencies: @@ -26924,6 +26935,13 @@ __metadata: languageName: node linkType: hard +"queue-tick@npm:^1.0.1": + version: 1.0.1 + resolution: "queue-tick@npm:1.0.1" + checksum: 57c3292814b297f87f792fbeb99ce982813e4e54d7a8bdff65cf53d5c084113913289d4a48ec8bbc964927a74b847554f9f4579df43c969a6c8e0f026457ad01 + languageName: node + linkType: hard + "quick-lru@npm:^4.0.1": version: 4.0.1 resolution: "quick-lru@npm:4.0.1" @@ -29475,6 +29493,17 @@ __metadata: languageName: node linkType: hard +"semver@npm:^7.5.4": + version: 7.5.4 + resolution: "semver@npm:7.5.4" + dependencies: + lru-cache: ^6.0.0 + bin: + semver: bin/semver.js + checksum: 12d8ad952fa353b0995bf180cdac205a4068b759a140e5d3c608317098b3575ac2f1e09182206bf2eb26120e1c0ed8fb92c48c592f6099680de56bb071423ca3 + languageName: node + linkType: hard + "send@npm:0.17.1": version: 0.17.1 resolution: "send@npm:0.17.1" @@ -29643,20 +29672,20 @@ __metadata: languageName: node linkType: hard -"sharp@npm:^0.30.5": - version: 0.30.6 - resolution: "sharp@npm:0.30.6" +"sharp@npm:^0.32.6": + version: 0.32.6 + resolution: "sharp@npm:0.32.6" dependencies: color: ^4.2.3 - detect-libc: ^2.0.1 - node-addon-api: ^5.0.0 + detect-libc: ^2.0.2 + node-addon-api: ^6.1.0 node-gyp: latest - prebuild-install: ^7.1.0 - semver: ^7.3.7 + prebuild-install: ^7.1.1 + semver: ^7.5.4 simple-get: ^4.0.1 - tar-fs: ^2.1.1 + tar-fs: ^3.0.4 tunnel-agent: ^0.6.0 - checksum: 2560b5769d78ee660d767e59f6fa56531c448d16383f9700e4ecb8016382104c1bb42991bdd4ea741c0f4d934ea5246c5d602fc5f39062bcc1c2c8786421fd5a + checksum: 0cca1d16b1920800c0e22d27bc6305f4c67c9ebe44f67daceb30bf645ae39e7fb7dfbd7f5d6cd9f9eebfddd87ac3f7e2695f4eb906d19b7a775286238e6a29fc languageName: node linkType: hard @@ -30338,6 +30367,16 @@ __metadata: languageName: node linkType: hard +"streamx@npm:^2.15.0": + version: 2.15.6 + resolution: "streamx@npm:2.15.6" + dependencies: + fast-fifo: ^1.1.0 + queue-tick: ^1.0.1 + checksum: 37a245f5cee4c33fcb8b018ccb935bad6eab423f05b0d14d018e63dbd2670bb109a69442e961a195b750c2c774f613c19476d11bd727d645eedb655d2dba234b + languageName: node + linkType: hard + "strict-uri-encode@npm:^1.0.0": version: 1.1.0 resolution: "strict-uri-encode@npm:1.1.0" @@ -31029,6 +31068,17 @@ __metadata: languageName: node linkType: hard +"tar-fs@npm:^3.0.4": + version: 3.0.4 + resolution: "tar-fs@npm:3.0.4" + dependencies: + mkdirp-classic: ^0.5.2 + pump: ^3.0.0 + tar-stream: ^3.1.5 + checksum: dcf4054f9e92ca0efe61c2b3f612914fb259a47900aa908a63106513a6d006c899b426ada53eb88d9dbbf089b5724c8e90b96a2c4ca6171845fa14203d734e30 + languageName: node + linkType: hard + "tar-stream@npm:^1.1.2, tar-stream@npm:^1.5.2": version: 1.6.2 resolution: "tar-stream@npm:1.6.2" @@ -31057,6 +31107,17 @@ __metadata: languageName: node linkType: hard +"tar-stream@npm:^3.1.5": + version: 3.1.6 + resolution: "tar-stream@npm:3.1.6" + dependencies: + b4a: ^1.6.4 + fast-fifo: ^1.2.0 + streamx: ^2.15.0 + checksum: f3627f918581976e954ff03cb8d370551053796b82564f8c7ca8fac84c48e4d042026d0854fc222171a34ff9c682b72fae91be9c9b0a112d4c54f9e4f443e9c5 + languageName: node + linkType: hard + "tar@npm:^6.0.2, tar@npm:^6.1.2": version: 6.1.11 resolution: "tar@npm:6.1.11" From bcfb7fa531daf205cd1a33bf445bc8a12be9cc23 Mon Sep 17 00:00:00 2001 From: Ben van Eekelen Date: Mon, 18 Dec 2023 16:05:46 +0100 Subject: [PATCH 3/5] feature/COR-1837-update-archived-timeframes (#4954) * refactor(COR-1837): Refactor variables * feat(COR-1837): Set timeframe of archived graphs to max --- .../src/domain/variants/variants-stacked-area-tile.tsx | 8 ++++---- .../app/src/pages/gemeente/[code]/positieve-testen.tsx | 2 +- packages/app/src/pages/landelijk/positieve-testen.tsx | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/app/src/domain/variants/variants-stacked-area-tile.tsx b/packages/app/src/domain/variants/variants-stacked-area-tile.tsx index 1ba3a953bb..e311c337d4 100644 --- a/packages/app/src/domain/variants/variants-stacked-area-tile.tsx +++ b/packages/app/src/domain/variants/variants-stacked-area-tile.tsx @@ -25,7 +25,7 @@ interface VariantsStackedAreaTileProps { } export const VariantsStackedAreaTile = ({ text, values, variantColors, metadata }: VariantsStackedAreaTileProps) => { - const [variantTimeframe, setVariantTimeframe] = useState(TimeframeOption.THREE_MONTHS); + const [variantStackedAreaTimeframe, setVariantStackedAreaTimeframe] = useState(TimeframeOption.ALL); const { list, toggle, clear } = useList(alwaysEnabled); @@ -54,8 +54,8 @@ export const VariantsStackedAreaTile = ({ text, values, variantColors, metadata description={text.toelichting} metadata={metadata} timeframeOptions={TimeframeOptionsList} - timeframeInitialValue={TimeframeOption.THREE_MONTHS} - onSelectTimeframe={setVariantTimeframe} + timeframeInitialValue={variantStackedAreaTimeframe} + onSelectTimeframe={setVariantStackedAreaTimeframe} > @@ -64,7 +64,7 @@ export const VariantsStackedAreaTile = ({ text, values, variantColors, metadata key: 'variants_stacked_area_over_time_chart', }} values={values} - timeframe={variantTimeframe} + timeframe={variantStackedAreaTimeframe} seriesConfig={filteredConfig} disableLegend dataOptions={{ diff --git a/packages/app/src/pages/gemeente/[code]/positieve-testen.tsx b/packages/app/src/pages/gemeente/[code]/positieve-testen.tsx index 2683347f11..7daa7365ca 100644 --- a/packages/app/src/pages/gemeente/[code]/positieve-testen.tsx +++ b/packages/app/src/pages/gemeente/[code]/positieve-testen.tsx @@ -79,7 +79,7 @@ export const getStaticProps = createGetStaticProps( function PositivelyTestedPeople(props: StaticProps) { const { pageText, selectedGmData: data, selectedArchivedGmData: archivedData, archivedChoropleth, municipalityName, content, lastGenerated } = props; - const [positivelyTestedPeopleTimeframe, setpositivelyTestedPeopleTimeframe] = useState(TimeframeOption.SIX_MONTHS); + const [positivelyTestedPeopleTimeframe, setpositivelyTestedPeopleTimeframe] = useState(TimeframeOption.ALL); const { commonTexts, formatNumber, formatDateFromSeconds } = useIntl(); const reverseRouter = useReverseRouter(); const { textGm, textShared } = useDynamicLokalizeTexts(pageText, selectLokalizeTexts); diff --git a/packages/app/src/pages/landelijk/positieve-testen.tsx b/packages/app/src/pages/landelijk/positieve-testen.tsx index 7b259eef60..a282fde636 100644 --- a/packages/app/src/pages/landelijk/positieve-testen.tsx +++ b/packages/app/src/pages/landelijk/positieve-testen.tsx @@ -78,7 +78,7 @@ export const getStaticProps = createGetStaticProps( function PositivelyTestedPeople(props: StaticProps) { const { pageText, selectedArchivedNlData: data, archivedChoropleth, content, lastGenerated } = props; - const [confirmedCasesInfectedTimeframe, setConfirmedCasesInfectedTimeframe] = useState(TimeframeOption.SIX_MONTHS); + const [confirmedCasesInfectedTimeframe, setConfirmedCasesInfectedTimeframe] = useState(TimeframeOption.ALL); const [confirmedCasesInfectedPercentageTimeframe, setConfirmedCasesInfectedPercentageTimeframe] = useState(TimeframeOption.ALL); From 1cf37cce4c38ad7074d0d1b6fccec3ea3b54754e Mon Sep 17 00:00:00 2001 From: Ben van Eekelen Date: Tue, 19 Dec 2023 14:46:17 +0100 Subject: [PATCH 4/5] feat(COR-1896): Remove campaign banner and sanity keys from vaccine page (#4956) --- packages/app/src/pages/landelijk/de-coronaprik.tsx | 7 ------- packages/cms/src/lokalize/key-mutations.csv | 3 +++ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/packages/app/src/pages/landelijk/de-coronaprik.tsx b/packages/app/src/pages/landelijk/de-coronaprik.tsx index 0d788c436f..6003cfbc21 100644 --- a/packages/app/src/pages/landelijk/de-coronaprik.tsx +++ b/packages/app/src/pages/landelijk/de-coronaprik.tsx @@ -15,7 +15,6 @@ import { WarningTile } from '~/components/warning-tile'; import { Layout, NlLayout } from '~/domain/layout'; import { Autumn2022ShotCoveragePerAgeGroup, - CampaignBanner, VaccinationsKpiHeader, VaccinationsOverTimeTile, VaccinationsShotKpiSection, @@ -226,12 +225,6 @@ function VaccinationPage(props: StaticProps) { }} /> - - Date: Fri, 22 Dec 2023 10:45:17 +0100 Subject: [PATCH 5/5] bugfix/COR-1865-no-auto-resolve-1970 (#4955) * fix(COR-1865): Throw error if pageMetric not found in data * refactor(COR-1865): Refactored code * refactor(COR-1865): Refactored metric filter * refactor(COR-1865): Force undo changes from commit hook * fix(COR-1865): Update tests to work with new error mechanism * add newline * add more newline --- .../get-last-insertion-date-of-page.spec.ts | 16 +++++++--------- .../src/utils/get-last-insertion-date-of-page.ts | 12 ++++++++++-- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/packages/app/src/utils/__tests__/get-last-insertion-date-of-page.spec.ts b/packages/app/src/utils/__tests__/get-last-insertion-date-of-page.spec.ts index 6119f655c3..4226f0f2b9 100644 --- a/packages/app/src/utils/__tests__/get-last-insertion-date-of-page.spec.ts +++ b/packages/app/src/utils/__tests__/get-last-insertion-date-of-page.spec.ts @@ -4,17 +4,15 @@ import { getLastInsertionDateOfPage } from '../get-last-insertion-date-of-page'; const GetLastDateOfInsertion = suite('getLastInsertionDateOfPage'); -GetLastDateOfInsertion('returns zero when data is empty', () => { - const result = getLastInsertionDateOfPage({}, ['key1']); - assert.is(result, 0); +GetLastDateOfInsertion('returns error when data is empty', () => { + assert.throws(() => getLastInsertionDateOfPage({}, ['key1']), /Pagemetrics not found in data/) }); -GetLastDateOfInsertion('returns zero when metrics are empty', () => { - const result = getLastInsertionDateOfPage( - { key1: { last_value: { date_of_insertion_unix: 123 } } }, - [] - ); - assert.is(result, 0); +GetLastDateOfInsertion('returns error when metrics are empty', () => { + assert.throws(() => getLastInsertionDateOfPage( + { key1: { last_value: { date_of_insertion_unix: 123 } } }, + [] + ), /Pagemetrics not found in data/); }); GetLastDateOfInsertion('returns the max date_of_insertion_unix', () => { diff --git a/packages/app/src/utils/get-last-insertion-date-of-page.ts b/packages/app/src/utils/get-last-insertion-date-of-page.ts index 126952d102..b689ed7800 100644 --- a/packages/app/src/utils/get-last-insertion-date-of-page.ts +++ b/packages/app/src/utils/get-last-insertion-date-of-page.ts @@ -59,10 +59,18 @@ export function getLastInsertionDateOfPage( data: unknown, pageMetrics: string[] ) { - return pageMetrics.reduce((lastDate, metricProperty) => { + const metricsAvailableInData: string[] = pageMetrics.filter((metricProperty) => { + return typeof get(data, metricProperty) !== 'undefined'; + }); + + if (metricsAvailableInData.length === 0) { + throw new Error(`Pagemetrics not found in data`); + } + + return metricsAvailableInData.reduce((lastDate, metricProperty) => { const metric: any = get(data, metricProperty); const metricDate = getMetricDate(metric); - return Math.max(metricDate, lastDate); }, 0); }; +