Merge pull request #6130 from jsangmeister/fix-analog-poll-diagramm

Remove chart for analog polls with a majority & fix random TypeError
This commit is contained in:
Emanuel Schütze 2021-06-24 21:02:38 +02:00 committed by GitHub
commit 416b2cc26f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 1 deletions

View File

@ -43,7 +43,7 @@
</table> </table>
<!-- Chart --> <!-- Chart -->
<div class="doughnut-chart"> <div *ngIf="!poll.hasSpecialVoteValues" class="doughnut-chart">
<os-charts type="doughnut" [data]="chartData"></os-charts> <os-charts type="doughnut" [data]="chartData"></os-charts>
</div> </div>
</ng-container> </ng-container>

View File

@ -213,6 +213,9 @@ export abstract class BasePollDetailComponentDirective<V extends ViewBasePoll, S
if (this.entitledUsersSubscription) { if (this.entitledUsersSubscription) {
this.entitledUsersSubscription.unsubscribe(); this.entitledUsersSubscription.unsubscribe();
} }
if (this.poll.isAnalog) {
return;
}
const userIds = new Set<number>(); const userIds = new Set<number>();
for (const entry of this.poll.entitled_users_at_stop) { for (const entry of this.poll.entitled_users_at_stop) {
userIds.add(entry.user_id); userIds.add(entry.user_id);

View File

@ -112,6 +112,10 @@ 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 pollmethodVerbose(): string;
public abstract get percentBaseVerbose(): string; public abstract get percentBaseVerbose(): string;