From d542d0b97fb762f14c3bb09e0a20e9c1f22ea1da Mon Sep 17 00:00:00 2001 From: Software Magico Date: Mon, 21 Oct 2024 16:02:01 +0200 Subject: [PATCH 1/2] Decreasing the number of times then ranking is shown. --- README.md | 2 +- .../views/fight-list/fight-list.component.ts | 21 ++++++++++++------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 96e9ee64..642a7ede 100644 --- a/README.md +++ b/README.md @@ -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-653h-blueviolet.svg)]() +[![Time](https://img.shields.io/badge/development-653.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) diff --git a/frontend/src/app/views/fight-list/fight-list.component.ts b/frontend/src/app/views/fight-list/fight-list.component.ts index efcb6bf5..09bdf3fe 100644 --- a/frontend/src/app/views/fight-list/fight-list.component.ts +++ b/frontend/src/app/views/fight-list/fight-list.component.ts @@ -79,6 +79,7 @@ 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, @@ -327,7 +328,7 @@ export class FightListComponent extends RbacBasedComponent implements OnInit, On this.resetFilter(); //Use a timeout or refresh before the components are drawn. setTimeout((): void => { - if (!this.selectFirstUnfinishedDuel() && this.getUnties().length === 0 + 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); @@ -532,10 +533,13 @@ 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); } }); @@ -745,6 +749,7 @@ 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) { @@ -756,12 +761,14 @@ export class FightListComponent extends RbacBasedComponent implements OnInit, On } showClassification(): void { - 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.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(); + } } } From b9ffc5fe577c75aa147c98e64f834554aa986cf9 Mon Sep 17 00:00:00 2001 From: Software Magico Date: Mon, 21 Oct 2024 16:31:43 +0200 Subject: [PATCH 2/2] Decreasing the number of times then ranking is shown. --- .../views/fight-list/fight-list.component.ts | 35 +++++++------------ frontend/src/assets/i18n/ca.json | 3 +- frontend/src/assets/i18n/de.json | 3 +- frontend/src/assets/i18n/en.json | 3 +- frontend/src/assets/i18n/es.json | 3 +- frontend/src/assets/i18n/it.json | 3 +- frontend/src/assets/i18n/nl.json | 3 +- 7 files changed, 25 insertions(+), 28 deletions(-) diff --git a/frontend/src/app/views/fight-list/fight-list.component.ts b/frontend/src/app/views/fight-list/fight-list.component.ts index 09bdf3fe..e3c5fe55 100644 --- a/frontend/src/app/views/fight-list/fight-list.component.ts +++ b/frontend/src/app/views/fight-list/fight-list.component.ts @@ -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, @@ -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 { @@ -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); } }); @@ -611,6 +599,7 @@ export class FightListComponent extends RbacBasedComponent implements OnInit, On const dialogRef: MatDialogRef = 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 => { @@ -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. @@ -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()); @@ -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; diff --git a/frontend/src/assets/i18n/ca.json b/frontend/src/assets/i18n/ca.json index e97bdd19..ffc6239f 100644 --- a/frontend/src/assets/i18n/ca.json +++ b/frontend/src/assets/i18n/ca.json @@ -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." } diff --git a/frontend/src/assets/i18n/de.json b/frontend/src/assets/i18n/de.json index f942f614..8e77f9c8 100644 --- a/frontend/src/assets/i18n/de.json +++ b/frontend/src/assets/i18n/de.json @@ -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." } diff --git a/frontend/src/assets/i18n/en.json b/frontend/src/assets/i18n/en.json index 3aa12d71..92653aac 100644 --- a/frontend/src/assets/i18n/en.json +++ b/frontend/src/assets/i18n/en.json @@ -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." } diff --git a/frontend/src/assets/i18n/es.json b/frontend/src/assets/i18n/es.json index bc1153a5..85965574 100644 --- a/frontend/src/assets/i18n/es.json +++ b/frontend/src/assets/i18n/es.json @@ -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." } diff --git a/frontend/src/assets/i18n/it.json b/frontend/src/assets/i18n/it.json index 90f66d46..d40e32cf 100644 --- a/frontend/src/assets/i18n/it.json +++ b/frontend/src/assets/i18n/it.json @@ -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." } diff --git a/frontend/src/assets/i18n/nl.json b/frontend/src/assets/i18n/nl.json index 6ebe967b..8a42cba1 100644 --- a/frontend/src/assets/i18n/nl.json +++ b/frontend/src/assets/i18n/nl.json @@ -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." }