From 4464a0af2cae1c9c9c25c6b1762d28634c3b4207 Mon Sep 17 00:00:00 2001 From: tykayn Date: Wed, 28 Apr 2021 12:22:40 +0200 Subject: [PATCH] display stack answer and toggle fluently between answers to votes --- src/app/core/services/storage.service.ts | 13 +++++++++++- .../poll-results-compact.component.html | 21 ++++++++++++++++--- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/src/app/core/services/storage.service.ts b/src/app/core/services/storage.service.ts index a8013efb..b993298d 100644 --- a/src/app/core/services/storage.service.ts +++ b/src/app/core/services/storage.service.ts @@ -34,7 +34,7 @@ export class StorageService { toggleAnswer(choice_id: number, value: string) { for (let vote of this.vote_stack.votes) { if (vote.choice_id == choice_id) { - if (vote.value) { + if (vote.value == value) { vote.value = ''; } else { vote.value = value; @@ -42,4 +42,15 @@ export class StorageService { } } } + + choiceHasAnswerOfValue(choice_id: number, value: any) { + for (let vote of this.vote_stack.votes) { + if (vote.choice_id == choice_id) { + if (vote.value == value) { + return true; + } + } + } + return false; + } } diff --git a/src/app/features/consultation/poll-results-compact/poll-results-compact.component.html b/src/app/features/consultation/poll-results-compact/poll-results-compact.component.html index 56df03f1..f0e70b38 100644 --- a/src/app/features/consultation/poll-results-compact/poll-results-compact.component.html +++ b/src/app/features/consultation/poll-results-compact/poll-results-compact.component.html @@ -24,20 +24,35 @@
- - -