Skip to content

Commit

Permalink
fix: cds corso page loading_bar
Browse files Browse the repository at this point in the history
  • Loading branch information
francesco-filicetti committed Dec 31, 2024
1 parent d57fb77 commit 21228f5
Showing 1 changed file with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,6 @@
is_loading_academicyears: true,
selected_year: '',
old_cds_identifiers: {{ old_cds_identifiers|safe }},
old_cds_found: false
}
},
mounted() {
Expand All @@ -533,14 +532,16 @@
methods: {
{% include "includes/unical_storage_cds_website_scroll.html" %}
async getOldPlans(year) {
let old_cds_found = false
for(let i=0;i<this.old_cds_identifiers.length;i++) {
if(this.old_cds_found) break;
//this.curricula = []
if(old_cds_found) break;
await axios
.get('{{ base_api }}{{ cds_websites_studyplans_api }}?lang={{ LANGUAGE_CODE }}&cds_cod=' + this.old_cds_identifiers[i] + '&year=' + year)
.then(response => {
let curricula = []
if(response.data.results.length > 0) {
this.old_cds_found = true
old_cds_found = true
response.data.results[0].PlanTabs.forEach(
function (plantab) {
if (!curricula.includes(plantab.PdsDes)) {
Expand All @@ -551,12 +552,11 @@
this.curricula = curricula
this.items = response.data.results[0]
_cds_data.CallURL(response.data.results[0]['RegDidId'])
this.is_loading = false
this.scrollPage()
}
})
}
this.old_cds_found = false
//this.old_cds_found = false
},
callStudyPlans(year={{ cds_website_future_year }}) {
this.is_loading = true
Expand All @@ -574,13 +574,12 @@
)
this.curricula = curricula
this.items = response.data.results[0]
this.is_loading = false
this.scrollPage()
}
else{
this.getOldPlans(year)
}

this.is_loading = false
})
},
callAcademicYears() {
Expand All @@ -601,12 +600,18 @@
})
},
callCdsByYear(year) {
this.curricula = []
this.items = {}
let cds_year_url = '{{ base_api }}{{ cds_api }}?lang={{ LANGUAGE_CODE }}&academicyear=' + year + '&cdscod={{ cds_identifier }}'
axios
.get(cds_year_url)
.then(response => {
if(response.data.results.length>0 && 'RegDidId' in response.data.results[0])
if(response.data.results.length>0 && 'RegDidId' in response.data.results[0]) {
_cds_data.CallURL(response.data.results[0]['RegDidId'])
} else {
_cds_data.cds = {}
_cds_data.cds_labels = {}
}
}
)
},
Expand Down

0 comments on commit 21228f5

Please sign in to comment.