diff --git a/client/src/app/shared/models/motions/motion-poll.ts b/client/src/app/shared/models/motions/motion-poll.ts index 0e551bdbd..1e39d6584 100644 --- a/client/src/app/shared/models/motions/motion-poll.ts +++ b/client/src/app/shared/models/motions/motion-poll.ts @@ -13,6 +13,7 @@ export enum MotionPollMethod { export class MotionPoll extends BasePoll { public static COLLECTIONSTRING = 'motions/motion-poll'; public static defaultGroupsConfig = 'motion_poll_default_groups'; + public static DECIMAL_FIELDS = ['votesvalid', 'votesinvalid', 'votescast']; public id: number; public motion_id: number; @@ -29,4 +30,8 @@ export class MotionPoll extends BasePoll extends BaseSlideComponentDirective { @@ -19,6 +19,11 @@ export class BasePollSlideComponentDirective< @Input() public set data(value: SlideData) { this._data = value; + this.getDecimalFields().forEach(field => { + if (value.data.poll[field] !== undefined) { + value.data.poll[field] = parseFloat(value.data.poll[field]); + } + }); if (value.data.poll.state === PollState.Published) { const chartData = this.pollService.generateChartData(value.data.poll); this.chartDataSubject.next(chartData); @@ -37,4 +42,6 @@ export class BasePollSlideComponentDirective< ) { super(); } + + protected abstract getDecimalFields(): string[]; }