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` ...@@ -79,7 +79,7 @@ export const NEWCOMERS = gql`
} }
` `
// Pour la page membres/index // Pour la page membre
export const SEARCH_MEMBERS = gql` export const SEARCH_MEMBERS = gql`
query SearchMember($hint: String) { query SearchMember($hint: String) {
idSearch(with: { hint: $hint }) { idSearch(with: { hint: $hint }) {
...@@ -102,7 +102,7 @@ export const SEARCH_MEMBERS = gql` ...@@ -102,7 +102,7 @@ export const SEARCH_MEMBERS = gql`
} }
` `
// Pour la page membres/_hash // Pour la page membre
export const SEARCH_MEMBER = gql` export const SEARCH_MEMBER = gql`
query SearchMemberWithHash($hash: Hash!) { query SearchMemberWithHash($hash: Hash!) {
idFromHash(hash: $hash) { idFromHash(hash: $hash) {
......
...@@ -27,9 +27,9 @@ ...@@ -27,9 +27,9 @@
['NEWCOMER', 'MISSING'].includes(idFromHash.status) && ['NEWCOMER', 'MISSING'].includes(idFromHash.status) &&
idFromHash.received_certifications.certifications.length < 5 idFromHash.received_certifications.certifications.length < 5
}"> }">
{{ $t("certification.recues") }} ({{ nbCertifs("received") {{ $t("certification.recues") }} ({{ nbCertifsReceived
}}<span v-if="nbCertifsPending('received') != 0">{{ }}<span v-if="nbCertifsPendingReceived != 0">{{
"&nbsp;+&nbsp;" + nbCertifsPending("received") "&nbsp;+&nbsp;" + nbCertifsPendingReceived
}}</span }}</span
>) >)
<BadgeDanger <BadgeDanger
...@@ -44,9 +44,9 @@ ...@@ -44,9 +44,9 @@
class="col-sm-10 col-md-7 col-lg-5 mx-auto" class="col-sm-10 col-md-7 col-lg-5 mx-auto"
v-if="['MISSING', 'MEMBER'].includes(idFromHash.status)"> v-if="['MISSING', 'MEMBER'].includes(idFromHash.status)">
<h3 class="h4 text-center"> <h3 class="h4 text-center">
{{ $t("certification.envoyees") }} ({{ nbCertifs("sent") {{ $t("certification.envoyees") }} ({{ nbCertifsSent
}}<span v-if="nbCertifsPending('sent') != 0">{{ }}<span v-if="nbCertifsPendingSent != 0">{{
"&nbsp;+&nbsp;" + nbCertifsPending("sent") "&nbsp;+&nbsp;" + nbCertifsPendingSent
}}</span }}</span
>) >)
</h3> </h3>
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
import { SEARCH_MEMBER } from "@/graphql/queries" import { SEARCH_MEMBER } from "@/graphql/queries"
export default { export default {
name: 'membre', name: "membre",
data() { data() {
return { return {
breadcrumb: [ breadcrumb: [
...@@ -85,28 +85,30 @@ export default { ...@@ -85,28 +85,30 @@ export default {
error: null error: null
} }
}, },
methods: { computed: {
nbCertifs(sens) { nbCertifsSent() {
return sens == "received" return this.idFromHash.sent_certifications.filter((el) => {
? this.idFromHash.received_certifications.certifications.filter( return el.pending == false
(el) => { }).length
return el.pending == false },
} nbCertifsReceived() {
).length return this.idFromHash.received_certifications.certifications.filter(
: this.idFromHash.sent_certifications.filter((el) => { (el) => {
return el.pending == false return el.pending == false
}).length }
).length
}, },
nbCertifsPending(sens) { nbCertifsPendingSent() {
return sens == "received" return this.idFromHash.sent_certifications.filter((el) => {
? this.idFromHash.received_certifications.certifications.filter( return el.pending == true
(el) => { }).length
return el.pending == true },
} nbCertifsPendingReceived() {
).length return this.idFromHash.received_certifications.certifications.filter(
: this.idFromHash.sent_certifications.filter((el) => { (el) => {
return el.pending == true return el.pending == true
}).length }
).length
} }
}, },
apollo: { 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