Skip to content

Commit

Permalink
Merge pull request #460 from EyeSeeTea/development
Browse files Browse the repository at this point in the history
Release 2.6.3
  • Loading branch information
adrianq authored Sep 2, 2024
2 parents 19ef0e7 + 3b250d8 commit bcb749a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
7 changes: 6 additions & 1 deletion src/models/DataSetStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
2 changes: 1 addition & 1 deletion src/models/dataset.js
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit bcb749a

Please sign in to comment.