Skip to content

Commit

Permalink
Allowing to open team ranking for selected group
Browse files Browse the repository at this point in the history
  • Loading branch information
softwaremagico committed Jun 14, 2024
1 parent 491dd2c commit 686222d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 17 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
[![GitHub commit activity](https://img.shields.io/github/commit-activity/y/softwaremagico/KendoTournamentManager)](https://github.com/softwaremagico/KendoTournamentManager)
[![GitHub last commit](https://img.shields.io/github/last-commit/softwaremagico/KendoTournamentManager)](https://github.com/softwaremagico/KendoTournamentManager)
[![CircleCI](https://circleci.com/gh/softwaremagico/KendoTournamentManager.svg?style=shield)](https://circleci.com/gh/softwaremagico/KendoTournamentManager)
[![Time](https://img.shields.io/badge/development-626h-blueviolet.svg)]()
[![Time](https://img.shields.io/badge/development-626.5h-blueviolet.svg)]()

[![Powered by](https://img.shields.io/badge/powered%20by%20java-orange.svg?logo=OpenJDK&logoColor=white)]()
[![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=kendo-tournament-backend&metric=vulnerabilities)](https://sonarcloud.io/summary/new_code?id=kendo-tournament-backend)
Expand Down
19 changes: 10 additions & 9 deletions frontend/src/app/views/fight-list/fight-list.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
matTooltip="{{'groups' | translate}}">
<mat-icon class="kendo-icon" svgIcon="brackets"></mat-icon>
</button>
<mat-divider [vertical]="true" class="timer-divider" *ngIf="(RbacActivity.EDIT_FIGHT | rbac : this.rbacService.getActivities())"></mat-divider>
<mat-divider [vertical]="true" class="timer-divider"
*ngIf="(RbacActivity.EDIT_FIGHT | rbac : this.rbacService.getActivities())"></mat-divider>
<button (click)="finishDuel()" *ngIf="(RbacActivity.EDIT_FIGHT | rbac : this.rbacService.getActivities())
&& (!selectedDuel || selectedDuel?.finished == false)"
[disabled]="!selectedDuel || (tournament && tournament.locked)"
Expand Down Expand Up @@ -111,16 +112,16 @@
</button>
<mat-divider [vertical]="true" *ngIf="(RbacActivity.READ_TEAMS_RANKINGS | rbac : this.rbacService.getActivities()) ||
(RbacActivity.READ_COMPETITORS_RANKINGS | rbac : this.rbacService.getActivities())"></mat-divider>
<button (click)="showTeamsClassification(areAllDuelsOver())" *ngIf="((tournament && tournament.teamSize && tournament.teamSize>1) || (tournament && tournament.type === kingOfTheMountainType))
&& (RbacActivity.READ_TEAMS_RANKINGS | rbac : this.rbacService.getActivities())"
<button (click)="showTeamsClassification(areAllDuelsOver())"
*ngIf="(RbacActivity.READ_TEAMS_RANKINGS | rbac : this.rbacService.getActivities())"
[disabled]="!groups[0] || !groups[0].fights || groups[0].fights.length == 0"
[matTooltipShowDelay]="500" color="primary"
mat-button
matTooltip="{{'teamsRanking' | translate}}">
<mat-icon class="kendo-icon" svgIcon="teams-classification"></mat-icon>
</button>
<button (click)="showCompetitorsClassification()"
*ngIf="(RbacActivity.READ_COMPETITORS_RANKINGS | rbac : this.rbacService.getActivities())"
*ngIf="(tournament && tournament.teamSize && tournament.teamSize>1) && (RbacActivity.READ_COMPETITORS_RANKINGS | rbac : this.rbacService.getActivities())"
[disabled]="!groups[0] || !groups[0].fights || groups[0].fights.length == 0"
[matTooltipShowDelay]="500"
class="competitors-classification" color="primary"
Expand All @@ -144,10 +145,10 @@
</div>
<div class="filter-shiaijo" *ngIf="tournament!=undefined && tournament!.shiaijos! > 1">
<div class="shiaijo-label">
{{'shiaijo'| translate}}
{{ 'shiaijo'| translate }}
</div>
<div class="shiaijo-name" (click)="changeShiaijo()" (keydown)="changeShiaijo()" >
{{getShiaijoTag()}}
<div class="shiaijo-name" (click)="changeShiaijo()" (keydown)="changeShiaijo()">
{{ getShiaijoTag() }}
</div>
</div>
<app-filter (filterChanged)="filter($event)" (reset)="filter('')" [resetValue]="resetFilterValue"></app-filter>
Expand All @@ -163,10 +164,10 @@
<div *ngFor="let group of groups" class="fight-list">
<h2 *ngIf="showLevelTags && showLevelOfGroup.get(group) && filteredLevels.includes(group.level)"
[ngClass]="{'level-name-hidden': groups.length < 2 || filteredFights.get(group.id!)?.length == 0}"
class="level-name">{{'level' | translate}} {{group.level + 1}}</h2>
class="level-name">{{ 'level' | translate }} {{ group.level + 1 }}</h2>
<h3 *ngIf="filteredFights.get(group.id!)?.length! > 0"
[ngClass]="{'group-name-hidden': groups.length < 2 || filteredFights.get(group.id!)?.length == 0}"
class="group-name">{{'group' | translate}} {{group.index + 1}}</h3>
class="group-name">{{ 'group' | translate }} {{ group.index + 1 }}</h3>
<div *ngIf="filteredFights.get(group.id!)?.length! > 0"
[ngClass]="{'fights-of-group': groups.length > 1 && filteredFights.get(group.id!)?.length! > 0}">
<fight (click)="selectFight(fight)" (keydown)="selectFight(fight)" (onSelectedDuel)="selectDuel($event)"
Expand Down
17 changes: 10 additions & 7 deletions frontend/src/app/views/fight-list/fight-list.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -722,17 +722,18 @@ export class FightListComponent extends RbacBasedComponent implements OnInit, On
}
}

//this.selectedGroup = this.groups.find((group: Group): boolean => group.fights.indexOf(fight) >= 0)!;

selectDuel(duel: Duel): void {
this.selectedDuel = duel;
this.duelChangedService.isDuelUpdated.next(duel);
if (duel) {
this.selectedGroup = this.groups.find((group: Group): boolean => group.unties.indexOf(duel) >= 0)!;
if (duel.duration) {
this.timeChangedService.isElapsedTimeChanged.next(duel.duration);
} else {
this.timeChangedService.isElapsedTimeChanged.next(0);
}
}
if (duel) {
if (duel.totalDuration) {
this.timeChangedService.isTotalTimeChanged.next(duel.totalDuration);
} else {
Expand All @@ -746,8 +747,8 @@ export class FightListComponent extends RbacBasedComponent implements OnInit, On
}

areAllDuelsOver(): boolean {
const fights: Fight[] = this.getFights();
const unties: Duel[] = this.getUnties();
const fights: Fight[] | undefined = this.selectedGroup ? this.filteredFights.get(this.selectedGroup!.id!) : this.getFights();
const unties: Duel[] | undefined = this.selectedGroup ? this.filteredUnties.get(this.selectedGroup!.id!) : this.getUnties();
if (fights) {
for (const fight of fights) {
for (const duel of fight.duels) {
Expand All @@ -756,9 +757,11 @@ export class FightListComponent extends RbacBasedComponent implements OnInit, On
}
}
}
for (const duel of unties) {
if (!duel.finished) {
return false;
if (unties) {
for (const duel of unties) {
if (!duel.finished) {
return false;
}
}
}
}
Expand Down

0 comments on commit 686222d

Please sign in to comment.