diff --git a/client/package.json b/client/package.json
index 22c3ff73b..0be1045b1 100644
--- a/client/package.json
+++ b/client/package.json
@@ -108,7 +108,7 @@
"karma-jasmine": "~4.0.1",
"karma-jasmine-html-reporter": "^1.4.0",
"npm-license-crawler": "^0.2.1",
- "prettier": "^2.1.1",
+ "prettier": "~2.1.1",
"protractor": "^7.0.0",
"resize-observer-polyfill": "^1.5.1",
"ts-node": "~9.0.0",
diff --git a/client/src/app/shared/components/motion-poll-detail-content/motion-poll-detail-content.component.html b/client/src/app/shared/components/motion-poll-detail-content/motion-poll-detail-content.component.html
index 8533058b3..0f04e7e9f 100644
--- a/client/src/app/shared/components/motion-poll-detail-content/motion-poll-detail-content.component.html
+++ b/client/src/app/shared/components/motion-poll-detail-content/motion-poll-detail-content.component.html
@@ -43,7 +43,7 @@
-
+
diff --git a/client/src/app/shared/components/motion-poll-detail-content/motion-poll-detail-content.component.ts b/client/src/app/shared/components/motion-poll-detail-content/motion-poll-detail-content.component.ts
index 686e58c9e..475104f24 100644
--- a/client/src/app/shared/components/motion-poll-detail-content/motion-poll-detail-content.component.ts
+++ b/client/src/app/shared/components/motion-poll-detail-content/motion-poll-detail-content.component.ts
@@ -72,6 +72,10 @@ export class MotionPollDetailContentComponent extends BaseComponent {
super(titleService, translate);
}
+ public showChart(): boolean {
+ return this.pollService.showChart(this.poll);
+ }
+
private setTableData(): void {
this.tableData = this.pollService.generateTableData(this.poll);
}
diff --git a/client/src/app/site/motions/services/motion-poll.service.ts b/client/src/app/site/motions/services/motion-poll.service.ts
index ecaa027c7..cb3175ec5 100644
--- a/client/src/app/site/motions/services/motion-poll.service.ts
+++ b/client/src/app/site/motions/services/motion-poll.service.ts
@@ -109,7 +109,11 @@ export class MotionPollService extends PollService {
}
public showChart(poll: PollData): boolean {
- return poll && poll.options && poll.options.some(option => option.yes >= 0 && option.no >= 0);
+ return (
+ poll &&
+ poll.options &&
+ poll.options.some(option => option.yes >= 0 && option.no >= 0 && option.abstain >= 0)
+ );
}
public getPercentBase(poll: PollData): number {
diff --git a/client/src/app/site/polls/components/base-poll-detail.component.ts b/client/src/app/site/polls/components/base-poll-detail.component.ts
index 4e0e59bde..88f4b6912 100644
--- a/client/src/app/site/polls/components/base-poll-detail.component.ts
+++ b/client/src/app/site/polls/components/base-poll-detail.component.ts
@@ -273,7 +273,9 @@ export abstract class BasePollDetailComponentDirective
this.patchForm(this.contentForm);
}
this.updatePollValues(this.contentForm.value);
- this.updatePercentBases(this.pollMethodControl.value);
+ this.updatePercentBases(this.pollMethodControl.value, this.pollTypeControl.value);
this.subscriptions.push(
// changes to whole form
@@ -183,13 +183,12 @@ export class PollFormComponent
}),
// poll method changes
this.pollMethodControl.valueChanges.subscribe((method: AssignmentPollMethod) => {
- if (method) {
- this.updatePercentBases(method);
- this.setWarning();
- }
+ this.updatePercentBases(method, this.pollTypeControl.value);
+ this.setWarning();
}),
// poll type changes
- this.pollTypeControl.valueChanges.subscribe(() => {
+ this.pollTypeControl.valueChanges.subscribe((type: PollType) => {
+ this.updatePercentBases(this.pollMethodControl.value, type);
this.setWarning();
})
);
@@ -226,11 +225,12 @@ export class PollFormComponent
}
/**
- * updates the available percent bases according to the pollmethod
+ * updates the available percent bases according to the pollmethod and type
* @param method the currently chosen pollmethod
+ * @param type the currently chosen type
*/
- private updatePercentBases(method: AssignmentPollMethod): void {
- if (method) {
+ private updatePercentBases(method: AssignmentPollMethod, type: PollType): void {
+ if (method || type) {
let forbiddenBases = [];
if (method === AssignmentPollMethod.YN) {
forbiddenBases = [PercentBase.YNA, AssignmentPollPercentBase.Y];
@@ -239,6 +239,9 @@ export class PollFormComponent
} else if (method === AssignmentPollMethod.Y || AssignmentPollMethod.N) {
forbiddenBases = [PercentBase.YN, PercentBase.YNA];
}
+ if (type === PollType.Analog) {
+ forbiddenBases.push(PercentBase.Entitled);
+ }
const bases = {};
for (const [key, value] of Object.entries(this.percentBases)) {
@@ -248,7 +251,7 @@ export class PollFormComponent
}
// update value in case that its no longer valid
const percentBaseControl = this.contentForm.get('onehundred_percent_base');
- percentBaseControl.setValue(this.getNormedPercentBase(percentBaseControl.value, method));
+ percentBaseControl.setValue(this.getNormedPercentBase(percentBaseControl.value, method, type));
this.validPercentBases = bases;
}
@@ -256,7 +259,8 @@ export class PollFormComponent
private getNormedPercentBase(
base: AssignmentPollPercentBase,
- method: AssignmentPollMethod
+ method: AssignmentPollMethod,
+ type: PollType
): AssignmentPollPercentBase {
if (
method === AssignmentPollMethod.YN &&
@@ -270,6 +274,8 @@ export class PollFormComponent
(base === AssignmentPollPercentBase.YN || base === AssignmentPollPercentBase.YNA)
) {
return AssignmentPollPercentBase.Y;
+ } else if (type === PollType.Analog && base === AssignmentPollPercentBase.Entitled) {
+ return AssignmentPollPercentBase.Cast;
}
return base;
}
diff --git a/client/src/app/site/polls/models/view-base-poll.ts b/client/src/app/site/polls/models/view-base-poll.ts
index 54a49dae6..e588f341c 100644
--- a/client/src/app/site/polls/models/view-base-poll.ts
+++ b/client/src/app/site/polls/models/view-base-poll.ts
@@ -112,10 +112,6 @@ export abstract class ViewBasePoll<
}
}
- public get hasSpecialVoteValues(): boolean {
- return this.poll.isAnalog && this.options.some(option => option.votes.some(vote => vote.weight < 0));
- }
-
public abstract get pollmethodVerbose(): string;
public abstract get percentBaseVerbose(): string;
diff --git a/client/src/app/slides/motions/motion-poll/motion-poll-slide.component.ts b/client/src/app/slides/motions/motion-poll/motion-poll-slide.component.ts
index 24b97dafe..1fdbf88c2 100644
--- a/client/src/app/slides/motions/motion-poll/motion-poll-slide.component.ts
+++ b/client/src/app/slides/motions/motion-poll/motion-poll-slide.component.ts
@@ -37,10 +37,6 @@ export class MotionPollSlideComponent extends BasePollSlideComponentDirective