|
|
|
@ -45,11 +45,7 @@ export class StorageService {
|
|
|
|
|
@LocalStorage()
|
|
|
|
|
public choices: Choice[] = [];
|
|
|
|
|
|
|
|
|
|
constructor(
|
|
|
|
|
public dateUtilities: DateUtilitiesService,
|
|
|
|
|
|
|
|
|
|
private toastService: ToastService
|
|
|
|
|
) {
|
|
|
|
|
constructor(public dateUtilities: DateUtilitiesService, private toastService: ToastService) {
|
|
|
|
|
if (environment.autofill) {
|
|
|
|
|
this.toastService.display('autofill des sondages utilisateur');
|
|
|
|
|
this.userPolls.push(new Poll(new Owner(), 'Démo: Anniversaire de tonton Patrick', 'aujourdhui-ou-demain'));
|
|
|
|
@ -68,13 +64,16 @@ export class StorageService {
|
|
|
|
|
this.vote_stack.votes = [];
|
|
|
|
|
|
|
|
|
|
// text choices
|
|
|
|
|
for (const choice of choices_list) {
|
|
|
|
|
if (environment.autofill) {
|
|
|
|
|
this.toastService.display('autofill au hasard des votes à ce sondage');
|
|
|
|
|
const defaultvalue = Math.random() > 0.75 ? 'yes' : '';
|
|
|
|
|
this.vote_stack.votes.push(new Vote(choice.id, defaultvalue));
|
|
|
|
|
} else {
|
|
|
|
|
this.vote_stack.votes.push(new Vote(choice.id));
|
|
|
|
|
if (!this.vote_stack.id) {
|
|
|
|
|
for (const choice of choices_list) {
|
|
|
|
|
if (environment.autofill) {
|
|
|
|
|
console.log('autofill au hasard des votes à ce sondage');
|
|
|
|
|
this.toastService.display('autofill au hasard des votes à ce sondage');
|
|
|
|
|
const defaultvalue = Math.random() > 0.75 ? 'yes' : '';
|
|
|
|
|
this.vote_stack.votes.push(new Vote(choice.id, defaultvalue));
|
|
|
|
|
} else {
|
|
|
|
|
this.vote_stack.votes.push(new Vote(choice.id));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|