diff --git a/README.md b/README.md
index 8635f3d7..22946196 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-618h-blueviolet.svg)]()
+[![Time](https://img.shields.io/badge/development-619.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/html/lists/BlogExporter.java b/backend/kendo-tournament-pdf/src/main/java/com/softwaremagico/kt/html/lists/BlogExporter.java
index 39ed6a5c..46399218 100644
--- a/backend/kendo-tournament-pdf/src/main/java/com/softwaremagico/kt/html/lists/BlogExporter.java
+++ b/backend/kendo-tournament-pdf/src/main/java/com/softwaremagico/kt/html/lists/BlogExporter.java
@@ -257,9 +257,9 @@ private String getDrawFight(FightDTO fightDTO, int duel) {
// Draw Fights
final String draw;
if (fightDTO.getDuels().get(duel).getWinner() == 0 && fightDTO.isOver()) {
- draw = String.valueOf(Score.DRAW.getAbbreviation());
+ draw = String.valueOf(Score.DRAW.getPdfAbbreviation());
} else {
- draw = String.valueOf(Score.EMPTY.getAbbreviation());
+ draw = String.valueOf(Score.EMPTY.getPdfAbbreviation());
}
return draw;
}
@@ -273,9 +273,9 @@ private String getFaults(FightDTO fightDTO, int duel, boolean leftTeam) {
faults = fightDTO.getDuels().get(duel).getCompetitor2Fault();
}
if (faults) {
- faultSymbol = String.valueOf(Score.FAULT.getAbbreviation());
+ faultSymbol = String.valueOf(Score.FAULT.getPdfAbbreviation());
} else {
- faultSymbol = String.valueOf(Score.EMPTY.getAbbreviation());
+ faultSymbol = String.valueOf(Score.EMPTY.getPdfAbbreviation());
}
return faultSymbol;
}
@@ -283,9 +283,9 @@ private String getFaults(FightDTO fightDTO, int duel, boolean leftTeam) {
private String getScore(FightDTO fightDTO, int duel, int score, boolean leftTeam) {
try {
if (leftTeam) {
- return String.valueOf(fightDTO.getDuels().get(duel).getCompetitor1Score().get(score).getAbbreviation());
+ return String.valueOf(fightDTO.getDuels().get(duel).getCompetitor1Score().get(score).getPdfAbbreviation());
} else {
- return String.valueOf(fightDTO.getDuels().get(duel).getCompetitor2Score().get(score).getAbbreviation());
+ return String.valueOf(fightDTO.getDuels().get(duel).getCompetitor2Score().get(score).getPdfAbbreviation());
}
} catch (IndexOutOfBoundsException | NullPointerException e) {
return "";
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 c9433830..a796008d 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
@@ -44,11 +44,11 @@ public abstract class ParentList extends PdfDocument {
protected static final int TABLE_BORDER = 0;
private static final float HEADER_SEPARATOR = 20f;
- private static final int BOTTOM_PADDING = 15;
+ protected static final int BOTTOM_PADDING = 15;
private static final int FONT_BIG_EXTRA_SIZE = 10;
private static final int FONT_MEDIUM_EXTRA_SIZE = 6;
- private static final int FONT_SMALL_EXTRA_SIZE = 4;
+ protected static final int FONT_SMALL_EXTRA_SIZE = 4;
/**
@@ -139,19 +139,29 @@ public PdfPCell getCell(String text, int border, BaseFont font, int colspan, int
return getCell(text, border, colspan, align, BaseColor.WHITE, font, PdfTheme.FONT_SIZE, Font.NORMAL);
}
+ public PdfPCell getCell(String text, int border, BaseFont font, int fontSize, Color color, int colspan, int align) {
+ return getCell(text, border, colspan, align, color, font, fontSize, Font.NORMAL);
+ }
+
public PdfPCell getCell(String text, BaseFont font, int colspan, int align, int fontType) {
return getCell(text, CELL_BORDER, colspan, align, BaseColor.WHITE, font, PdfTheme.FONT_SIZE, fontType);
}
+ protected Color getCellBorderColor() {
+ return Color.LIGHT_GRAY;
+ }
+
public PdfPCell getCell(String text, int border, int colspan, int align, Color color,
BaseFont font, int fontSize, int fontType) {
final Paragraph p = new Paragraph(text, new Font(font, fontSize, fontType));
final PdfPCell cell = new PdfPCell(p);
cell.setColspan(colspan);
cell.setBorderWidth(border);
- cell.setBorderColor(Color.LIGHT_GRAY);
+ cell.setBorderColor(getCellBorderColor());
cell.setHorizontalAlignment(align);
- cell.setBackgroundColor(color);
+ if (color != null) {
+ cell.setBackgroundColor(color);
+ }
cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
return cell;
@@ -167,7 +177,7 @@ public PdfPCell getCell(String text, int border, int colspan, int align, Color c
* @return
*/
public PdfPCell getHeader(String text, int border, int align, int fontSize) {
- final PdfPCell cell = getCell(text, border, getTableWidths().length, align, new Color(255, 255, 255), PdfTheme.getTitleFont(), fontSize, Font.BOLD);
+ final PdfPCell cell = getCell(text, border, getTableWidths().length, align, Color.WHITE, PdfTheme.getTitleFont(), fontSize, Font.BOLD);
cell.setPaddingBottom(BOTTOM_PADDING);
return cell;
}
diff --git a/backend/kendo-tournament-pdf/src/main/java/com/softwaremagico/kt/pdf/PdfTheme.java b/backend/kendo-tournament-pdf/src/main/java/com/softwaremagico/kt/pdf/PdfTheme.java
index 64b2e7ce..4a442957 100644
--- a/backend/kendo-tournament-pdf/src/main/java/com/softwaremagico/kt/pdf/PdfTheme.java
+++ b/backend/kendo-tournament-pdf/src/main/java/com/softwaremagico/kt/pdf/PdfTheme.java
@@ -38,6 +38,8 @@ public abstract class PdfTheme {
public static final int FOOTER_FONT_SIZE = 8;
public static final int FONT_SIZE = 12;
+ public static final int SCORE_FONT_SIZE = 8;
+ public static final int SCORE_LIST_SIZE = 9;
public static final int HEADER_FONT_SIZE = FONT_SIZE + 15;
diff --git a/backend/kendo-tournament-pdf/src/main/java/com/softwaremagico/kt/pdf/events/FaultTriangleCellEvent.java b/backend/kendo-tournament-pdf/src/main/java/com/softwaremagico/kt/pdf/events/FaultTriangleCellEvent.java
new file mode 100644
index 00000000..6470d7ed
--- /dev/null
+++ b/backend/kendo-tournament-pdf/src/main/java/com/softwaremagico/kt/pdf/events/FaultTriangleCellEvent.java
@@ -0,0 +1,53 @@
+package com.softwaremagico.kt.pdf.events;
+
+/*-
+ * #%L
+ * Kendo Tournament Manager (PDF)
+ * %%
+ * Copyright (C) 2021 - 2024 Softwaremagico
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ * #L%
+ */
+
+import com.lowagie.text.Rectangle;
+import com.lowagie.text.pdf.PdfContentByte;
+import com.lowagie.text.pdf.PdfPCell;
+import com.lowagie.text.pdf.PdfPCellEvent;
+import com.lowagie.text.pdf.PdfPTable;
+
+import java.awt.Color;
+
+/**
+ * Event for creating a transparent cell.
+ */
+public class FaultTriangleCellEvent implements PdfPCellEvent {
+
+ private static final int TRIANGLE_MARGIN = 6;
+ private static final int BOTTOM_MARGIN = 4;
+
+
+ @Override
+ public void cellLayout(PdfPCell cell, Rectangle rect, PdfContentByte[] canvas) {
+ final PdfContentByte cb = canvas[PdfPTable.BACKGROUNDCANVAS];
+ cb.setColorStroke(Color.BLACK);
+ cb.setColorFill(Color.BLACK);
+ cb.moveTo(rect.getLeft() + TRIANGLE_MARGIN, rect.getBottom() + BOTTOM_MARGIN);
+ cb.lineTo(rect.getRight() - TRIANGLE_MARGIN, rect.getBottom() + BOTTOM_MARGIN);
+ cb.lineTo(rect.getLeft() + (rect.getRight() - rect.getLeft()) / 2, rect.getTop() - TRIANGLE_MARGIN
+ - (TRIANGLE_MARGIN - BOTTOM_MARGIN));
+ cb.closePathFillStroke();
+ cb.stroke();
+ }
+}
diff --git a/backend/kendo-tournament-pdf/src/main/java/com/softwaremagico/kt/pdf/events/ScoreCircleCellEvent.java b/backend/kendo-tournament-pdf/src/main/java/com/softwaremagico/kt/pdf/events/ScoreCircleCellEvent.java
new file mode 100644
index 00000000..0956814f
--- /dev/null
+++ b/backend/kendo-tournament-pdf/src/main/java/com/softwaremagico/kt/pdf/events/ScoreCircleCellEvent.java
@@ -0,0 +1,50 @@
+package com.softwaremagico.kt.pdf.events;
+
+/*-
+ * #%L
+ * Kendo Tournament Manager (PDF)
+ * %%
+ * Copyright (C) 2021 - 2024 Softwaremagico
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ * #L%
+ */
+
+import com.lowagie.text.Rectangle;
+import com.lowagie.text.pdf.PdfContentByte;
+import com.lowagie.text.pdf.PdfPCell;
+import com.lowagie.text.pdf.PdfPCellEvent;
+import com.lowagie.text.pdf.PdfPTable;
+
+import java.awt.Color;
+
+/**
+ * Event for creating a transparent cell.
+ */
+public class ScoreCircleCellEvent implements PdfPCellEvent {
+
+ private static final int CIRCLE_MARGIN = 1;
+
+
+ @Override
+ public void cellLayout(PdfPCell cell, Rectangle rect, PdfContentByte[] canvas) {
+ final PdfContentByte cb = canvas[PdfPTable.BACKGROUNDCANVAS];
+ cb.setColorStroke(Color.BLACK);
+ cb.setColorFill(Color.WHITE);
+ cb.circle(rect.getLeft() + (rect.getRight() - rect.getLeft()) / 2,
+ rect.getBottom() + (rect.getTop() - rect.getBottom()) / 2,
+ Math.min((rect.getRight() - rect.getLeft()) / 2, (rect.getTop() - rect.getBottom()) / 2) - CIRCLE_MARGIN);
+ cb.stroke();
+ }
+}
diff --git a/backend/kendo-tournament-pdf/src/main/java/com/softwaremagico/kt/pdf/lists/EmptyFightsList.java b/backend/kendo-tournament-pdf/src/main/java/com/softwaremagico/kt/pdf/lists/EmptyFightsList.java
index 8b21827f..d453f8ab 100644
--- a/backend/kendo-tournament-pdf/src/main/java/com/softwaremagico/kt/pdf/lists/EmptyFightsList.java
+++ b/backend/kendo-tournament-pdf/src/main/java/com/softwaremagico/kt/pdf/lists/EmptyFightsList.java
@@ -24,8 +24,10 @@
import com.softwaremagico.kt.core.controller.models.FightDTO;
import com.softwaremagico.kt.core.controller.models.GroupDTO;
import com.softwaremagico.kt.core.controller.models.TournamentDTO;
+import com.softwaremagico.kt.persistence.values.Score;
import org.springframework.context.MessageSource;
+import java.awt.Color;
import java.util.List;
import java.util.Locale;
@@ -38,18 +40,23 @@ protected EmptyFightsList(MessageSource messageSource, Locale locale, Tournament
super(messageSource, locale, tournament, groups, shiaijo);
}
+ @Override
+ protected Color getCellBorderColor() {
+ return Color.BLACK;
+ }
+
@Override
protected String getDrawFight(FightDTO fightDTO, int duel) {
return "";
}
@Override
- protected String getFaults(FightDTO fightDTO, int duel, boolean leftTeam) {
- return "";
+ protected boolean getFaults(FightDTO fightDTO, int duel, boolean leftTeam) {
+ return false;
}
@Override
- protected String getScore(FightDTO fightDTO, int duel, int score, boolean leftTeam) {
- return "";
+ protected Score getScore(FightDTO fightDTO, int duel, int score, boolean leftTeam) {
+ return null;
}
}
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 aaf0c6f5..d346cfc7 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
@@ -41,12 +41,15 @@
import com.softwaremagico.kt.pdf.BaseColor;
import com.softwaremagico.kt.pdf.ParentList;
import com.softwaremagico.kt.pdf.PdfTheme;
+import com.softwaremagico.kt.pdf.events.FaultTriangleCellEvent;
+import com.softwaremagico.kt.pdf.events.ScoreCircleCellEvent;
import com.softwaremagico.kt.persistence.values.Score;
import com.softwaremagico.kt.persistence.values.TournamentType;
import com.softwaremagico.kt.utils.NameUtils;
import com.softwaremagico.kt.utils.ShiaijoName;
import org.springframework.context.MessageSource;
+import java.awt.Color;
import java.util.Comparator;
import java.util.List;
import java.util.Locale;
@@ -56,7 +59,7 @@
* Creates a sheet with all fights and all its score. The scope is to have a report after the tournament is finished.
*/
public class FightSummary extends ParentList {
- private static final float[] TABLE_WIDTH = {0.29f, 0.03f, 0.08f, 0.08f, 0.04f, 0.08f, 0.08f, 0.03f, 0.29f};
+ private static final float[] TABLE_WIDTH = {0.29f, 0.03f, 0.08f, 0.08f, 0.02f, 0.08f, 0.08f, 0.03f, 0.29f};
private static final int DEFAULT_CELL_HEIGHT = 50;
private static final int FIGHT_BORDER = 1;
private final MessageSource messageSource;
@@ -78,31 +81,29 @@ public FightSummary(MessageSource messageSource, Locale locale, TournamentDTO to
protected String getDrawFight(FightDTO fightDTO, int duel) {
// Draw Fights
if (Objects.equals(fightDTO.getDuels().get(duel).getWinner(), 0) && fightDTO.isOver()) {
- return String.valueOf(Score.DRAW.getAbbreviation());
+ return String.valueOf(Score.DRAW.getPdfAbbreviation());
} else {
- return String.valueOf(Score.EMPTY.getAbbreviation());
+ return String.valueOf(Score.EMPTY.getPdfAbbreviation());
}
}
- protected String getFaults(FightDTO fightDTO, int duel, boolean leftTeam) {
+ protected boolean getFaults(FightDTO fightDTO, int duel, boolean leftTeam) {
if (leftTeam) {
- return fightDTO.getDuels().get(duel).getCompetitor1Fault() ? String.valueOf(Score.FAULT.getAbbreviation())
- : String.valueOf(Score.EMPTY.getAbbreviation());
+ return fightDTO.getDuels().get(duel).getCompetitor1Fault();
} else {
- return fightDTO.getDuels().get(duel).getCompetitor2Fault() ? String.valueOf(Score.FAULT.getAbbreviation())
- : String.valueOf(Score.EMPTY.getAbbreviation());
+ return fightDTO.getDuels().get(duel).getCompetitor2Fault();
}
}
- protected String getScore(FightDTO fightDTO, int duel, int score, boolean leftTeam) {
+ protected Score getScore(FightDTO fightDTO, int duel, int score, boolean leftTeam) {
try {
if (leftTeam) {
- return String.valueOf(fightDTO.getDuels().get(duel).getCompetitor1Score().get(score).getAbbreviation());
+ return fightDTO.getDuels().get(duel).getCompetitor1Score().get(score);
} else {
- return String.valueOf(fightDTO.getDuels().get(duel).getCompetitor2Score().get(score).getAbbreviation());
+ return fightDTO.getDuels().get(duel).getCompetitor2Score().get(score);
}
} catch (IndexOutOfBoundsException | NullPointerException e) {
- return "";
+ return null;
}
}
@@ -113,7 +114,9 @@ private PdfPTable fightTable(FightDTO fightDTO, boolean first) throws DocumentEx
table.addCell(getEmptyRow(DEFAULT_CELL_HEIGHT));
}
- table.addCell(getHeader3(fightDTO.getTeam1().getName() + " - " + fightDTO.getTeam2().getName(), 0));
+ table.addCell(getTeamHeader(fightDTO.getTeam1().getName(), TABLE_WIDTH.length / 2));
+ table.addCell(getTeamHeader("", 1));
+ table.addCell(getTeamHeader(fightDTO.getTeam2().getName(), TABLE_WIDTH.length / 2));
for (int i = 0; i < fightDTO.getTournament().getTeamSize(); i++) {
// Team 1
@@ -122,23 +125,29 @@ private PdfPTable fightTable(FightDTO fightDTO, boolean first) throws DocumentEx
if (competitor != null) {
name = NameUtils.getLastnameNameIni(competitor);
}
- table.addCell(getCell(name, FIGHT_BORDER, PdfTheme.getHandwrittenFont(), 1, Element.ALIGN_LEFT));
+
+ final PdfPCell team1NameCell = getCell(name, FIGHT_BORDER, PdfTheme.getHandwrittenFont(), PdfTheme.SCORE_LIST_SIZE, Color.WHITE, 1, Element.ALIGN_LEFT);
+ team1NameCell.setBorder(PdfPCell.BOTTOM);
+ table.addCell(team1NameCell);
// Faults
- table.addCell(getCell(getFaults(fightDTO, i, true), FIGHT_BORDER, PdfTheme.getHandwrittenFont(), 1, Element.ALIGN_CENTER));
+ table.addCell(getFaultCell(fightDTO, i, true));
// Points
- table.addCell(getCell(getScore(fightDTO, i, 1, true), FIGHT_BORDER, PdfTheme.getHandwrittenFont(), 1, Element.ALIGN_CENTER));
- table.addCell(getCell(getScore(fightDTO, i, 0, true), FIGHT_BORDER, PdfTheme.getHandwrittenFont(), 1, Element.ALIGN_CENTER));
+ table.addCell(getScoreCell(fightDTO, i, 1, true));
+ table.addCell(getScoreCell(fightDTO, i, 0, true));
- table.addCell(getCell(getDrawFight(fightDTO, i), FIGHT_BORDER, PdfTheme.getHandwrittenFont(), 1, Element.ALIGN_CENTER));
+ final PdfPCell drawCell = getCell(getDrawFight(fightDTO, i), FIGHT_BORDER, PdfTheme.getHandwrittenFont(),
+ PdfTheme.SCORE_FONT_SIZE, null, 1, Element.ALIGN_CENTER);
+ drawCell.setBorder(0);
+ table.addCell(drawCell);
// Points Team 2
- table.addCell(getCell(getScore(fightDTO, i, 0, false), FIGHT_BORDER, PdfTheme.getHandwrittenFont(), 1, Element.ALIGN_CENTER));
- table.addCell(getCell(getScore(fightDTO, i, 1, false), FIGHT_BORDER, PdfTheme.getHandwrittenFont(), 1, Element.ALIGN_CENTER));
+ table.addCell(getScoreCell(fightDTO, i, 0, false));
+ table.addCell(getScoreCell(fightDTO, i, 1, false));
// Faults
- table.addCell(getCell(getFaults(fightDTO, i, false), FIGHT_BORDER, PdfTheme.getHandwrittenFont(), 1, Element.ALIGN_CENTER));
+ table.addCell(getFaultCell(fightDTO, i, false));
// Team 2
competitor = fightDTO.getTeam2().getMembers().get(i);
@@ -146,13 +155,44 @@ private PdfPTable fightTable(FightDTO fightDTO, boolean first) throws DocumentEx
if (competitor != null) {
name = NameUtils.getLastnameNameIni(competitor);
}
- table.addCell(getCell(name, FIGHT_BORDER, PdfTheme.getHandwrittenFont(), 1, Element.ALIGN_RIGHT));
+ final PdfPCell team2NameCell = getCell(name, FIGHT_BORDER, PdfTheme.getHandwrittenFont(), 1, Element.ALIGN_RIGHT);
+ team2NameCell.setBorder(PdfPCell.BOTTOM);
+ table.addCell(team2NameCell);
}
table.addCell(getEmptyRow(DEFAULT_CELL_HEIGHT));
return table;
}
+ public PdfPCell getTeamHeader(String text, int colspan) {
+ final PdfPCell cell = getCell(text, 0, colspan, Element.ALIGN_CENTER, Color.WHITE, PdfTheme.getTitleFont(), PdfTheme.FONT_SIZE + FONT_SMALL_EXTRA_SIZE, Font.BOLD);
+ cell.setPaddingBottom(BOTTOM_PADDING);
+ return cell;
+ }
+
+
+ private PdfPCell getScoreCell(FightDTO fightDTO, int index, int scoreIndex, boolean leftCompetitor) {
+ final Score score = getScore(fightDTO, index, scoreIndex, leftCompetitor);
+ final PdfPCell pdfPCell = getCell(score != null ? String.valueOf(score.getPdfAbbreviation()) : "", FIGHT_BORDER,
+ PdfTheme.getHandwrittenFont(), PdfTheme.SCORE_FONT_SIZE, null, 1, Element.ALIGN_CENTER);
+ if (score != null) {
+ pdfPCell.setCellEvent(new ScoreCircleCellEvent());
+ }
+ return pdfPCell;
+ }
+
+
+ private PdfPCell getFaultCell(FightDTO fightDTO, int index, boolean leftCompetitor) {
+ final boolean fault = getFaults(fightDTO, index, leftCompetitor);
+ final PdfPCell pdfPCell = getCell("", FIGHT_BORDER,
+ PdfTheme.getHandwrittenFont(), PdfTheme.SCORE_FONT_SIZE, null, 1, Element.ALIGN_CENTER);
+ if (fault) {
+ pdfPCell.setCellEvent(new FaultTriangleCellEvent());
+ }
+ return pdfPCell;
+ }
+
+
@Override
public void createBodyRows(Document document, PdfPTable mainTable, float width, float height, PdfWriter writer,
BaseFont font, int fontSize) {
diff --git a/backend/kendo-tournament-pdf/src/test/java/com/softwaremagico/kt/utils/BasicDataTest.java b/backend/kendo-tournament-pdf/src/test/java/com/softwaremagico/kt/utils/BasicDataTest.java
index 2f7ea636..83abd5e0 100644
--- a/backend/kendo-tournament-pdf/src/test/java/com/softwaremagico/kt/utils/BasicDataTest.java
+++ b/backend/kendo-tournament-pdf/src/test/java/com/softwaremagico/kt/utils/BasicDataTest.java
@@ -165,11 +165,17 @@ protected List createFights(TournamentDTO tournament, List te
protected void resolveFights() {
int counter = 0;
for (final FightDTO fight : fights) {
+ if(counter %4 == 0){
+ fight.getDuels().get(1).setCompetitor1Fault(true);
+ }
for (final DuelDTO duel : fight.getDuels()) {
List scores = new ArrayList<>();
for (int i = 0; i < (counter % 3); i++) {
scores.add(Score.MEN);
}
+ for (int i = 0; i < (counter % 2); i++) {
+ scores.add(Score.FUSEN_GACHI);
+ }
duel.setCompetitor1Score(scores);
counter++;
}
diff --git a/backend/kendo-tournament-persistence/src/main/java/com/softwaremagico/kt/persistence/values/Score.java b/backend/kendo-tournament-persistence/src/main/java/com/softwaremagico/kt/persistence/values/Score.java
index 838209a6..4e7d01e2 100644
--- a/backend/kendo-tournament-persistence/src/main/java/com/softwaremagico/kt/persistence/values/Score.java
+++ b/backend/kendo-tournament-persistence/src/main/java/com/softwaremagico/kt/persistence/values/Score.java
@@ -26,34 +26,36 @@
public enum Score {
- MEN("Men", 'M', 'M'),
+ MEN("Men", 'M', 'M', 'M'),
- KOTE("Kote", 'K', 'K'),
+ KOTE("Kote", 'K', 'K', 'K'),
- DO("Do", 'D', 'D'),
+ DO("Do", 'D', 'D', 'D'),
- TSUKI("Tsuki", 'T', 'T'),
+ TSUKI("Tsuki", 'T', 'T', 'T'),
- IPPON("Ippon", 'I', 'I'),
+ IPPON("Ippon", 'I', 'I', 'I'),
- FUSEN_GACHI("Ippon", 'F', 'F'),
+ FUSEN_GACHI("Ippon", 'F', 'F', ' '),
- HANSOKU("Hansoku", 'H', 'H'),
+ HANSOKU("Hansoku", 'H', 'H', 'H'),
- EMPTY("ClearMenuItem", ' ', ' '),
+ EMPTY("ClearMenuItem", ' ', ' ', ' '),
- FAULT("FaultMenuItem", '^', '\u25B2'),
+ FAULT("FaultMenuItem", '^', '\u25B2', '^'),
- DRAW("Draw", 'X', 'X');
+ DRAW("Draw", 'X', 'X', 'X');
private final char abbreviation;
private final char enhancedAbbreviation;
+ private final char pdfAbbreviation;
private final String name;
- Score(String name, char abbreviation, char enhancedAbbreviation) {
+ Score(String name, char abbreviation, char enhancedAbbreviation, char pdfAbbreviation) {
this.abbreviation = abbreviation;
this.name = name;
this.enhancedAbbreviation = enhancedAbbreviation;
+ this.pdfAbbreviation = pdfAbbreviation;
}
public static Score getScore(char abbreviation) {
@@ -108,6 +110,10 @@ public char getEnhancedAbbreviation() {
return enhancedAbbreviation;
}
+ public char getPdfAbbreviation() {
+ return pdfAbbreviation;
+ }
+
public String getName() {
return name;
}