Remove chart for analog polls with a majority & fix random TypeError

This commit is contained in:
Joshua Sangmeister 2021-06-24 15:52:03 +02:00 committed by Sean
parent c286e0ff76
commit 3532c55924
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;