2018-07-12 14:11:31 +02:00
|
|
|
import { PollOption } from './poll-option';
|
2018-09-10 11:15:12 +02:00
|
|
|
import { Deserializer } from '../deserializer.model';
|
2018-07-12 14:11:31 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Content of the 'polls' property of assignments
|
|
|
|
* @ignore
|
|
|
|
*/
|
2018-09-10 11:15:12 +02:00
|
|
|
export class Poll extends Deserializer {
|
2018-08-29 13:21:25 +02:00
|
|
|
public id: number;
|
|
|
|
public pollmethod: string;
|
|
|
|
public description: string;
|
|
|
|
public published: boolean;
|
|
|
|
public options: PollOption[];
|
|
|
|
public votesvalid: number;
|
|
|
|
public votesinvalid: number;
|
|
|
|
public votescast: number;
|
|
|
|
public has_votes: boolean;
|
|
|
|
public assignment_id: number;
|
2018-07-12 14:11:31 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Needs to be completely optional because assignment has (yet) the optional parameter 'polls'
|
2018-09-04 11:33:28 +02:00
|
|
|
* @param input
|
2018-07-12 14:11:31 +02:00
|
|
|
*/
|
2018-09-04 11:33:28 +02:00
|
|
|
public constructor(input?: any) {
|
2018-09-10 11:15:12 +02:00
|
|
|
super(input);
|
2018-07-12 14:11:31 +02:00
|
|
|
}
|
|
|
|
|
2018-09-04 11:33:28 +02:00
|
|
|
public deserialize(input: any): void {
|
2018-07-12 14:11:31 +02:00
|
|
|
Object.assign(this, input);
|
|
|
|
|
2018-09-10 11:15:12 +02:00
|
|
|
this.options = [];
|
2018-07-12 14:11:31 +02:00
|
|
|
if (input.options instanceof Array) {
|
|
|
|
input.options.forEach(pollOptionData => {
|
2018-09-04 11:33:28 +02:00
|
|
|
this.options.push(new PollOption(pollOptionData));
|
2018-07-12 14:11:31 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|