2020-05-12 19:16:23 +02:00
|
|
|
import { Component, Input, OnInit } from '@angular/core';
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
2021-05-20 13:25:45 +02:00
|
|
|
|
|
|
|
make_date(name: string) {
|
|
|
|
name = name.substr(0, 24);
|
|
|
|
console.log('name.length', name.length, name);
|
|
|
|
return new Date(name);
|
|
|
|
}
|
2020-05-12 19:16:23 +02:00
|
|
|
}
|