2019-10-18 14:18:49 +02:00
|
|
|
import { BaseDecimalModel } from '../base/base-decimal-model';
|
|
|
|
|
2019-11-12 18:30:26 +01:00
|
|
|
export type VoteValue = 'Y' | 'N' | 'A';
|
|
|
|
|
|
|
|
export const VoteValueVerbose = {
|
|
|
|
Y: 'Yes',
|
|
|
|
N: 'No',
|
|
|
|
A: 'Abstain'
|
|
|
|
};
|
|
|
|
|
|
|
|
export const GeneralValueVerbose = {
|
2020-01-22 17:39:10 +01:00
|
|
|
votesvalid: 'Valid votes',
|
|
|
|
votesinvalid: 'Invalid votes',
|
|
|
|
votescast: 'Total votes cast',
|
2019-11-12 18:30:26 +01:00
|
|
|
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;
|
2019-11-12 18:30:26 +01:00
|
|
|
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;
|
|
|
|
|
2019-11-12 18:30:26 +01:00
|
|
|
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
|
|
|
}
|