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

33 lines
849 B
TypeScript

import { Component, Input, OnInit } from '@angular/core';
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;
}
make_date(name: string) {
name = name.substr(0, 24);
console.log('name.length', name.length, name);
return new Date(name);
}
}