Skip to content

Commit

Permalink
fix: E10a3 and E10a8 indicators fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
lubojr committed Nov 21, 2023
1 parent 7da408a commit ca025f2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 25 deletions.
24 changes: 11 additions & 13 deletions app/src/components/IndicatorData.vue
Original file line number Diff line number Diff line change
Expand Up @@ -154,16 +154,6 @@ export default {
};
},
mounted() {
if (Array.isArray(this.indicatorObject.time)) {
const d = this.indicatorObject.time[this.indicatorObject.time.length - 1];
if (d.toFormat) {
const formatted = d.toFormat('dd. MMM');
this.dataLayerTime = {
value: formatted,
name: formatted,
};
}
}
// add event listener for map up
window.addEventListener('message', this.mapTimeUpdatedHandler);
},
Expand Down Expand Up @@ -196,6 +186,14 @@ export default {
let labels = [];
const datasets = [];
if (indicator && featureData) {
if (['E10a3', 'E10a8'].includes(indicatorCode)) {
const d = featureData.time[featureData.time.length - 1];
const formatted = d?.toFormat('dd. MMM');
this.dataLayerTime = {

Check failure on line 192 in app/src/components/IndicatorData.vue

View workflow job for this annotation

GitHub Actions / deploy

Unexpected side effect in "datacollection" computed property
value: formatted,
name: formatted,
};
}
const { measurement } = featureData;
const colors = [];
Expand Down Expand Up @@ -895,11 +893,11 @@ export default {
let features = measurement.map((meas, i) => {
// Find correct NUTS ID Shape
const geom = nutsFeatures.find((f) => (
f.properties.NUTS_ID === featureData.siteName[i]));
f.properties.NUTS_ID === featureData.siteNameNUTS[i]));
let output;
if (geom) {
if (currIDs.indexOf(featureData.siteName[i]) === -1) {
currIDs.push(featureData.siteName[i]);
if (currIDs.indexOf(featureData.siteNameNUTS[i]) === -1) {
currIDs.push(featureData.siteNameNUTS[i]);
outline.push({
type: 'Feature',
properties: {},
Expand Down
12 changes: 0 additions & 12 deletions app/src/components/IndicatorTimeSelection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -239,27 +239,17 @@ export default {
},
watch: {
compareTime: {
deep: true,
handler(timeObj) {
this.compareTimeModel = timeObj;
},
},
originalTime: {
deep: true,
handler(timeObj) {
this.originalTimeModel = timeObj;
},
},
compareTimeModel: {
deep: true,
handler(timeObj) {
this.$emit('update:compareTime', timeObj);
},
},
originalTimeModel: {
deep: true,
handler(timeObj) {
this.$emit('update:originalTime', timeObj);
// Update the slider if the dropdown changes the value
// Find index base on value
let index = -1;
Expand All @@ -272,11 +262,9 @@ export default {
},
},
originalTimeIndex: {
deep: true,
handler(index) {
// Update the model when the slider index changes
if (index !== -1) {
this.$emit('update:originalTime', this.availableValues[index]);
this.originalTimeModel = this.availableValues[index];
}
},
Expand Down
4 changes: 4 additions & 0 deletions app/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,10 @@ export async function loadFeatureData(baseConfig, feature) {
time: 'time',
siteName: 'city',
};
if (['E10a3', 'E10a8'].includes(indicatorObject.indicator)) {
// special case including additional property in mapping
mapping.siteNameNUTS = 'site_name';
}
// Try to extract sub_aoi geometry information
if (data && data.length > 0 && 'sub_aoi' in data[0]) {
let features = null;
Expand Down

0 comments on commit ca025f2

Please sign in to comment.