remove Motion polls show global values

Motion polls were displaying global abstain, etc
This commit is contained in:
Sean 2021-05-06 14:21:04 +02:00
parent 2a7b55f11e
commit 3402928935
5 changed files with 24 additions and 6 deletions

View File

@ -1,4 +1,5 @@
<os-poll-form
[pollClassType]="pollClassType.Assignment"
[data]="pollData"
[pollService]="assignmentPollService"
[pollMethods]="AssignmentPollMethodVerbose"

View File

@ -1,4 +1,5 @@
<os-poll-form
[pollClassType]="pollClassType.Motion"
[data]="pollData"
[pollService]="motionPollService"
[percentBases]="PercentBaseVerbose"

View File

@ -10,7 +10,7 @@ import { OneOfValidator } from 'app/shared/validators/one-of-validator';
import { BaseViewComponentDirective } from 'app/site/base/base-view';
import { PollFormComponent } from './poll-form/poll-form.component';
import { PollService } from '../services/poll.service';
import { ViewBasePoll } from '../models/view-base-poll';
import { PollClassType, ViewBasePoll } from '../models/view-base-poll';
/**
* A dialog for updating the values of a poll.
@ -20,6 +20,7 @@ export abstract class BasePollDialogComponent<
S extends PollService
> extends BaseViewComponentDirective {
public publishImmediately: boolean;
public pollClassType = PollClassType;
protected pollForm: PollFormComponent<T, S>;

View File

@ -89,7 +89,7 @@
</div>
<!-- Amount of Votes and global options -->
<div class="global-options">
<div class="global-options" *ngIf="isAssignmentPoll">
<mat-checkbox formControlName="global_yes">
{{ PollPropertyVerbose.global_yes | translate }}
</mat-checkbox>

View File

@ -64,6 +64,9 @@ export class PollFormComponent<T extends ViewBasePoll, S extends PollService>
@Input()
private pollService: S;
@Input()
public pollClassType: PollClassType;
/**
* The different types the poll can accept.
*/
@ -105,6 +108,10 @@ export class PollFormComponent<T extends ViewBasePoll, S extends PollService>
}
}
public get isAssignmentPoll(): boolean {
return this.pollClassType === PollClassType.Assignment;
}
public get isEVotingSelected(): boolean {
return this.pollTypeControl?.value !== PollType.Analog || false;
}
@ -140,6 +147,7 @@ export class PollFormComponent<T extends ViewBasePoll, S extends PollService>
) {
super(title, translate, snackbar);
this.initContentForm();
this.groupObservable = this.groupRepo.getViewModelListObservableWithoutDefaultGroup();
}
/**
@ -147,9 +155,6 @@ export class PollFormComponent<T extends ViewBasePoll, S extends PollService>
* Sets the observable for groups.
*/
public ngOnInit(): void {
// without default group since default cant ever vote
this.groupObservable = this.groupRepo.getViewModelListObservableWithoutDefaultGroup();
if (this.data) {
if (this.data.state) {
this.disablePollType();
@ -312,7 +317,7 @@ export class PollFormComponent<T extends ViewBasePoll, S extends PollService>
]
];
// show pollmethod only for assignment polls
if (this.data.pollClassType === PollClassType.Assignment) {
if (this.isAssignmentPoll) {
this.pollValues.push([
this.pollService.getVerboseNameForKey('pollmethod'),
this.pollService.getVerboseNameForValue('pollmethod', data.pollmethod)
@ -375,6 +380,16 @@ export class PollFormComponent<T extends ViewBasePoll, S extends PollService>
global_yes: [false],
global_no: [false],
global_abstain: [false]
/**
* TODO, global is not required for motions, current logic does not
* survive changes after constructor due strickt access calls
* Change to observe
*/
// ...(this.isAssignmentPoll && {
// global_yes: [false],
// global_no: [false],
// global_abstain: [false]
// })
});
}