Skip to content

Commit

Permalink
Decreasing the number of times then ranking is shown.
Browse files Browse the repository at this point in the history
  • Loading branch information
softwaremagico committed Oct 21, 2024
1 parent d542d0b commit b9ffc5f
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 28 deletions.
35 changes: 13 additions & 22 deletions frontend/src/app/views/fight-list/fight-list.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ export class FightListComponent extends RbacBasedComponent implements OnInit, On
selectedShiaijo: number = -1;

private topicSubscription: Subscription;
private classificationAlreadyShown: boolean = false;


constructor(private router: Router, private activatedRoute: ActivatedRoute,
Expand Down Expand Up @@ -326,14 +325,6 @@ export class FightListComponent extends RbacBasedComponent implements OnInit, On
}

this.resetFilter();
//Use a timeout or refresh before the components are drawn.
setTimeout((): void => {
if (!this.classificationAlreadyShown && !this.selectFirstUnfinishedDuel() && this.getUnties().length === 0
&& this.tournament.type !== TournamentType.KING_OF_THE_MOUNTAIN && this.tournament.type !== TournamentType.BUBBLE_SORT
&& this.tournament.type !== TournamentType.SENBATSU) {
this.showTeamsClassification(true);
}
}, 1000);
}

private setLevelTagVisibility(sortedGroups: Group[]): void {
Expand Down Expand Up @@ -533,13 +524,10 @@ export class FightListComponent extends RbacBasedComponent implements OnInit, On
if (result == undefined) {
//Do nothing
} else if (result?.action === Action.Add) {
this.classificationAlreadyShown = false;
this.selectFirstUnfinishedDuel();
} else if (result?.action === Action.Update) {
this.classificationAlreadyShown = false;
this.updateRowData(result.data);
} else if (result?.action === Action.Delete) {
this.classificationAlreadyShown = false;
this.deleteRowData(result.data);
}
});
Expand Down Expand Up @@ -611,6 +599,7 @@ export class FightListComponent extends RbacBasedComponent implements OnInit, On
const dialogRef: MatDialogRef<TeamRankingComponent> = this.dialog.open(TeamRankingComponent, {
panelClass: 'pop-up-panel',
width: '85vw',
restoreFocus: false,
data: {tournament: this.tournament, group: this.selectedGroup, finished: fightsFinished}
});
dialogRef.afterClosed().subscribe(result => {
Expand Down Expand Up @@ -694,7 +683,7 @@ export class FightListComponent extends RbacBasedComponent implements OnInit, On
if (this.getFights().length < this.groups[0].teams.length - 1) {
this.addElement();
} else {
this.showClassification();
this.showFightsFinishedMessage();
}
} else {
// Tournament, each group must have a winner. Show for each group the winners.
Expand Down Expand Up @@ -749,10 +738,10 @@ export class FightListComponent extends RbacBasedComponent implements OnInit, On
//Null value means that fights are not created due to an existing draw score.
if (_fights.length > 0) {
this.refreshFights();
this.classificationAlreadyShown = false;
} else {
if (showClassification && this.tournament.type !== TournamentType.KING_OF_THE_MOUNTAIN
&& this.tournament.type !== TournamentType.BUBBLE_SORT && this.tournament.type !== TournamentType.SENBATSU) {
this.showFightsFinishedMessage();
this.showClassification();
}
this.finishTournament(new Date());
Expand All @@ -761,17 +750,19 @@ export class FightListComponent extends RbacBasedComponent implements OnInit, On
}

showClassification(): void {
if (!this.classificationAlreadyShown) {
if ((this.tournament?.teamSize && this.tournament?.teamSize > 1) ||
(this.tournament && (this.tournament.type === TournamentType.KING_OF_THE_MOUNTAIN || this.tournament.type === TournamentType.SENBATSU
|| this.tournament.type === TournamentType.BUBBLE_SORT || this.tournament.type === TournamentType.CHAMPIONSHIP))) {
this.showTeamsClassification(true);
} else {
this.showCompetitorsClassification();
}
if ((this.tournament?.teamSize && this.tournament?.teamSize > 1) ||
(this.tournament && (this.tournament.type === TournamentType.KING_OF_THE_MOUNTAIN || this.tournament.type === TournamentType.SENBATSU
|| this.tournament.type === TournamentType.BUBBLE_SORT || this.tournament.type === TournamentType.CHAMPIONSHIP))) {
this.showTeamsClassification(true);
} else {
this.showCompetitorsClassification();
}
}

showFightsFinishedMessage(): void {
this.messageService.infoMessage("fightsEnded");
}

finishTournament(date: Date | undefined): void {
if (!this.tournament.finishedAt && date) {
this.tournament.finishedAt = date;
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/assets/i18n/ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -732,5 +732,6 @@
"senbatsuRungLength": "Distància entre desafiaments",
"senbatsuRungLengthHint": "La disparitat màxima permesa a la capacitat entre dos competidors per tal d'establir un desafiament.",
"reverseOrder": "Invertir",
"reverseOrderHint": "Invertir l'ordre dels equips."
"reverseOrderHint": "Invertir l'ordre dels equips.",
"fightsEnded": "Tots els partits s'han acabat."
}
3 changes: 2 additions & 1 deletion frontend/src/assets/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -710,5 +710,6 @@
"senbatsuRungLength": "Distanz zwischen Desafíos",
"senbatsuRungLengthHint": "Der maximal zulässige Leistungsunterschied zwischen zwei Teilnehmern zum Zwecke der Festlegung einer Herausforderung.",
"reverseOrder": "Reverse",
"reverseOrderHint": "Kehren Sie die Reihenfolge der Teams um."
"reverseOrderHint": "Kehren Sie die Reihenfolge der Teams um.",
"fightsEnded": "Alle Spiele sind vorbei."
}
3 changes: 2 additions & 1 deletion frontend/src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -727,5 +727,6 @@
"senbatsuRungLength": "Challenge distance",
"senbatsuRungLengthHint": "The maximum allowable disparity in ability between two competitors for the purpose of establishing a challenge.",
"reverseOrder": "Reverse",
"reverseOrderHint": "Reverse teams' order"
"reverseOrderHint": "Reverse teams' order",
"fightsEnded": "All matches have finished."
}
3 changes: 2 additions & 1 deletion frontend/src/assets/i18n/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -728,5 +728,6 @@
"senbatsuRungLength": "Distancia entre desafíos",
"senbatsuRungLengthHint": "La disparidad máxima permitida en la capacidad entre dos competidores con el fin de establecer un desafío.",
"reverseOrder": "Invertir",
"reverseOrderHint": "Invertir el orden de los equipos."
"reverseOrderHint": "Invertir el orden de los equipos.",
"fightsEnded": "Todos los partidos han terminado."
}
3 changes: 2 additions & 1 deletion frontend/src/assets/i18n/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -716,5 +716,6 @@
"senbatsuRungLength": "Distanza tra i desafíos",
"senbatsuRungLengthHint": "La massima disparità consentita nell'abilità tra due concorrenti allo scopo di stabilire una sfida.",
"reverseOrder": "Invertire",
"reverseOrderHint": "Invertire l'ordine delle squadre."
"reverseOrderHint": "Invertire l'ordine delle squadre.",
"fightsEnded": "Tutti gli incontri sono finiti."
}
3 changes: 2 additions & 1 deletion frontend/src/assets/i18n/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -710,5 +710,6 @@
"senbatsuRungLength": "Afstand tussen de veilige afstanden",
"senbatsuRungLengthHint": "Het maximaal toegestane verschil in bekwaamheid tussen twee concurrenten met als doel een uitdaging aan te gaan.",
"reverseOrder": "Reverse",
"reverseOrderHint": "Draai de volgorde van de teams om."
"reverseOrderHint": "Draai de volgorde van de teams om.",
"fightsEnded": "Alle spellen zijn voorbij."
}

0 comments on commit b9ffc5f

Please sign in to comment.