28 lines
773 B
TypeScript
28 lines
773 B
TypeScript
import { Component, Input, OnInit } from '@angular/core';
|
|
|
|
import { Answer } from '../../../core/enums/answer.enum';
|
|
import { Poll } from '../../../core/models/poll.model';
|
|
import { PollService } from '../../../core/services/poll.service';
|
|
|
|
@Component({
|
|
selector: 'app-poll-results-detailed',
|
|
templateUrl: './poll-results-detailed.component.html',
|
|
styleUrls: ['./poll-results-detailed.component.scss'],
|
|
})
|
|
export class PollResultsDetailedComponent {
|
|
@Input() public poll: Poll;
|
|
|
|
constructor(private pollService: PollService) {}
|
|
|
|
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;
|
|
}
|
|
}
|