Skip to content
Snippets Groups Projects
Commit 23ee6d75 authored by Pierre-Jean CHANCELLIER's avatar Pierre-Jean CHANCELLIER
Browse files

optimize computed variables

parent 408fe606
No related branches found
No related tags found
No related merge requests found
......@@ -79,7 +79,7 @@ export const NEWCOMERS = gql`
}
`
// Pour la page membres/index
// Pour la page membre
export const SEARCH_MEMBERS = gql`
query SearchMember($hint: String) {
idSearch(with: { hint: $hint }) {
......@@ -102,7 +102,7 @@ export const SEARCH_MEMBERS = gql`
}
`
// Pour la page membres/_hash
// Pour la page membre
export const SEARCH_MEMBER = gql`
query SearchMemberWithHash($hash: Hash!) {
idFromHash(hash: $hash) {
......
......@@ -27,9 +27,9 @@
['NEWCOMER', 'MISSING'].includes(idFromHash.status) &&
idFromHash.received_certifications.certifications.length < 5
}">
{{ $t("certification.recues") }} ({{ nbCertifs("received")
}}<span v-if="nbCertifsPending('received') != 0">{{
"&nbsp;+&nbsp;" + nbCertifsPending("received")
{{ $t("certification.recues") }} ({{ nbCertifsReceived
}}<span v-if="nbCertifsPendingReceived != 0">{{
"&nbsp;+&nbsp;" + nbCertifsPendingReceived
}}</span
>)
<BadgeDanger
......@@ -44,9 +44,9 @@
class="col-sm-10 col-md-7 col-lg-5 mx-auto"
v-if="['MISSING', 'MEMBER'].includes(idFromHash.status)">
<h3 class="h4 text-center">
{{ $t("certification.envoyees") }} ({{ nbCertifs("sent")
}}<span v-if="nbCertifsPending('sent') != 0">{{
"&nbsp;+&nbsp;" + nbCertifsPending("sent")
{{ $t("certification.envoyees") }} ({{ nbCertifsSent
}}<span v-if="nbCertifsPendingSent != 0">{{
"&nbsp;+&nbsp;" + nbCertifsPendingSent
}}</span
>)
</h3>
......@@ -65,7 +65,7 @@
import { SEARCH_MEMBER } from "@/graphql/queries"
export default {
name: 'membre',
name: "membre",
data() {
return {
breadcrumb: [
......@@ -85,28 +85,30 @@ export default {
error: null
}
},
methods: {
nbCertifs(sens) {
return sens == "received"
? this.idFromHash.received_certifications.certifications.filter(
(el) => {
return el.pending == false
}
).length
: this.idFromHash.sent_certifications.filter((el) => {
return el.pending == false
}).length
computed: {
nbCertifsSent() {
return this.idFromHash.sent_certifications.filter((el) => {
return el.pending == false
}).length
},
nbCertifsReceived() {
return this.idFromHash.received_certifications.certifications.filter(
(el) => {
return el.pending == false
}
).length
},
nbCertifsPending(sens) {
return sens == "received"
? this.idFromHash.received_certifications.certifications.filter(
(el) => {
return el.pending == true
}
).length
: this.idFromHash.sent_certifications.filter((el) => {
return el.pending == true
}).length
nbCertifsPendingSent() {
return this.idFromHash.sent_certifications.filter((el) => {
return el.pending == true
}).length
},
nbCertifsPendingReceived() {
return this.idFromHash.received_certifications.certifications.filter(
(el) => {
return el.pending == true
}
).length
}
},
apollo: {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment