From f33dcef1bd70b5ec8563b377b2bb52f004a73004 Mon Sep 17 00:00:00 2001 From: Arnau Sanchez Date: Mon, 26 Aug 2024 10:28:36 +0200 Subject: [PATCH 1/3] fix: Get categoryOption code (need for country matching) --- src/models/dataset.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/models/dataset.js b/src/models/dataset.js index e0b9e178..500bbde3 100644 --- a/src/models/dataset.js +++ b/src/models/dataset.js @@ -35,7 +35,7 @@ export function getProject(d2, config, dataset) { .filter() .on("categories.id") .equals(config.categoryProjectsId) - .list({ fields: "id,displayName", paging: false }) + .list({ fields: "id,code,displayName", paging: false }) .then(collection => collection.toArray()) .then(projects => _(projects).find(project => _.includes(dataset.name, project.displayName)) From 27a0b57aa0f477fc5940098cd937e1e20c004fdd Mon Sep 17 00:00:00 2001 From: Arnau Sanchez Date: Mon, 26 Aug 2024 10:40:23 +0200 Subject: [PATCH 2/3] fix: Get country IDs from dataSet OUs for matching --- src/models/DataSetStore.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/models/DataSetStore.js b/src/models/DataSetStore.js index c7684608..6951dc0b 100644 --- a/src/models/DataSetStore.js +++ b/src/models/DataSetStore.js @@ -427,11 +427,16 @@ export default class DataSetStore { const projectCountryCode = project && project.code ? project.code.slice(0, 2).toUpperCase() : null; + const dataSetCountryIds = _(toArray(dataset.organisationUnits)) + .map(ou => ou.path.split("/")[3]) + .uniq() + .value(); + if (projectCountryCode && countriesByCode[projectCountryCode]) { return [countriesByCode[projectCountryCode]]; } else { return _(countriesById) - .at(toArray(dataset.organisationUnits).map(ou => ou.id)) + .at(dataSetCountryIds) .compact() .value(); } From 79773167a626529c1ee0ac8f5850cf9c8f7466b8 Mon Sep 17 00:00:00 2001 From: Adrian Quintana Date: Mon, 26 Aug 2024 13:05:00 +0100 Subject: [PATCH 3/3] bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f78fa23a..4d091f9f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "d2-dataset-configuration", - "version": "2.6.2", + "version": "2.6.3", "description": "Dataset Configuration User Interface", "main": "src/index.html", "scripts": {