Skip to content

Commit

Permalink
Merge branch 'development' of https://github.com/basedosdados/website
Browse files Browse the repository at this point in the history
…into development
  • Loading branch information
AldemirLucas committed Nov 6, 2024
2 parents 675e29f + 5e6d6e9 commit ba8811c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
23 changes: 16 additions & 7 deletions next/components/atoms/ObservationLevelTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,25 @@ export default function ObservationLevel({ resource }) {

const headers = [t('observationLevelTable.entityHeader'), t('observationLevelTable.columnsHeader')];

let array = []
const keys = Object.keys(resource?.observationLevels)
function sortElements(a, b) {
if (a.order < b.order) {
return -1;
}
if (a.order > b.order) {
return 1;
}
return 0;
}

keys.forEach((elm) => {
const value = resource?.observationLevels[elm]
let array = [];
const keys = Object.keys(resource?.observationLevels);
const sortedLevels = Object.values(resource?.observationLevels).sort(sortElements);

sortedLevels.forEach((value) => {
const valueEntity = () => {
if(value.entity[`name${capitalize(locale)}`]) return value.entity[`name${capitalize(locale)}`]
if(value.entity.name) return value.entity.name
return t('observationLevelTable.notProvided')
if(value.entity[`name${capitalize(locale)}`]) return value.entity[`name${capitalize(locale)}`];
if(value.entity.name) return value.entity.name;
return t('observationLevelTable.notProvided');
}

const valueColumns = () => {
Expand Down
1 change: 1 addition & 0 deletions next/pages/api/rawDataSources/getRawDataSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ async function getRawDataSource(id, locale = 'pt') {
edges {
node {
_id
order
columns {
edges {
node {
Expand Down
6 changes: 6 additions & 0 deletions next/pages/api/tables/getTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ async function getTable(id, locale='pt') {
}
}
version
status {
_id
slug
}
isDeprecated
temporalCoverage
spatialCoverage
fullTemporalCoverage
Expand Down Expand Up @@ -107,6 +112,7 @@ async function getTable(id, locale='pt') {
edges {
node {
_id
order
columns {
edges {
node {
Expand Down

0 comments on commit ba8811c

Please sign in to comment.