From 0a26e7f326caa9c8d3a7f6a456f74bde24271714 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Fri, 28 Jan 2022 09:57:14 +0100 Subject: [PATCH] using serialized age instead of function + translation fix --- .../_components/Entity/PersonRenderBox.vue | 38 +++++++++---------- .../vuejs/_components/Entity/PersonText.vue | 1 - 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonRenderBox.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonRenderBox.vue index 514e17753..e079384c4 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonRenderBox.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonRenderBox.vue @@ -47,7 +47,7 @@ {{ $t('renderbox.deathdate') + ' ' + deathdate }} - {{ getAge }} {{ $t('renderbox.years_old')}} + {{ $tc('renderbox.years_old', person.age) }}

@@ -202,24 +202,24 @@ export default { getUrl: function() { return `/fr/person/${this.person.id}/general`; }, - getAge: function() { - // TODO only one abstract function - if(this.person.birthdate && !this.person.deathdate){ - const birthday = new Date(this.person.birthdate.datetime) - const now = new Date() - return (now.getFullYear() - birthday.getFullYear()) - } else if(this.person.birthdate && this.person.deathdate){ - const birthday = new Date(this.person.birthdate.datetime) - const deathdate = new Date(this.person.deathdate.datetime) - return (deathdate.getFullYear() - birthday.getFullYear()) - } else if(!this.person.birthdate && this.person.deathdate.datetime) { - // todo: change this - return "Age unknown" - } else { - // todo: change this - return "Age unknown" - } - }, + // getAge: function() { + // // TODO only one abstract function + // if(this.person.birthdate && !this.person.deathdate){ + // const birthday = new Date(this.person.birthdate.datetime) + // const now = new Date() + // return (now.getFullYear() - birthday.getFullYear()) + // } else if(this.person.birthdate && this.person.deathdate){ + // const birthday = new Date(this.person.birthdate.datetime) + // const deathdate = new Date(this.person.deathdate.datetime) + // return (deathdate.getFullYear() - birthday.getFullYear()) + // } else if(!this.person.birthdate && this.person.deathdate.datetime) { + // // todo: change this + // return "Age unknown" + // } else { + // // todo: change this + // return "Age unknown" + // } + // }, getCurrentHouseholdUrl: function() { let returnPath = this.returnPath ? `?returnPath=${this.returnPath}` : ``; return `/fr/person/household/${this.person.current_household_id}/summary${returnPath}` diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonText.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonText.vue index d597f5205..0dde47235 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonText.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonText.vue @@ -21,7 +21,6 @@ export default { for(let i = 0; i < this.person.altNames.length; i++){ return this.person.altNames[i].label } - console.log(this.person.altNames) }, altNameKey: function() { for(let i = 0; i < this.person.altNames.length; i++){