warn/show speaker-call amount

This commit is contained in:
Maximilian Krambach 2019-01-18 15:31:48 +01:00
parent 9563858c7a
commit 3b5876009c
3 changed files with 17 additions and 0 deletions

View File

@ -53,6 +53,9 @@
<os-sorting-list [input]="speakers" [live]="true" [count]="true" (sortEvent)="onSortingChange($event)"> <os-sorting-list [input]="speakers" [live]="true" [count]="true" (sortEvent)="onSortingChange($event)">
<!-- implicit item references into the component using ng-template slot --> <!-- implicit item references into the component using ng-template slot -->
<ng-template let-item> <ng-template let-item>
<span *ngIf="hasSpokenCount(item)" class="red-warning-text speaker-warning">
<span translate>Call</span><span>&nbsp;{{ hasSpokenCount(item) + 1 }}</span>
</span>
<mat-button-toggle-group> <mat-button-toggle-group>
<mat-button-toggle matTooltip="{{ 'Begin speech' | translate }}" <mat-button-toggle matTooltip="{{ 'Begin speech' | translate }}"
(click)="onStartButton(item)"> (click)="onStartButton(item)">

View File

@ -61,4 +61,8 @@
.add-self-buttons { .add-self-buttons {
padding: 0 0 20px 25px; padding: 0 0 20px 25px;
} }
.speaker-warning {
margin-right: 5px;
}
} }

View File

@ -180,4 +180,14 @@ export class SpeakerListComponent extends BaseViewComponent implements OnInit {
public isOpInList(): boolean { public isOpInList(): boolean {
return this.speakers.some(speaker => speaker.user.id === this.op.user.id); return this.speakers.some(speaker => speaker.user.id === this.op.user.id);
} }
/**
* Checks how often a speaker has already finished speaking
*
* @param speaker
* @returns 0 or the number of times a speaker occurs in finishedSpeakers
*/
public hasSpokenCount(speaker: ViewSpeaker): number {
return this.finishedSpeakers.filter(finishedSpeaker => finishedSpeaker.user.id === speaker.user.id).length;
}
} }