From 7071a08081eb5d52ccf9e927f57b323634738d0c Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Thu, 8 Jul 2021 17:45:38 +0200 Subject: [PATCH 1/4] fix: Infinite Loop on Transaction List --- frontend/src/components/DecayInformation.vue | 64 ++++++++------------ 1 file changed, 26 insertions(+), 38 deletions(-) diff --git a/frontend/src/components/DecayInformation.vue b/frontend/src/components/DecayInformation.vue index 8a134b490..75bda0a18 100644 --- a/frontend/src/components/DecayInformation.vue +++ b/frontend/src/components/DecayInformation.vue @@ -56,42 +56,30 @@ From 019b0304652ce454c86cd7bb7743dbf31e23c49c Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Thu, 8 Jul 2021 17:52:21 +0200 Subject: [PATCH 2/4] fix: Infinite Loop in Transaction List --- frontend/src/components/DecayInformation.vue | 74 +++++++++++--------- 1 file changed, 40 insertions(+), 34 deletions(-) diff --git a/frontend/src/components/DecayInformation.vue b/frontend/src/components/DecayInformation.vue index 75bda0a18..3b7a939c5 100644 --- a/frontend/src/components/DecayInformation.vue +++ b/frontend/src/components/DecayInformation.vue @@ -39,14 +39,20 @@
{{ $t('decay.since_introduction') }}
- {{ getDuration(decay.decay_end, decay.decay_start) }} - - {{ duration.years }} {{ $t('decay.year') }}, - {{ duration.months }} {{ $t('decay.months') }}, - {{ duration.days }} {{ $t('decay.days') }}, - {{ duration.hours }} {{ $t('decay.hours') }}, - {{ duration.minutes }} {{ $t('decay.minutes') }}, - {{ duration.seconds }} {{ $t('decay.seconds') }} + {{ getDuration }} + + {{ getDuration.years }} {{ $t('decay.year') }}, + + {{ getDuration.months }} {{ $t('decay.months') }}, + + {{ getDuration.days }} {{ $t('decay.days') }}, + {{ getDuration.hours }} {{ $t('decay.hours') }}, + + {{ getDuration.minutes }} {{ $t('decay.minutes') }}, + + + {{ getDuration.seconds }} {{ $t('decay.seconds') }} +
@@ -56,30 +62,30 @@ From bb91b8a269cbcc620823b8af485434ce417c8674 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Thu, 8 Jul 2021 18:01:49 +0200 Subject: [PATCH 3/4] fix duration calculation --- frontend/src/components/DecayInformation.vue | 25 +++++++------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/frontend/src/components/DecayInformation.vue b/frontend/src/components/DecayInformation.vue index 3b7a939c5..5179b9df1 100644 --- a/frontend/src/components/DecayInformation.vue +++ b/frontend/src/components/DecayInformation.vue @@ -39,20 +39,13 @@
{{ $t('decay.since_introduction') }}
- {{ getDuration }} - - {{ getDuration.years }} {{ $t('decay.year') }}, - - {{ getDuration.months }} {{ $t('decay.months') }}, - - {{ getDuration.days }} {{ $t('decay.days') }}, - {{ getDuration.hours }} {{ $t('decay.hours') }}, - - {{ getDuration.minutes }} {{ $t('decay.minutes') }}, - - - {{ getDuration.seconds }} {{ $t('decay.seconds') }} - + + {{ duration.years }} {{ $t('decay.year') }}, + {{ duration.months }} {{ $t('decay.months') }}, + {{ duration.days }} {{ $t('decay.days') }}, + {{ duration.hours }} {{ $t('decay.hours') }}, + {{ duration.minutes }} {{ $t('decay.minutes') }}, + {{ duration.seconds }} {{ $t('decay.seconds') }}
@@ -80,10 +73,10 @@ export default { ? ' - Startblock Decay am: ' + this.$d(this.$moment.unix(this.decay.decay_start_block)) : '' }, - getDuration() { + duration() { const startDate = this.$moment.unix(new Date(this.decay.decay_start)) const endDate = this.$moment.unix(new Date(this.decay.decay_end)) - const diff = this.$moment.duration(startDate.diff(endDate)) + const diff = this.$moment.duration(endDate.diff(startDate)) return diff._data }, }, From 1b6f91ea482ae57c45889093f8a28d1c46494dd0 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Thu, 8 Jul 2021 18:13:38 +0200 Subject: [PATCH 4/4] duration function more compact --- frontend/src/components/DecayInformation.vue | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/frontend/src/components/DecayInformation.vue b/frontend/src/components/DecayInformation.vue index 5179b9df1..c3f07c87b 100644 --- a/frontend/src/components/DecayInformation.vue +++ b/frontend/src/components/DecayInformation.vue @@ -74,10 +74,11 @@ export default { : '' }, duration() { - const startDate = this.$moment.unix(new Date(this.decay.decay_start)) - const endDate = this.$moment.unix(new Date(this.decay.decay_end)) - const diff = this.$moment.duration(endDate.diff(startDate)) - return diff._data + return this.$moment.duration( + this.$moment + .unix(new Date(this.decay.decay_end)) + .diff(this.$moment.unix(new Date(this.decay.decay_start))), + )._data }, }, }