Skip to content

Commit

Permalink
fix: cds website isodid cds morph
Browse files Browse the repository at this point in the history
  • Loading branch information
francesco-filicetti committed Aug 1, 2024
1 parent ce29e9a commit 07d31b0
Showing 1 changed file with 25 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
{% storage_settings_value "CURRENT_YEAR" as current_year %}
{% storage_settings_value "PENTAHO_ISODID_REPORT_START_YEAR" as pentaho_isodid_start_year %}

{% get_cds_website_morph cds_cod as old_cds_identifiers %}

{% include "includes/unical_storage_loading.html" %}


Expand Down Expand Up @@ -147,6 +149,8 @@
url: '{{ base_api }}{{ pentaho_api }}{{ cds_cod }}/{{ pentaho_isodid_api }}',
is_loading: true,
loader_source: '{{ base_api }}{{ pentaho_api }}{{ cds_cod }}/{{ pentaho_isodid_api }}',
old_cds_identifiers: {{ old_cds_identifiers|safe }},
old_data_found: false
}
},
mounted() {
Expand All @@ -166,18 +170,36 @@
.replace(/\s+/g, '-') // replace spaces with hyphens
.replace(/-+/g, '-'); // remove consecutive hyphens
},
async getOldData() {
for(let i=0;i<this.old_cds_identifiers.length;i++) {
if(this.old_data_found) break;
let url = '{{ base_api }}{{ pentaho_api }}' + this.old_cds_identifiers[i] + '/{{ pentaho_isodid_api }}?year=' + this.active_year
await axios
.get(url)
.then(response => {
if(Object.keys(response.data).length > 0){
this.old_data_found = true
this.data = response.data.data
}
})
}
},
async callURL(year=null) {
this.is_loading = true
this.data = {}
let url = this.url
if(year) {
this.active_year = year
url = url + '?year=' + year
}
let url = this.url + '?year=' + this.active_year
await axios
.get(url)
.then(response => {
this.data = response.data.data
if(Object.keys(response.data).length > 0){
this.data = response.data.data
}
else {
this.getOldData()
}
this.is_loading = false
})
this.drawCharts()
Expand Down

0 comments on commit 07d31b0

Please sign in to comment.