Skip to content

Commit

Permalink
feat: Replace vsu1 and vpo1 in database, dynamic bout result calculat…
Browse files Browse the repository at this point in the history
…ion, update single bout pdf (#76)

- Replace vsu1 and vpo1 in database
- dynamic bout result calculation (classification points)
- update single bout pdf
  • Loading branch information
Gustl22 authored Oct 5, 2024
1 parent b5feea8 commit 06bfb4d
Show file tree
Hide file tree
Showing 30 changed files with 1,330 additions and 327 deletions.
18 changes: 9 additions & 9 deletions wrestling_scoreboard_client/lib/l10n/app_de.arb
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
"retry": "Erneut versuchen",
"networkTimeout": "Netzwerk-Timeout",

"event": "Veranstaltung",
"place": "Ort",
"date": "Datum",
"minutes": "Minuten",
Expand All @@ -102,8 +103,10 @@
"endDate": "Ende",

"wrestlingRulesPdf": "https://www.ringen.de/wp-content/uploads/2019/01/Internationales-Regelwerk_Januar-2019_.pdf",
"transcriptTeamMatches": "Protokoll für Mannschaftskämpfe",
"scoreSheetSingleCompetitions": "Punktzettel für Einzelmeisterschaften",
"teamMatchTranscript": "Protokoll für Mannschaftskämpfe",
"teamMatchScoreSheet": "Punktzettel für Mannschaftskämpfe",
"singleCompetitionTranscript": "Protokoll für Einzelmeisterschaften",
"singleCompetitionScoreSheet": "Punktzettel für Einzelmeisterschaften",
"signature": "Unterschrift",
"pool": "Pool",
"round": "Runde",
Expand Down Expand Up @@ -147,6 +150,7 @@
"seasonPartitions": "Season-Abschnitte",
"seasonFirstHalf": "Hinrunde",
"seasonSecondHalf": "Rückrunde",
"competition": "Turnier",
"competitions": "Turniere",
"boutDay": "Kampftag",
"boutDays": "Kampftage",
Expand All @@ -161,28 +165,24 @@
"boutResultVfa": "Schultersieg",
"boutResultVin": "Aufgabesieg wegen Verletzung",
"boutResultVca": "Sieger durch 3 Verwarnungen / Regelwidrigkeit des Gegners",
"boutResultVsu": "Technische Überlegenheit - Verlierer ohne Technische Punkte",
"boutResultVsu1": "Technische Überlegenheit - Verlierer hat Technische Punkte",
"boutResultVpo": "Punktsieg - Verlierer ohne Technische Punkte",
"boutResultVpo1": "Punktsieg - Verlierer hat Technische Punkte",
"boutResultVsu": "Technische Überlegenheit",
"boutResultVpo": "Punktsieg",
"boutResultVfo": "Sieger durch Ausschluss des Gegners vom Wettkampf wegen Nichtantritt",
"boutResultDsq": "Sieger durch Ausschluss des Gegners vom Wettkampf wegen Unsportlichkeit / Tätlichkeit",
"boutResultDsq2": "Beide Ringer disqualifiziert wegen Unsportlichkeit / Regelwidrigkeit",
"boutResultVfaAbbr": "SS",
"boutResultVinAbbr": "AS",
"boutResultVcaAbbr": "DV",
"boutResultVsuAbbr": "TÜ",
"boutResultVsu1Abbr": "TÜ1",
"boutResultVpoAbbr": "PS",
"boutResultVpo1Abbr": "PS1",
"boutResultVfoAbbr": "DN",
"boutResultDsqAbbr": "DQ",
"boutResultDsq2Abbr": "DQ2",
"actions": "Aktionen",
"point": "Punkt",
"points": "Punkte",
"technicalPoints": "Technische Punkte",
"classificationPoints": "Gruppen-Punkte",
"classificationPoints": "Kampfwertungspunkte",
"participations": "Teilnahmen",
"boutConfig": "Kampf-Konfiguration",

Expand Down
16 changes: 8 additions & 8 deletions wrestling_scoreboard_client/lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
"retry": "Retry",
"networkTimeout": "Network timeout",

"event": "Event",
"place": "Place",
"date": "Date",
"minutes": "Minutes",
Expand All @@ -105,8 +106,10 @@
"endDate": "End",

"wrestlingRulesPdf": "https://uww.org/sites/default/files/2019-12/wrestling_rules.pdf",
"transcriptTeamMatches": "Transcript for Team Matches",
"scoreSheetSingleCompetitions": "Score sheet for Single Competitions",
"teamMatchTranscript": "Transcript for Team Matches",
"teamMatchScoreSheet": "Score sheet for Team Matches",
"singleCompetitionTranscript": "Transcript for Single Competitions",
"singleCompetitionScoreSheet": "Score sheet for Single Competitions",
"signature": "Signature",
"pool": "Pool",
"round": "Round",
Expand Down Expand Up @@ -150,6 +153,7 @@
"seasonPartitions": "Season Partitions",
"seasonFirstHalf": "First Half",
"seasonSecondHalf": "Second Half",
"competition": "Competition",
"competitions": "Competitions",
"boutDay": "Bout Day",
"boutDays": "Bout Days",
Expand All @@ -164,20 +168,16 @@
"boutResultVfa": "Victory by fall",
"boutResultVin": "Victory by injury",
"boutResultVca": "Victory by cautions - the opponent received 3 cautions \"O\" due to error against the rules",
"boutResultVsu": "Technical superiority - loser without technical points",
"boutResultVsu1": "Technical superiority - loser with technical points",
"boutResultVpo": "Victory by points - the loser without any technical points",
"boutResultVpo1": "Victory by points - the loser with technical points",
"boutResultVsu": "Technical superiority",
"boutResultVpo": "Victory by points",
"boutResultVfo": "Victory by forfeit - no show up on the mat",
"boutResultDsq": "Victory by disqualification of the opponent from the whole competition due to infringement of the rules",
"boutResultDsq2": "In case both wrestlers have been disqualified due to infringement of the rules",
"boutResultVfaAbbr": "VFA",
"boutResultVinAbbr": "VIN",
"boutResultVcaAbbr": "VCA",
"boutResultVsuAbbr": "VSU",
"boutResultVsu1Abbr": "VSU1",
"boutResultVpoAbbr": "VPO",
"boutResultVpo1Abbr": "VPO1",
"boutResultVfoAbbr": "VFO",
"boutResultDsqAbbr": "DSQ",
"boutResultDsq2Abbr": "DSQ2",
Expand Down
8 changes: 0 additions & 8 deletions wrestling_scoreboard_client/lib/localization/bout_result.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,8 @@ extension BoutResultLocalization on BoutResult {
return loc.boutResultVcaAbbr;
case BoutResult.vsu:
return loc.boutResultVsuAbbr;
case BoutResult.vsu1:
return loc.boutResultVsu1Abbr;
case BoutResult.vpo:
return loc.boutResultVpoAbbr;
case BoutResult.vpo1:
return loc.boutResultVpo1Abbr;
case BoutResult.vfo:
return loc.boutResultVfoAbbr;
case BoutResult.dsq:
Expand All @@ -44,12 +40,8 @@ extension BoutResultLocalization on BoutResult {
return loc.boutResultVca;
case BoutResult.vsu:
return loc.boutResultVsu;
case BoutResult.vsu1:
return loc.boutResultVsu1;
case BoutResult.vpo:
return loc.boutResultVpo;
case BoutResult.vpo1:
return loc.boutResultVpo1;
case BoutResult.vfo:
return loc.boutResultVfo;
case BoutResult.dsq:
Expand Down
5 changes: 5 additions & 0 deletions wrestling_scoreboard_client/lib/localization/bout_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ extension BoutRoleLocalization on BoutRole {
MaterialColor color() {
return this == BoutRole.red ? Colors.red : Colors.blue;
}

String localize(BuildContext context) {
final localizations = AppLocalizations.of(context)!;
return this == BoutRole.red ? localizations.red : localizations.blue;
}
}

extension BoutLocalization on Bout {
Expand Down
19 changes: 12 additions & 7 deletions wrestling_scoreboard_client/lib/services/print/pdf/components.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'package:wrestling_scoreboard_common/common.dart';

buildCheckBox({
bool isChecked = false,
PdfColor pencilColor = PdfColors.blue800,
PdfColor pencilColor = PdfSheet.pencilColor,
PdfColor? checkBoxColor,
}) =>
Container(
Expand Down Expand Up @@ -58,7 +58,8 @@ Widget buildFormCell({
double? width,
PdfColor borderColor = PdfColors.grey,
PdfColor? color,
PdfColor pencilColor = PdfColors.blue800,
PdfColor pencilColor = PdfSheet.pencilColor,
AlignmentGeometry? contentAlignment = Alignment.center,
}) {
return buildFormCellWidget(
title: title,
Expand All @@ -68,6 +69,7 @@ Widget buildFormCell({
borderColor: borderColor,
color: color,
pencilColor: pencilColor,
contentAlignment: contentAlignment,
);
}

Expand All @@ -78,7 +80,9 @@ Widget buildFormCellWidget({
double? width,
PdfColor borderColor = PdfColors.grey,
PdfColor? color,
PdfColor pencilColor = PdfColors.blue800,
PdfColor pencilColor = PdfSheet.pencilColor,
AlignmentGeometry? contentAlignment = Alignment.center,
EdgeInsets? contentPadding = const EdgeInsets.all(2),
}) {
return Container(
height: height,
Expand All @@ -96,12 +100,13 @@ Widget buildFormCellWidget({
Container(
alignment: Alignment.topLeft,
padding: const EdgeInsets.all(2),
child: Text(title.toUpperCase(), style: TextStyle(fontSize: 6, fontWeight: FontWeight.bold)),
child: Text(title.toUpperCase(), style: const TextStyle(fontSize: 6, fontWeight: FontWeight.bold)),
),
if (content != null)
Expanded(
child: Container(
alignment: Alignment.center,
padding: contentPadding,
alignment: contentAlignment,
child: content,
)),
],
Expand All @@ -110,11 +115,11 @@ Widget buildFormCellWidget({
}

extension BoutRolePdfColor on BoutRole {
PdfColor? get pdfColor {
PdfColor get pdfColor {
return this == BoutRole.red ? PdfSheet.homeColor : PdfSheet.guestColor;
}

PdfColor? get textPdfColor {
PdfColor get textPdfColor {
return PdfColors.white;
}
}
33 changes: 13 additions & 20 deletions wrestling_scoreboard_client/lib/services/print/pdf/pdf_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ abstract class PdfSheet {
static const horizontalGap = 8.0;
static const verticalGap = 8.0;

static const pencilColor = PdfColors.blue900;
static const pencilColor = PdfColors.brown600;
static const homeColor = PdfColors.red;
static const guestColor = PdfColors.blue;

Expand Down Expand Up @@ -80,28 +80,21 @@ abstract class PdfSheet {
}, children: [
TableRow(
children: [
buildFormCell(
title: 'Event-${localizations.name}',
// ?? localizations.location,
content: wrestlingEvent is TeamMatch
? ('${wrestlingEvent.home.team.name} – ${wrestlingEvent.guest.team.name}')
: (wrestlingEvent as Competition).name,
color: PdfColors.grey100,
pencilColor: PdfSheet.pencilColor,
height: 40),
if (wrestlingEvent is TeamMatch)
buildFormCell(
title: localizations.league,
// ?? localizations.location,
content: wrestlingEvent.league?.fullname,
TableCell(
columnSpan: wrestlingEvent is TeamMatch ? 1 : 2,
child: buildFormCell(
title: '${localizations.event}-${localizations.name}',
content: wrestlingEvent is TeamMatch
? ('${wrestlingEvent.home.team.name} – ${wrestlingEvent.guest.team.name}')
: (wrestlingEvent as Competition).name,
color: PdfColors.grey100,
pencilColor: PdfSheet.pencilColor,
height: 40),
if (wrestlingEvent is! TeamMatch)
),
if (wrestlingEvent is TeamMatch)
buildFormCell(
title: 'Competition',
// ?? localizations.location,
content: 'Competition',
title: localizations.league,
content: wrestlingEvent.league?.fullname,
color: PdfColors.grey100,
pencilColor: PdfSheet.pencilColor,
height: 40),
Expand All @@ -112,7 +105,7 @@ abstract class PdfSheet {
pencilColor: PdfSheet.pencilColor,
height: 40),
buildFormCell(
title: 'Ort',
title: localizations.place,
// ?? localizations.location,
content: wrestlingEvent.location,
color: PdfColors.grey100,
Expand Down
Loading

0 comments on commit 06bfb4d

Please sign in to comment.