2020-05-12 19:16:23 +02:00
|
|
|
import { environment } from 'src/environments/environment';
|
|
|
|
|
2020-05-05 18:17:12 +02:00
|
|
|
import { Choice } from './choice.model';
|
|
|
|
import { Comment } from './comment.model';
|
2020-10-29 18:43:19 +01:00
|
|
|
import { PollConfiguration } from './configuration.model';
|
2021-04-28 12:01:09 +02:00
|
|
|
import { Owner } from './owner.model';
|
2021-04-30 12:37:04 +02:00
|
|
|
import { DateChoice, TimeSlices } from '../../../../mocks/old-stuff/config/defaultConfigs';
|
2020-04-19 14:22:10 +02:00
|
|
|
|
2021-04-30 14:15:21 +02:00
|
|
|
export class ChoiceGroup {
|
|
|
|
date_string: string;
|
|
|
|
choices: Choice[];
|
|
|
|
}
|
|
|
|
|
2020-04-19 14:22:10 +02:00
|
|
|
export class Poll {
|
2021-04-26 12:00:20 +02:00
|
|
|
public id = 0;
|
|
|
|
|
|
|
|
public default_expiracy_days_from_now = 60;
|
|
|
|
|
|
|
|
public kind: string;
|
|
|
|
|
|
|
|
public description?: string;
|
|
|
|
|
|
|
|
public expiracy_date?: string;
|
|
|
|
|
|
|
|
public creation_date?: string;
|
|
|
|
|
|
|
|
public creatorPseudo?: string;
|
|
|
|
|
|
|
|
public creatorEmail?: string;
|
|
|
|
|
|
|
|
public is_archived?: boolean;
|
2021-04-30 12:37:04 +02:00
|
|
|
public is_zero_knowledge?: boolean = false;
|
|
|
|
public allow_comments?: boolean = true;
|
|
|
|
public has_several_hours?: boolean = false;
|
|
|
|
|
2021-04-26 12:00:20 +02:00
|
|
|
public allowSeveralHours?: boolean;
|
|
|
|
|
|
|
|
public archiveNumberOfDays?: number;
|
2021-04-30 12:37:04 +02:00
|
|
|
|
2021-04-27 11:06:17 +02:00
|
|
|
public max_score?: number;
|
2021-04-26 12:00:20 +02:00
|
|
|
|
2021-04-30 12:37:04 +02:00
|
|
|
public max_count_of_answers?: number = 150;
|
|
|
|
|
2021-04-26 12:00:20 +02:00
|
|
|
public configuration: PollConfiguration = new PollConfiguration();
|
|
|
|
|
|
|
|
public comments: Comment[] = [];
|
|
|
|
|
|
|
|
public choices: Choice[] = [];
|
|
|
|
|
2021-04-30 14:15:21 +02:00
|
|
|
public choicesDateGrouped: ChoiceGroup[] = [];
|
|
|
|
|
2021-04-26 12:00:20 +02:00
|
|
|
public votes = [];
|
|
|
|
|
2021-04-26 17:04:16 +02:00
|
|
|
public stacks = [];
|
2021-04-26 12:00:20 +02:00
|
|
|
|
|
|
|
public allowed_answers = [];
|
|
|
|
|
2021-04-27 13:04:32 +02:00
|
|
|
public modification_policy = 'everybody';
|
2021-04-26 12:00:20 +02:00
|
|
|
|
2021-04-30 12:37:04 +02:00
|
|
|
public dateChoices: DateChoice[] = [];
|
2021-04-26 12:00:20 +02:00
|
|
|
// sets of days as strings, config to set identical time for days in a special days poll
|
2021-04-30 12:37:04 +02:00
|
|
|
public timeSlices: TimeSlices[] = []; // ranges of time expressed as strings
|
2021-04-30 10:59:46 +02:00
|
|
|
constructor(public owner: Owner = new Owner(), public title = 'mon titre', public custom_url: string = '') {}
|
2021-04-26 11:27:44 +02:00
|
|
|
|
|
|
|
public getAdministrationUrl(): string {
|
2021-04-30 10:59:46 +02:00
|
|
|
return `${environment.api.baseHref}/administration/polls/${this.custom_url}`;
|
2021-04-26 11:27:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public getParticipationUrl(): string {
|
2021-04-30 10:59:46 +02:00
|
|
|
return `${environment.api.baseHref}/participation/polls/${this.custom_url}`;
|
2021-04-26 11:27:44 +02:00
|
|
|
}
|
2020-04-19 14:22:10 +02:00
|
|
|
}
|