Skip to content

Commit

Permalink
Fix pillar field in projects csv import
Browse files Browse the repository at this point in the history
  • Loading branch information
yulia-bel authored and mluena committed Aug 29, 2024
1 parent bad888f commit d7a32d3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cms/src/api/project/services/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import * as stringify from 'csv-stringify/sync';
interface ProjectRow {
countries: string;
sdgs: string;
pillars: string;
pillar: string;
[key: string]: any;
}

Expand Down Expand Up @@ -66,7 +66,7 @@ export default factories.createCoreService('api::project.project', {
const updatedRecords = await Promise.all(records.map(async (row: ProjectRow) => {
const countryNames = row.countries.split(';').map(name => name.trim());
const sdgNames = row.sdgs.split(';').map(name => name.trim());
const pillarNames = row.pillars.split(';').map(name => name.trim());
const pillarNames = row.pillar.split(';').map(name => name.trim());

const countryIds = await Promise.all(countryNames.map(name => findCountryIdByName(name)));
const sdgIds = await Promise.all(sdgNames.map(name => findSdgIdByName(name)));
Expand All @@ -77,7 +77,7 @@ export default factories.createCoreService('api::project.project', {
...row,
countries: countryIds,
sdgs: sdgIds,
pillars: pillarIds,
pillar: pillarIds,
publishedAt,
};

Expand Down

0 comments on commit d7a32d3

Please sign in to comment.