funky-framadate-front/src/app/features/consultation/poll-results-detailed/poll-results-detailed.compo...

28 lines
773 B
TypeScript
Raw Normal View History

2020-05-12 19:16:23 +02:00
import { Component, Input, OnInit } from '@angular/core';
2020-06-12 19:17:39 +02:00
import { Answer } from '../../../core/enums/answer.enum';
2020-05-12 19:16:23 +02:00
import { Poll } from '../../../core/models/poll.model';
2020-06-12 19:17:39 +02:00
import { PollService } from '../../../core/services/poll.service';
2020-05-12 19:16:23 +02:00
@Component({
selector: 'app-poll-results-detailed',
templateUrl: './poll-results-detailed.component.html',
styleUrls: ['./poll-results-detailed.component.scss'],
})
2021-04-30 09:26:54 +02:00
export class PollResultsDetailedComponent {
2020-05-12 19:16:23 +02:00
@Input() public poll: Poll;
2020-06-12 19:17:39 +02:00
constructor(private pollService: PollService) {}
2020-05-12 19:16:23 +02:00
2021-04-27 12:14:57 +02:00
stackHasVotesForChoice(stack, choice: any) {
return undefined !== stack.votes[choice];
}
getValue(stack, choice: any) {
if (this.stackHasVotesForChoice(stack, choice)) {
return stack.votes[choice].value;
}
return null;
}
2020-05-12 19:16:23 +02:00
}