OpenSlides/client/src/app/shared/models/poll/base-vote.ts

33 lines
754 B
TypeScript
Raw Normal View History

2019-10-18 14:18:49 +02:00
import { BaseDecimalModel } from '../base/base-decimal-model';
export type VoteValue = 'Y' | 'N' | 'A';
export const VoteValueVerbose = {
Y: 'Yes',
N: 'No',
A: 'Abstain'
};
export const GeneralValueVerbose = {
votesvalid: 'Valid votes',
votesinvalid: 'Invalid votes',
votescast: 'Total votes cast',
votesno: 'Votes No',
votesabstain: 'Votes abstain'
};
2019-10-18 14:18:49 +02:00
export abstract class BaseVote<T> extends BaseDecimalModel<T> {
public weight: number;
public value: VoteValue;
2019-10-29 09:00:11 +01:00
public option_id: number;
2019-10-18 14:18:49 +02:00
public user_id?: number;
public get valueVerbose(): string {
return VoteValueVerbose[this.value];
}
2019-10-29 09:00:11 +01:00
protected getDecimalFields(): (keyof BaseVote<T>)[] {
return ['weight'];
}
2019-10-18 14:18:49 +02:00
}