diff --git a/README.md b/README.md index dba7bf27e..cc339b628 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-519h-blueviolet.svg)]() +[![Time](https://img.shields.io/badge/development-519.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/backend/kendo-tournament-pdf/src/main/java/com/softwaremagico/kt/pdf/ParentList.java b/backend/kendo-tournament-pdf/src/main/java/com/softwaremagico/kt/pdf/ParentList.java index 2d7b59da6..69dacc85b 100644 --- a/backend/kendo-tournament-pdf/src/main/java/com/softwaremagico/kt/pdf/ParentList.java +++ b/backend/kendo-tournament-pdf/src/main/java/com/softwaremagico/kt/pdf/ParentList.java @@ -30,9 +30,11 @@ import com.lowagie.text.pdf.PdfPTable; import com.lowagie.text.pdf.PdfWriter; -import java.awt.Color; +import java.awt.*; public abstract class ParentList extends PdfDocument { + + protected static final float MIN_HEADER_HIGH = 50f; protected static final int FOOTER_BORDER = 0; protected static final int HEADER_BORDER = 0; protected static final int CELL_BORDER = 0; @@ -269,7 +271,6 @@ public void createContent(Document document, PdfWriter writer) throws EmptyPdfBo PdfTheme.HEADER_FONT_SIZE); createFooterRow(document, mainTable, document.getPageSize().getWidth(), document.getPageSize().getHeight(), writer, PdfTheme.getBasicFont(), PdfTheme.FOOTER_FONT_SIZE); - createRowSeparator(mainTable); createBodyRows(document, mainTable, document.getPageSize().getWidth(), document.getPageSize().getHeight(), writer, PdfTheme.getBasicFont(), PdfTheme.FONT_SIZE); createRowSeparator(mainTable); diff --git a/backend/kendo-tournament-pdf/src/main/java/com/softwaremagico/kt/pdf/controller/PdfController.java b/backend/kendo-tournament-pdf/src/main/java/com/softwaremagico/kt/pdf/controller/PdfController.java index cdbacee33..d4b1cf391 100644 --- a/backend/kendo-tournament-pdf/src/main/java/com/softwaremagico/kt/pdf/controller/PdfController.java +++ b/backend/kendo-tournament-pdf/src/main/java/com/softwaremagico/kt/pdf/controller/PdfController.java @@ -94,7 +94,7 @@ public PdfController(MessageSource messageSource, RoleController roleController, } public CompetitorsScoreList generateCompetitorsScoreList(Locale locale, TournamentDTO tournament, List competitorTopTen) { - return new CompetitorsScoreList(messageSource, locale, tournament, competitorTopTen); + return new CompetitorsScoreList(messageSource, locale, tournament, competitorTopTen, true); } public TeamsScoreList generateTeamsScoreList(Locale locale, TournamentDTO tournament, List teamsTopTen) { diff --git a/backend/kendo-tournament-pdf/src/main/java/com/softwaremagico/kt/pdf/events/FooterEvent.java b/backend/kendo-tournament-pdf/src/main/java/com/softwaremagico/kt/pdf/events/FooterEvent.java index c0a0297e9..ac57fa7aa 100644 --- a/backend/kendo-tournament-pdf/src/main/java/com/softwaremagico/kt/pdf/events/FooterEvent.java +++ b/backend/kendo-tournament-pdf/src/main/java/com/softwaremagico/kt/pdf/events/FooterEvent.java @@ -33,7 +33,7 @@ import com.softwaremagico.kt.pdf.PdfTheme; public class FooterEvent extends PdfPageEventHelper { - private static final int BOTTOM_MARGIN = 20; + private static final int BOTTOM_MARGIN = 0; /** * Adds a footer to every page diff --git a/backend/kendo-tournament-pdf/src/main/java/com/softwaremagico/kt/pdf/lists/CompetitorsScoreList.java b/backend/kendo-tournament-pdf/src/main/java/com/softwaremagico/kt/pdf/lists/CompetitorsScoreList.java index 887d3fb22..3f7ef04cd 100644 --- a/backend/kendo-tournament-pdf/src/main/java/com/softwaremagico/kt/pdf/lists/CompetitorsScoreList.java +++ b/backend/kendo-tournament-pdf/src/main/java/com/softwaremagico/kt/pdf/lists/CompetitorsScoreList.java @@ -47,17 +47,23 @@ * Creates a sheet with the competitors ranking depending on the performance on the tournament. */ public class CompetitorsScoreList extends ParentList { + private static final float[] TABLE_WIDTH = {0.50f, 0.20f, 0.20f, 0.20f}; + private static final float[] TABLE_WIDTH_WITH_CLASSIFICATION = {0.10f, 0.50f, 0.20f, 0.20f, 0.20f}; private final List competitorTopTen; private final TournamentDTO tournament; private final MessageSource messageSource; private final Locale locale; - public CompetitorsScoreList(MessageSource messageSource, Locale locale, TournamentDTO tournament, List competitorTopTen) { + private final boolean showClassificationOrder; + + public CompetitorsScoreList(MessageSource messageSource, Locale locale, TournamentDTO tournament, List competitorTopTen, + boolean showClassificationOrder) { this.tournament = tournament; this.competitorTopTen = competitorTopTen; this.messageSource = messageSource; this.locale = locale; + this.showClassificationOrder = showClassificationOrder; } @Override @@ -78,6 +84,7 @@ public void createHeaderRow(Document document, PdfPTable mainTable, float width, cell.setColspan(getTableWidths().length); cell.setBorderWidth(HEADER_BORDER); cell.setHorizontalAlignment(Element.ALIGN_CENTER); + cell.setMinimumHeight(MIN_HEADER_HIGH); mainTable.addCell(cell); } @@ -85,6 +92,9 @@ public void createHeaderRow(Document document, PdfPTable mainTable, float width, public void createBodyRows(Document document, PdfPTable mainTable, float width, float height, PdfWriter writer, BaseFont font, int fontSize) { + if (showClassificationOrder) { + mainTable.addCell(getCell("", PdfTheme.getBasicFont(), 0, Element.ALIGN_CENTER, Font.BOLD)); + } mainTable.addCell(getCell(messageSource.getMessage("classification.competitors.competitor.name", null, locale), PdfTheme.getBasicFont(), 0, Element.ALIGN_CENTER, Font.BOLD)); mainTable.addCell(getCell(messageSource.getMessage("classification.competitors.duels.won", null, locale), @@ -94,7 +104,12 @@ public void createBodyRows(Document document, PdfPTable mainTable, float width, mainTable.addCell(getCell(messageSource.getMessage("classification.competitors.fights", null, locale), PdfTheme.getBasicFont(), 0, Element.ALIGN_CENTER, Font.BOLD)); + int counter = 1; for (final ScoreOfCompetitorDTO scoreOfCompetitor : competitorTopTen) { + if (showClassificationOrder) { + mainTable.addCell(getCell(String.valueOf(counter), PdfTheme.getHandwrittenFont(), 1, Element.ALIGN_LEFT)); + counter++; + } mainTable.addCell(getCell(NameUtils.getLastnameName(scoreOfCompetitor.getCompetitor()), PdfTheme.getHandwrittenFont(), 1, Element.ALIGN_CENTER)); mainTable.addCell(getCell(scoreOfCompetitor.getWonDuels() + (scoreOfCompetitor.getUntieDuels() > 0 ? "*" : "") + "/" + scoreOfCompetitor.getDrawDuels(), PdfTheme.getHandwrittenFont(), 1, Element.ALIGN_CENTER)); @@ -112,6 +127,9 @@ public void createFooterRow(Document document, PdfPTable mainTable, float width, @Override public float[] getTableWidths() { + if (showClassificationOrder) { + return TABLE_WIDTH_WITH_CLASSIFICATION; + } return TABLE_WIDTH; } diff --git a/backend/kendo-tournament-pdf/src/main/java/com/softwaremagico/kt/pdf/lists/FightSummary.java b/backend/kendo-tournament-pdf/src/main/java/com/softwaremagico/kt/pdf/lists/FightSummary.java index c53b7a1bf..3bc26ba3f 100644 --- a/backend/kendo-tournament-pdf/src/main/java/com/softwaremagico/kt/pdf/lists/FightSummary.java +++ b/backend/kendo-tournament-pdf/src/main/java/com/softwaremagico/kt/pdf/lists/FightSummary.java @@ -232,6 +232,7 @@ public void createHeaderRow(Document document, PdfPTable mainTable, float width, cell.setColspan(getTableWidths().length); cell.setBorderWidth(HEADER_BORDER); cell.setHorizontalAlignment(Element.ALIGN_CENTER); + cell.setMinimumHeight(MIN_HEADER_HIGH); mainTable.addCell(cell); } diff --git a/backend/kendo-tournament-pdf/src/main/java/com/softwaremagico/kt/pdf/lists/FightsList.java b/backend/kendo-tournament-pdf/src/main/java/com/softwaremagico/kt/pdf/lists/FightsList.java index e26bb8404..5dd04dc7c 100644 --- a/backend/kendo-tournament-pdf/src/main/java/com/softwaremagico/kt/pdf/lists/FightsList.java +++ b/backend/kendo-tournament-pdf/src/main/java/com/softwaremagico/kt/pdf/lists/FightsList.java @@ -197,6 +197,7 @@ public void createHeaderRow(Document document, PdfPTable mainTable, float width, cell.setBorderWidth(HEADER_BORDER); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); + cell.setMinimumHeight(MIN_HEADER_HIGH); mainTable.addCell(cell); } diff --git a/backend/kendo-tournament-pdf/src/main/java/com/softwaremagico/kt/pdf/lists/GroupList.java b/backend/kendo-tournament-pdf/src/main/java/com/softwaremagico/kt/pdf/lists/GroupList.java index d07561c9f..620f77d5c 100644 --- a/backend/kendo-tournament-pdf/src/main/java/com/softwaremagico/kt/pdf/lists/GroupList.java +++ b/backend/kendo-tournament-pdf/src/main/java/com/softwaremagico/kt/pdf/lists/GroupList.java @@ -154,6 +154,7 @@ public void createHeaderRow(Document document, PdfPTable mainTable, float width, cell.setBorderWidth(HEADER_BORDER); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); + cell.setMinimumHeight(MIN_HEADER_HIGH); mainTable.addCell(cell); } diff --git a/backend/kendo-tournament-pdf/src/main/java/com/softwaremagico/kt/pdf/lists/RoleList.java b/backend/kendo-tournament-pdf/src/main/java/com/softwaremagico/kt/pdf/lists/RoleList.java index 287186de6..ab518b869 100644 --- a/backend/kendo-tournament-pdf/src/main/java/com/softwaremagico/kt/pdf/lists/RoleList.java +++ b/backend/kendo-tournament-pdf/src/main/java/com/softwaremagico/kt/pdf/lists/RoleList.java @@ -110,6 +110,7 @@ public void createHeaderRow(Document document, PdfPTable mainTable, float width, cell.setBorderWidth(HEADER_BORDER); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); + cell.setMinimumHeight(MIN_HEADER_HIGH); mainTable.addCell(cell); } diff --git a/backend/kendo-tournament-pdf/src/main/java/com/softwaremagico/kt/pdf/lists/TeamList.java b/backend/kendo-tournament-pdf/src/main/java/com/softwaremagico/kt/pdf/lists/TeamList.java index 9ca0f07c1..698b2ac2f 100644 --- a/backend/kendo-tournament-pdf/src/main/java/com/softwaremagico/kt/pdf/lists/TeamList.java +++ b/backend/kendo-tournament-pdf/src/main/java/com/softwaremagico/kt/pdf/lists/TeamList.java @@ -129,6 +129,7 @@ public void createHeaderRow(Document document, PdfPTable mainTable, float width, cell.setBorderWidth(HEADER_BORDER); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); + cell.setMinimumHeight(MIN_HEADER_HIGH); mainTable.addCell(cell); } diff --git a/backend/kendo-tournament-pdf/src/main/java/com/softwaremagico/kt/pdf/lists/TeamsScoreList.java b/backend/kendo-tournament-pdf/src/main/java/com/softwaremagico/kt/pdf/lists/TeamsScoreList.java index 24f6a9833..6b5cdd30f 100644 --- a/backend/kendo-tournament-pdf/src/main/java/com/softwaremagico/kt/pdf/lists/TeamsScoreList.java +++ b/backend/kendo-tournament-pdf/src/main/java/com/softwaremagico/kt/pdf/lists/TeamsScoreList.java @@ -107,6 +107,7 @@ public void createHeaderRow(Document document, PdfPTable mainTable, float width, cell.setColspan(getTableWidths().length); cell.setBorderWidth(HEADER_BORDER); cell.setHorizontalAlignment(Element.ALIGN_CENTER); + cell.setMinimumHeight(MIN_HEADER_HIGH); mainTable.addCell(cell); } diff --git a/frontend/src/app/views/club-list/club-list.component.ts b/frontend/src/app/views/club-list/club-list.component.ts index 7863573ba..32ce7e723 100644 --- a/frontend/src/app/views/club-list/club-list.component.ts +++ b/frontend/src/app/views/club-list/club-list.component.ts @@ -47,6 +47,7 @@ export class ClubListComponent extends RbacBasedComponent implements OnInit { showAllElements(): void { this.clubService.getAll().subscribe((clubs: Club[]): void => { + clubs.sort((a: Club, b: Club) => a.name.localeCompare(b.name)); this.basicTableData.dataSource.data = clubs; }); }