diff --git a/src/views/network/AntennaCriteriaCheck.vue b/src/views/network/AntennaCriteriaCheck.vue index c1ade1e09..4241647a5 100644 --- a/src/views/network/AntennaCriteriaCheck.vue +++ b/src/views/network/AntennaCriteriaCheck.vue @@ -44,22 +44,22 @@ - Yes - + Yes + {{ props.row.latest_election }} - No - + No + {{ props.row.latest_election }} - No - Else + No + Else - Yes - No - Else + Yes + No + Else @@ -75,16 +75,16 @@ - Yes - + Yes + {{ props.row.latest_event }} - No - + No + {{ props.row.latest_event }} - No - Else + No + Else @@ -164,7 +164,8 @@ export default { events: [], statutoryEvents: [], summerUniversities: [], - isLoading: false + isLoading: false, + isLoadingAgora: false } }, computed: { @@ -213,7 +214,7 @@ export default { this.hideSafeLocals = !this.hideSafeLocals }, fetchAgorae () { - this.isLoading = true + this.isLoadingAgora = true this.axios.get(this.services['statutory'], { params: { type: 'agora' } }).then((response) => { this.agorae = response.data.data if (this.agorae.length === 0) { @@ -222,9 +223,9 @@ export default { // Automatically set the most recent Agora as the selected one this.selectedAgora = this.agorae[0] this.fetchData() - this.isLoading = false + this.isLoadingAgora = false }).catch((err) => { - this.isLoading = false + this.isLoadingAgora = false this.$root.showError('Could not fetch statutory data', err) }) }, @@ -234,7 +235,10 @@ export default { this.axios.get(this.services['core'] + '/bodies').then(async (bodiesResponse) => { this.bodies = bodiesResponse.data.data this.bodies = this.bodies.filter(x => ['antenna', 'contact antenna', 'contact'].includes(x.type)) - this.bodies.forEach(body => { body.antennaCriteria = {} }) + this.bodies.forEach(body => { + body.antennaCriteria = {} + body.comments = {} + }) const promises = [] promises.push(this.checkBoardCriterium()) @@ -282,7 +286,6 @@ export default { await this.axios.get(this.services['events'] + '/recents', { params: { ends: this.selectedAgora.ends } }).then((response) => { this.events = response.data.data }).catch((err) => { - this.isLoading = false this.$root.showError('Could not fetch event data', err) }) }, @@ -290,7 +293,6 @@ export default { await this.axios.get(this.services['statutory'] + '/recents', { params: { ends: this.selectedAgora.ends } }).then((response) => { this.statutoryEvents = response.data.data }).catch((err) => { - this.isLoading = false this.$root.showError('Could not fetch statutory event data', err) }) }, @@ -298,7 +300,6 @@ export default { await this.axios.get(this.services['summeruniversity'] + '/recents', { params: { ends: this.selectedAgora.ends } }).then((response) => { this.summerUniversities = response.data.data }).catch((err) => { - this.isLoading = false this.$root.showError('Could not fetch Summer University data', err) }) }, @@ -333,7 +334,7 @@ export default { for (const body in this.bodies) { // Check if the last event is in the past 2 years - this.bodies[body].antennaCriteria.events = this.bodies[body].latest_event !== undefined && moment(this.bodies[body].latest_event).diff(moment(this.selectedAgora.ends), 'years', true) <= 2 + this.bodies[body].antennaCriteria.events = String(this.bodies[body].latest_event !== undefined && moment(this.bodies[body].latest_event).diff(moment(this.selectedAgora.ends), 'years', true) <= 2) if (this.bodies[body].latest_event !== undefined) this.bodies[body].latest_event = moment(this.bodies[body].latest_event).format('M[/]YYYY') } }, @@ -346,21 +347,20 @@ export default { for (const body in this.bodies) { // Check if the current board was elected within the past year - this.bodies[body].antennaCriteria.boardElection = this.bodies[body].latest_election !== undefined && moment(this.bodies[body].latest_election).diff(moment(this.selectedAgora.ends), 'years', true) <= 1 + this.bodies[body].antennaCriteria.boardElection = String(this.bodies[body].latest_election !== undefined && moment(this.bodies[body].latest_election).diff(moment(this.selectedAgora.ends), 'years', true) <= 1) if (this.bodies[body].latest_election !== undefined) this.bodies[body].latest_election = moment(this.bodies[body].latest_election).format('D[/]M[/]YYYY') } }).catch((err) => { - this.isLoading = false this.$root.showError('Could not fetch boards data', err) }) }, async checkMembersList () { - await this.axios.get(this.services['statutory'] + '/events/' + this.selectedAgora.id + '/memberslists/missing').then((membersListResponse) => { - for (const body in this.bodies) { - this.bodies[body].antennaCriteria.membersList = this.bodies[body].id in membersListResponse.data.data.map(x => x.id) + await this.axios.get(this.services['statutory'] + '/events/' + this.selectedAgora.id + '/memberslists').then((membersListsResponse) => { + for (const membersList of membersListsResponse.data.data) { + const body = this.bodies.find(x => x.id === membersList.body_id) + body.antennaCriteria.membersList = 'true' } }).catch((err) => { - this.isLoading = false this.$root.showError('Could not fetch members list data', err) }) }, @@ -376,7 +376,6 @@ export default { body.comments[criterionName] = criterion.comment } }).catch((err) => { - this.isLoading = false this.$root.showError('Could not fetch manual Antenna Criteria fulfilment', err) }) } diff --git a/src/views/network/AntennaCriteriaInfo.vue b/src/views/network/AntennaCriteriaInfo.vue index 2139c3b16..994256db8 100644 --- a/src/views/network/AntennaCriteriaInfo.vue +++ b/src/views/network/AntennaCriteriaInfo.vue @@ -6,7 +6,7 @@