From c0f6952607422e2a89608873b02e7bd53ec853f8 Mon Sep 17 00:00:00 2001 From: Gustl22 Date: Tue, 16 Jan 2024 13:14:27 +0100 Subject: [PATCH] feat(server): Make WeightClass nullable --- .../lib/data/bout_utils.dart | 6 +- .../lib/ui/display/bout/bout_display.dart | 25 +- .../lib/ui/display/match/match_display.dart | 29 +- .../lib/ui/edit/bout_edit.dart | 4 +- .../lib/ui/overview/bout_overview.dart | 2 +- .../lib/util/print/pdf/score_sheet.dart | 6 +- .../lib/src/data/bout.dart | 8 +- .../lib/src/data/bout.freezed.dart | 43 +- .../lib/src/data/bout.g.dart | 7 +- .../lib/src/data/bout_action.freezed.dart | 2 +- .../lib/src/data/bout_config.freezed.dart | 2 +- .../lib/src/data/club.freezed.dart | 2 +- .../data/competition/competition.freezed.dart | 2 +- .../competition/competition_bout.freezed.dart | 2 +- .../competition_person.freezed.dart | 2 +- ...ompetition_team_participation.freezed.dart | 8 +- .../lib/src/data/lineup.freezed.dart | 2 +- .../lib/src/data/membership.freezed.dart | 2 +- .../src/data/participant_state.freezed.dart | 2 +- .../lib/src/data/participation.dart | 8 +- .../lib/src/data/participation.freezed.dart | 40 +- .../lib/src/data/participation.g.dart | 7 +- .../lib/src/data/person.freezed.dart | 2 +- .../lib/src/data/team.freezed.dart | 2 +- .../src/data/team_match/league.freezed.dart | 2 +- .../league_team_participation.freezed.dart | 2 +- .../league_weight_class.freezed.dart | 2 +- .../data/team_match/team_match.freezed.dart | 2 +- .../team_match/team_match_bout.freezed.dart | 60 +- .../data/team_match/team_match_bout.g.dart | 7 +- .../PostgreSQL-wrestling_scoreboard-dump.sql | 552 +++++++++--------- .../controllers/team_match_controller.dart | 2 +- 32 files changed, 430 insertions(+), 414 deletions(-) diff --git a/wrestling_scoreboard_client/lib/data/bout_utils.dart b/wrestling_scoreboard_client/lib/data/bout_utils.dart index 831c7991..39e128fb 100644 --- a/wrestling_scoreboard_client/lib/data/bout_utils.dart +++ b/wrestling_scoreboard_client/lib/data/bout_utils.dart @@ -8,9 +8,9 @@ MaterialColor getColorFromBoutRole(BoutRole role) { } String getBoutTitle(BuildContext context, Bout bout) { - return '${bout.weightClass.name}, ${styleToAbbr(bout.weightClass.style, context)} | ' - '${getParticipationStateName(context, bout.r)} vs. ' - '${getParticipationStateName(context, bout.b)}'; + final weightClass = bout.weightClass; + return '${weightClass == null ? '' : '${weightClass.name}, ${styleToAbbr(weightClass.style, context)} | '}' + '${getParticipationStateName(context, bout.r)} vs. ${getParticipationStateName(context, bout.b)}'; } String getParticipationStateName(BuildContext context, ParticipantState? participantState) { diff --git a/wrestling_scoreboard_client/lib/ui/display/bout/bout_display.dart b/wrestling_scoreboard_client/lib/ui/display/bout/bout_display.dart index 65e0c9e9..de40ae7d 100644 --- a/wrestling_scoreboard_client/lib/ui/display/bout/bout_display.dart +++ b/wrestling_scoreboard_client/lib/ui/display/bout/bout_display.dart @@ -81,7 +81,8 @@ class TeamMatchBoutDisplay extends StatelessWidget { onPressBoutInfo: (BuildContext context) { context.push('/${TeamMatchBoutOverview.route}/${teamMatchBout.id}'); }, - navigateToBoutByIndex: (context, index) => navigateToTeamMatchBoutScreen(context, match, teamMatchBouts[index]), + navigateToBoutByIndex: (context, index) => + navigateToTeamMatchBoutScreen(context, match, teamMatchBouts[index]), home: match.home.team, guest: match.guest.team, ); @@ -451,16 +452,18 @@ class BoutState extends ConsumerState { minFontSize: 10, ))), ]), - Center( - child: ScaledText( - '${styleToString(bout.weightClass.style, context)}', - minFontSize: 10, - )), - Center( - child: ScaledText( - bout.weightClass.name, - minFontSize: 10, - )), + if (bout.weightClass != null) + Center( + child: ScaledText( + '${styleToString(bout.weightClass!.style, context)}', + minFontSize: 10, + )), + if (bout.weightClass != null) + Center( + child: ScaledText( + bout.weightClass!.name, + minFontSize: 10, + )), ])), Expanded( flex: 50, diff --git a/wrestling_scoreboard_client/lib/ui/display/match/match_display.dart b/wrestling_scoreboard_client/lib/ui/display/match/match_display.dart index 2d408724..5cbd5729 100644 --- a/wrestling_scoreboard_client/lib/ui/display/match/match_display.dart +++ b/wrestling_scoreboard_client/lib/ui/display/match/match_display.dart @@ -204,20 +204,27 @@ class BoutListItem extends StatelessWidget { flex: 2, child: Container( padding: edgeInsets, - child: Center( - child: ScaledText( - '${bout.weightClass.weight} $weightUnit', - softWrap: false, - minFontSize: 10, - )), + child: bout.weightClass == null + ? null + : Center( + child: ScaledText( + '${bout.weightClass!.weight} $weightUnit', + softWrap: false, + minFontSize: 10, + ), + ), ), ), Expanded( - child: Center( - child: ScaledText( - styleToAbbr(bout.weightClass.style, context), - minFontSize: 12, - ))), + child: Center( + child: bout.weightClass == null + ? null + : ScaledText( + styleToAbbr(bout.weightClass!.style, context), + minFontSize: 12, + ), + ), + ), ], ), displayName(pStatus: bout.r, role: BoutRole.red, context: context), diff --git a/wrestling_scoreboard_client/lib/ui/edit/bout_edit.dart b/wrestling_scoreboard_client/lib/ui/edit/bout_edit.dart index 6d495bc9..2e233e6d 100644 --- a/wrestling_scoreboard_client/lib/ui/edit/bout_edit.dart +++ b/wrestling_scoreboard_client/lib/ui/edit/bout_edit.dart @@ -24,14 +24,14 @@ abstract class BoutEdit extends StatefulWidget { abstract class BoutEditState extends State implements AbstractEditState { final _formKey = GlobalKey(); - late WeightClass _weightClass; + WeightClass? _weightClass; Participation? _redParticipation; Participation? _blueParticipation; @override void initState() { super.initState(); - _weightClass = widget.bout!.weightClass; + _weightClass = widget.bout?.weightClass; _redParticipation = widget.bout?.r?.participation; _blueParticipation = widget.bout?.b?.participation; } diff --git a/wrestling_scoreboard_client/lib/ui/overview/bout_overview.dart b/wrestling_scoreboard_client/lib/ui/overview/bout_overview.dart index d2cf96c6..5ad50f47 100644 --- a/wrestling_scoreboard_client/lib/ui/overview/bout_overview.dart +++ b/wrestling_scoreboard_client/lib/ui/overview/bout_overview.dart @@ -49,7 +49,7 @@ abstract class BoutOverview extends StatelessWidget implements AbstractOverview< icon: Icons.person, ), ContentItem( - title: data.weightClass.name, + title: data.weightClass?.name ?? '-', subtitle: localizations.weight, icon: Icons.fitness_center, ), diff --git a/wrestling_scoreboard_client/lib/util/print/pdf/score_sheet.dart b/wrestling_scoreboard_client/lib/util/print/pdf/score_sheet.dart index 11c220ad..c638de45 100644 --- a/wrestling_scoreboard_client/lib/util/print/pdf/score_sheet.dart +++ b/wrestling_scoreboard_client/lib/util/print/pdf/score_sheet.dart @@ -136,7 +136,7 @@ class ScoreSheet { ]); } - final isFreeStyle = bout.weightClass.style == WrestlingStyle.free; + final isFreeStyle = bout.weightClass?.style == WrestlingStyle.free; final wrestlingEvent = event; Person? matChairman; @@ -190,8 +190,8 @@ class ScoreSheet { color: PdfColors.grey300, pencilColor: _pencilColor), buildFormCell( - title: '${localizations.weightClass} (${bout.weightClass.unit.toAbbr()})', - content: bout.weightClass.weight.toString(), + title: '${localizations.weightClass} (${bout.weightClass?.unit.toAbbr()})', + content: bout.weightClass?.weight.toString(), color: PdfColors.grey300, pencilColor: _pencilColor), buildFormCell( diff --git a/wrestling_scoreboard_common/lib/src/data/bout.dart b/wrestling_scoreboard_common/lib/src/data/bout.dart index f178a6b1..3b6cbb5f 100644 --- a/wrestling_scoreboard_common/lib/src/data/bout.dart +++ b/wrestling_scoreboard_common/lib/src/data/bout.dart @@ -19,7 +19,7 @@ class Bout with _$Bout implements DataObject { int? id, ParticipantState? r, // red ParticipantState? b, // blue - required WeightClass weightClass, + WeightClass? weightClass, int? pool, BoutRole? winnerRole, BoutResult? result, @@ -34,7 +34,7 @@ class Bout with _$Bout implements DataObject { if (id != null) 'id': id, 'red_id': r?.id, 'blue_id': b?.id, - 'weight_class_id': weightClass.id, + 'weight_class_id': weightClass?.id, 'winner_role': winnerRole?.name, 'bout_result': result?.name, 'duration_millis': duration.inMilliseconds, @@ -46,13 +46,13 @@ class Bout with _$Bout implements DataObject { final blueId = e['blue_id'] as int?; final winner = e['winner_role'] as String?; final boutResult = e['bout_result'] as String?; - final weightClass = await getSingle(e['weight_class_id'] as int); + final weightClassId = e['weight_class_id'] as int?; final durationMillis = e['duration_millis'] as int?; return Bout( id: e['id'] as int?, r: redId == null ? null : await getSingle(redId), b: blueId == null ? null : await getSingle(blueId), - weightClass: weightClass!, + weightClass: weightClassId == null ? null : await getSingle(weightClassId), winnerRole: winner == null ? null : BoutRoleParser.valueOf(winner), result: boutResult == null ? null : BoutResultParser.valueOf(boutResult), duration: durationMillis == null ? Duration() : Duration(milliseconds: durationMillis), diff --git a/wrestling_scoreboard_common/lib/src/data/bout.freezed.dart b/wrestling_scoreboard_common/lib/src/data/bout.freezed.dart index 6ea64622..2112adbb 100644 --- a/wrestling_scoreboard_common/lib/src/data/bout.freezed.dart +++ b/wrestling_scoreboard_common/lib/src/data/bout.freezed.dart @@ -23,7 +23,7 @@ mixin _$Bout { int? get id => throw _privateConstructorUsedError; ParticipantState? get r => throw _privateConstructorUsedError; // red ParticipantState? get b => throw _privateConstructorUsedError; // blue - WeightClass get weightClass => throw _privateConstructorUsedError; + WeightClass? get weightClass => throw _privateConstructorUsedError; int? get pool => throw _privateConstructorUsedError; BoutRole? get winnerRole => throw _privateConstructorUsedError; BoutResult? get result => throw _privateConstructorUsedError; @@ -43,7 +43,7 @@ abstract class $BoutCopyWith<$Res> { {int? id, ParticipantState? r, ParticipantState? b, - WeightClass weightClass, + WeightClass? weightClass, int? pool, BoutRole? winnerRole, BoutResult? result, @@ -51,7 +51,7 @@ abstract class $BoutCopyWith<$Res> { $ParticipantStateCopyWith<$Res>? get r; $ParticipantStateCopyWith<$Res>? get b; - $WeightClassCopyWith<$Res> get weightClass; + $WeightClassCopyWith<$Res>? get weightClass; } /// @nodoc @@ -70,7 +70,7 @@ class _$BoutCopyWithImpl<$Res, $Val extends Bout> Object? id = freezed, Object? r = freezed, Object? b = freezed, - Object? weightClass = null, + Object? weightClass = freezed, Object? pool = freezed, Object? winnerRole = freezed, Object? result = freezed, @@ -89,10 +89,10 @@ class _$BoutCopyWithImpl<$Res, $Val extends Bout> ? _value.b : b // ignore: cast_nullable_to_non_nullable as ParticipantState?, - weightClass: null == weightClass + weightClass: freezed == weightClass ? _value.weightClass : weightClass // ignore: cast_nullable_to_non_nullable - as WeightClass, + as WeightClass?, pool: freezed == pool ? _value.pool : pool // ignore: cast_nullable_to_non_nullable @@ -138,8 +138,12 @@ class _$BoutCopyWithImpl<$Res, $Val extends Bout> @override @pragma('vm:prefer-inline') - $WeightClassCopyWith<$Res> get weightClass { - return $WeightClassCopyWith<$Res>(_value.weightClass, (value) { + $WeightClassCopyWith<$Res>? get weightClass { + if (_value.weightClass == null) { + return null; + } + + return $WeightClassCopyWith<$Res>(_value.weightClass!, (value) { return _then(_value.copyWith(weightClass: value) as $Val); }); } @@ -156,7 +160,7 @@ abstract class _$$BoutImplCopyWith<$Res> implements $BoutCopyWith<$Res> { {int? id, ParticipantState? r, ParticipantState? b, - WeightClass weightClass, + WeightClass? weightClass, int? pool, BoutRole? winnerRole, BoutResult? result, @@ -167,15 +171,14 @@ abstract class _$$BoutImplCopyWith<$Res> implements $BoutCopyWith<$Res> { @override $ParticipantStateCopyWith<$Res>? get b; @override - $WeightClassCopyWith<$Res> get weightClass; + $WeightClassCopyWith<$Res>? get weightClass; } /// @nodoc class __$$BoutImplCopyWithImpl<$Res> extends _$BoutCopyWithImpl<$Res, _$BoutImpl> implements _$$BoutImplCopyWith<$Res> { - __$$BoutImplCopyWithImpl( - _$BoutImpl _value, $Res Function(_$BoutImpl) _then) + __$$BoutImplCopyWithImpl(_$BoutImpl _value, $Res Function(_$BoutImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @@ -184,7 +187,7 @@ class __$$BoutImplCopyWithImpl<$Res> Object? id = freezed, Object? r = freezed, Object? b = freezed, - Object? weightClass = null, + Object? weightClass = freezed, Object? pool = freezed, Object? winnerRole = freezed, Object? result = freezed, @@ -203,10 +206,10 @@ class __$$BoutImplCopyWithImpl<$Res> ? _value.b : b // ignore: cast_nullable_to_non_nullable as ParticipantState?, - weightClass: null == weightClass + weightClass: freezed == weightClass ? _value.weightClass : weightClass // ignore: cast_nullable_to_non_nullable - as WeightClass, + as WeightClass?, pool: freezed == pool ? _value.pool : pool // ignore: cast_nullable_to_non_nullable @@ -234,7 +237,7 @@ class _$BoutImpl extends _Bout { {this.id, this.r, this.b, - required this.weightClass, + this.weightClass, this.pool, this.winnerRole, this.result, @@ -253,7 +256,7 @@ class _$BoutImpl extends _Bout { final ParticipantState? b; // blue @override - final WeightClass weightClass; + final WeightClass? weightClass; @override final int? pool; @override @@ -270,7 +273,7 @@ class _$BoutImpl extends _Bout { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$BoutImpl && @@ -311,7 +314,7 @@ abstract class _Bout extends Bout { {final int? id, final ParticipantState? r, final ParticipantState? b, - required final WeightClass weightClass, + final WeightClass? weightClass, final int? pool, final BoutRole? winnerRole, final BoutResult? result, @@ -327,7 +330,7 @@ abstract class _Bout extends Bout { @override // red ParticipantState? get b; @override // blue - WeightClass get weightClass; + WeightClass? get weightClass; @override int? get pool; @override diff --git a/wrestling_scoreboard_common/lib/src/data/bout.g.dart b/wrestling_scoreboard_common/lib/src/data/bout.g.dart index fbe43da5..79eb85f1 100644 --- a/wrestling_scoreboard_common/lib/src/data/bout.g.dart +++ b/wrestling_scoreboard_common/lib/src/data/bout.g.dart @@ -14,8 +14,9 @@ _$BoutImpl _$$BoutImplFromJson(Map json) => _$BoutImpl( b: json['b'] == null ? null : ParticipantState.fromJson(json['b'] as Map), - weightClass: - WeightClass.fromJson(json['weightClass'] as Map), + weightClass: json['weightClass'] == null + ? null + : WeightClass.fromJson(json['weightClass'] as Map), pool: json['pool'] as int?, winnerRole: $enumDecodeNullable(_$BoutRoleEnumMap, json['winnerRole']), result: $enumDecodeNullable(_$BoutResultEnumMap, json['result']), @@ -29,7 +30,7 @@ Map _$$BoutImplToJson(_$BoutImpl instance) => 'id': instance.id, 'r': instance.r?.toJson(), 'b': instance.b?.toJson(), - 'weightClass': instance.weightClass.toJson(), + 'weightClass': instance.weightClass?.toJson(), 'pool': instance.pool, 'winnerRole': _$BoutRoleEnumMap[instance.winnerRole], 'result': _$BoutResultEnumMap[instance.result], diff --git a/wrestling_scoreboard_common/lib/src/data/bout_action.freezed.dart b/wrestling_scoreboard_common/lib/src/data/bout_action.freezed.dart index 372c0dd0..44973a58 100644 --- a/wrestling_scoreboard_common/lib/src/data/bout_action.freezed.dart +++ b/wrestling_scoreboard_common/lib/src/data/bout_action.freezed.dart @@ -203,7 +203,7 @@ class _$BoutActionImpl extends _BoutAction { final int? pointCount; @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$BoutActionImpl && diff --git a/wrestling_scoreboard_common/lib/src/data/bout_config.freezed.dart b/wrestling_scoreboard_common/lib/src/data/bout_config.freezed.dart index 1094527c..5cfae1eb 100644 --- a/wrestling_scoreboard_common/lib/src/data/bout_config.freezed.dart +++ b/wrestling_scoreboard_common/lib/src/data/bout_config.freezed.dart @@ -200,7 +200,7 @@ class _$BoutConfigImpl extends _BoutConfig { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$BoutConfigImpl && diff --git a/wrestling_scoreboard_common/lib/src/data/club.freezed.dart b/wrestling_scoreboard_common/lib/src/data/club.freezed.dart index eaf041b0..590fba67 100644 --- a/wrestling_scoreboard_common/lib/src/data/club.freezed.dart +++ b/wrestling_scoreboard_common/lib/src/data/club.freezed.dart @@ -133,7 +133,7 @@ class _$ClubImpl extends _Club { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$ClubImpl && diff --git a/wrestling_scoreboard_common/lib/src/data/competition/competition.freezed.dart b/wrestling_scoreboard_common/lib/src/data/competition/competition.freezed.dart index 8929e35d..09d19815 100644 --- a/wrestling_scoreboard_common/lib/src/data/competition/competition.freezed.dart +++ b/wrestling_scoreboard_common/lib/src/data/competition/competition.freezed.dart @@ -240,7 +240,7 @@ class _$CompetitionImpl extends _Competition { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$CompetitionImpl && diff --git a/wrestling_scoreboard_common/lib/src/data/competition/competition_bout.freezed.dart b/wrestling_scoreboard_common/lib/src/data/competition/competition_bout.freezed.dart index 0b5646e7..a9563b0d 100644 --- a/wrestling_scoreboard_common/lib/src/data/competition/competition_bout.freezed.dart +++ b/wrestling_scoreboard_common/lib/src/data/competition/competition_bout.freezed.dart @@ -163,7 +163,7 @@ class _$CompetitionBoutImpl extends _CompetitionBout { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$CompetitionBoutImpl && diff --git a/wrestling_scoreboard_common/lib/src/data/competition/competition_person.freezed.dart b/wrestling_scoreboard_common/lib/src/data/competition/competition_person.freezed.dart index d1b40c4c..41decd99 100644 --- a/wrestling_scoreboard_common/lib/src/data/competition/competition_person.freezed.dart +++ b/wrestling_scoreboard_common/lib/src/data/competition/competition_person.freezed.dart @@ -179,7 +179,7 @@ class _$CompetitionPersonImpl extends _CompetitionPerson { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$CompetitionPersonImpl && diff --git a/wrestling_scoreboard_common/lib/src/data/competition/competition_team_participation.freezed.dart b/wrestling_scoreboard_common/lib/src/data/competition/competition_team_participation.freezed.dart index 1741e39f..4a222221 100644 --- a/wrestling_scoreboard_common/lib/src/data/competition/competition_team_participation.freezed.dart +++ b/wrestling_scoreboard_common/lib/src/data/competition/competition_team_participation.freezed.dart @@ -171,7 +171,7 @@ class _$CompetitionTeamParticipationImpl extends _CompetitionTeamParticipation { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$CompetitionTeamParticipationImpl && @@ -188,7 +188,8 @@ class _$CompetitionTeamParticipationImpl extends _CompetitionTeamParticipation { @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$CompetitionTeamParticipationImplCopyWith<_$CompetitionTeamParticipationImpl> + _$$CompetitionTeamParticipationImplCopyWith< + _$CompetitionTeamParticipationImpl> get copyWith => __$$CompetitionTeamParticipationImplCopyWithImpl< _$CompetitionTeamParticipationImpl>(this, _$identity); @@ -219,6 +220,7 @@ abstract class _CompetitionTeamParticipation Team get team; @override @JsonKey(ignore: true) - _$$CompetitionTeamParticipationImplCopyWith<_$CompetitionTeamParticipationImpl> + _$$CompetitionTeamParticipationImplCopyWith< + _$CompetitionTeamParticipationImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/wrestling_scoreboard_common/lib/src/data/lineup.freezed.dart b/wrestling_scoreboard_common/lib/src/data/lineup.freezed.dart index eb030fb3..01a015d1 100644 --- a/wrestling_scoreboard_common/lib/src/data/lineup.freezed.dart +++ b/wrestling_scoreboard_common/lib/src/data/lineup.freezed.dart @@ -193,7 +193,7 @@ class _$LineupImpl extends _Lineup { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$LineupImpl && diff --git a/wrestling_scoreboard_common/lib/src/data/membership.freezed.dart b/wrestling_scoreboard_common/lib/src/data/membership.freezed.dart index 70fb34d9..7838d460 100644 --- a/wrestling_scoreboard_common/lib/src/data/membership.freezed.dart +++ b/wrestling_scoreboard_common/lib/src/data/membership.freezed.dart @@ -177,7 +177,7 @@ class _$MembershipImpl extends _Membership { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$MembershipImpl && diff --git a/wrestling_scoreboard_common/lib/src/data/participant_state.freezed.dart b/wrestling_scoreboard_common/lib/src/data/participant_state.freezed.dart index 8ed80eb9..6c5c8205 100644 --- a/wrestling_scoreboard_common/lib/src/data/participant_state.freezed.dart +++ b/wrestling_scoreboard_common/lib/src/data/participant_state.freezed.dart @@ -152,7 +152,7 @@ class _$ParticipantStateImpl extends _ParticipantState { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$ParticipantStateImpl && diff --git a/wrestling_scoreboard_common/lib/src/data/participation.dart b/wrestling_scoreboard_common/lib/src/data/participation.dart index 88629087..2f0b778e 100644 --- a/wrestling_scoreboard_common/lib/src/data/participation.dart +++ b/wrestling_scoreboard_common/lib/src/data/participation.dart @@ -18,14 +18,14 @@ class Participation with _$Participation implements DataObject { int? id, required Membership membership, required Lineup lineup, - required WeightClass weightClass, + WeightClass? weightClass, double? weight, }) = _Participation; factory Participation.fromJson(Map json) => _$ParticipationFromJson(json); static Future fromRaw(Map e, GetSingleOfTypeCallback getSingle) async { - final weightClass = await getSingle(e['weight_class_id'] as int); + final weightClassId = e['weight_class_id'] as int?; final lineup = await getSingle(e['lineup_id'] as int); final membership = await getSingle(e['membership_id'] as int); final weightEncoded = e['weight']; @@ -36,7 +36,7 @@ class Participation with _$Participation implements DataObject { return Participation( id: e['id'] as int?, - weightClass: weightClass!, + weightClass: weightClassId == null ? null : await getSingle(weightClassId), lineup: lineup!, membership: membership!, weight: weight, @@ -47,7 +47,7 @@ class Participation with _$Participation implements DataObject { Map toRaw() { return { if (id != null) 'id': id, - 'weight_class_id': weightClass.id, + 'weight_class_id': weightClass?.id, 'lineup_id': lineup.id, 'membership_id': membership.id, 'weight': weight?.toString(), diff --git a/wrestling_scoreboard_common/lib/src/data/participation.freezed.dart b/wrestling_scoreboard_common/lib/src/data/participation.freezed.dart index 573e65f1..f9c22740 100644 --- a/wrestling_scoreboard_common/lib/src/data/participation.freezed.dart +++ b/wrestling_scoreboard_common/lib/src/data/participation.freezed.dart @@ -23,7 +23,7 @@ mixin _$Participation { int? get id => throw _privateConstructorUsedError; Membership get membership => throw _privateConstructorUsedError; Lineup get lineup => throw _privateConstructorUsedError; - WeightClass get weightClass => throw _privateConstructorUsedError; + WeightClass? get weightClass => throw _privateConstructorUsedError; double? get weight => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @@ -42,12 +42,12 @@ abstract class $ParticipationCopyWith<$Res> { {int? id, Membership membership, Lineup lineup, - WeightClass weightClass, + WeightClass? weightClass, double? weight}); $MembershipCopyWith<$Res> get membership; $LineupCopyWith<$Res> get lineup; - $WeightClassCopyWith<$Res> get weightClass; + $WeightClassCopyWith<$Res>? get weightClass; } /// @nodoc @@ -66,7 +66,7 @@ class _$ParticipationCopyWithImpl<$Res, $Val extends Participation> Object? id = freezed, Object? membership = null, Object? lineup = null, - Object? weightClass = null, + Object? weightClass = freezed, Object? weight = freezed, }) { return _then(_value.copyWith( @@ -82,10 +82,10 @@ class _$ParticipationCopyWithImpl<$Res, $Val extends Participation> ? _value.lineup : lineup // ignore: cast_nullable_to_non_nullable as Lineup, - weightClass: null == weightClass + weightClass: freezed == weightClass ? _value.weightClass : weightClass // ignore: cast_nullable_to_non_nullable - as WeightClass, + as WeightClass?, weight: freezed == weight ? _value.weight : weight // ignore: cast_nullable_to_non_nullable @@ -111,8 +111,12 @@ class _$ParticipationCopyWithImpl<$Res, $Val extends Participation> @override @pragma('vm:prefer-inline') - $WeightClassCopyWith<$Res> get weightClass { - return $WeightClassCopyWith<$Res>(_value.weightClass, (value) { + $WeightClassCopyWith<$Res>? get weightClass { + if (_value.weightClass == null) { + return null; + } + + return $WeightClassCopyWith<$Res>(_value.weightClass!, (value) { return _then(_value.copyWith(weightClass: value) as $Val); }); } @@ -130,7 +134,7 @@ abstract class _$$ParticipationImplCopyWith<$Res> {int? id, Membership membership, Lineup lineup, - WeightClass weightClass, + WeightClass? weightClass, double? weight}); @override @@ -138,7 +142,7 @@ abstract class _$$ParticipationImplCopyWith<$Res> @override $LineupCopyWith<$Res> get lineup; @override - $WeightClassCopyWith<$Res> get weightClass; + $WeightClassCopyWith<$Res>? get weightClass; } /// @nodoc @@ -155,7 +159,7 @@ class __$$ParticipationImplCopyWithImpl<$Res> Object? id = freezed, Object? membership = null, Object? lineup = null, - Object? weightClass = null, + Object? weightClass = freezed, Object? weight = freezed, }) { return _then(_$ParticipationImpl( @@ -171,10 +175,10 @@ class __$$ParticipationImplCopyWithImpl<$Res> ? _value.lineup : lineup // ignore: cast_nullable_to_non_nullable as Lineup, - weightClass: null == weightClass + weightClass: freezed == weightClass ? _value.weightClass : weightClass // ignore: cast_nullable_to_non_nullable - as WeightClass, + as WeightClass?, weight: freezed == weight ? _value.weight : weight // ignore: cast_nullable_to_non_nullable @@ -190,7 +194,7 @@ class _$ParticipationImpl extends _Participation { {this.id, required this.membership, required this.lineup, - required this.weightClass, + this.weightClass, this.weight}) : super._(); @@ -204,7 +208,7 @@ class _$ParticipationImpl extends _Participation { @override final Lineup lineup; @override - final WeightClass weightClass; + final WeightClass? weightClass; @override final double? weight; @@ -214,7 +218,7 @@ class _$ParticipationImpl extends _Participation { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$ParticipationImpl && @@ -251,7 +255,7 @@ abstract class _Participation extends Participation { {final int? id, required final Membership membership, required final Lineup lineup, - required final WeightClass weightClass, + final WeightClass? weightClass, final double? weight}) = _$ParticipationImpl; const _Participation._() : super._(); @@ -265,7 +269,7 @@ abstract class _Participation extends Participation { @override Lineup get lineup; @override - WeightClass get weightClass; + WeightClass? get weightClass; @override double? get weight; @override diff --git a/wrestling_scoreboard_common/lib/src/data/participation.g.dart b/wrestling_scoreboard_common/lib/src/data/participation.g.dart index 16edb5d0..e3a5ad65 100644 --- a/wrestling_scoreboard_common/lib/src/data/participation.g.dart +++ b/wrestling_scoreboard_common/lib/src/data/participation.g.dart @@ -12,8 +12,9 @@ _$ParticipationImpl _$$ParticipationImplFromJson(Map json) => membership: Membership.fromJson(json['membership'] as Map), lineup: Lineup.fromJson(json['lineup'] as Map), - weightClass: - WeightClass.fromJson(json['weightClass'] as Map), + weightClass: json['weightClass'] == null + ? null + : WeightClass.fromJson(json['weightClass'] as Map), weight: (json['weight'] as num?)?.toDouble(), ); @@ -22,6 +23,6 @@ Map _$$ParticipationImplToJson(_$ParticipationImpl instance) => 'id': instance.id, 'membership': instance.membership.toJson(), 'lineup': instance.lineup.toJson(), - 'weightClass': instance.weightClass.toJson(), + 'weightClass': instance.weightClass?.toJson(), 'weight': instance.weight, }; diff --git a/wrestling_scoreboard_common/lib/src/data/person.freezed.dart b/wrestling_scoreboard_common/lib/src/data/person.freezed.dart index 9066d66e..d734cf0b 100644 --- a/wrestling_scoreboard_common/lib/src/data/person.freezed.dart +++ b/wrestling_scoreboard_common/lib/src/data/person.freezed.dart @@ -176,7 +176,7 @@ class _$PersonImpl extends _Person { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PersonImpl && diff --git a/wrestling_scoreboard_common/lib/src/data/team.freezed.dart b/wrestling_scoreboard_common/lib/src/data/team.freezed.dart index 7bf182d7..e046732d 100644 --- a/wrestling_scoreboard_common/lib/src/data/team.freezed.dart +++ b/wrestling_scoreboard_common/lib/src/data/team.freezed.dart @@ -161,7 +161,7 @@ class _$TeamImpl extends _Team { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$TeamImpl && diff --git a/wrestling_scoreboard_common/lib/src/data/team_match/league.freezed.dart b/wrestling_scoreboard_common/lib/src/data/team_match/league.freezed.dart index 952b0102..8c0e9c85 100644 --- a/wrestling_scoreboard_common/lib/src/data/team_match/league.freezed.dart +++ b/wrestling_scoreboard_common/lib/src/data/team_match/league.freezed.dart @@ -165,7 +165,7 @@ class _$LeagueImpl extends _League { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$LeagueImpl && diff --git a/wrestling_scoreboard_common/lib/src/data/team_match/league_team_participation.freezed.dart b/wrestling_scoreboard_common/lib/src/data/team_match/league_team_participation.freezed.dart index 44001c0f..e7463540 100644 --- a/wrestling_scoreboard_common/lib/src/data/team_match/league_team_participation.freezed.dart +++ b/wrestling_scoreboard_common/lib/src/data/team_match/league_team_participation.freezed.dart @@ -168,7 +168,7 @@ class _$LeagueTeamParticipationImpl extends _LeagueTeamParticipation { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$LeagueTeamParticipationImpl && diff --git a/wrestling_scoreboard_common/lib/src/data/team_match/league_weight_class.freezed.dart b/wrestling_scoreboard_common/lib/src/data/team_match/league_weight_class.freezed.dart index a15c2ba6..47152af2 100644 --- a/wrestling_scoreboard_common/lib/src/data/team_match/league_weight_class.freezed.dart +++ b/wrestling_scoreboard_common/lib/src/data/team_match/league_weight_class.freezed.dart @@ -179,7 +179,7 @@ class _$LeagueWeightClassImpl extends _LeagueWeightClass { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$LeagueWeightClassImpl && diff --git a/wrestling_scoreboard_common/lib/src/data/team_match/team_match.freezed.dart b/wrestling_scoreboard_common/lib/src/data/team_match/team_match.freezed.dart index 6816337c..f306093b 100644 --- a/wrestling_scoreboard_common/lib/src/data/team_match/team_match.freezed.dart +++ b/wrestling_scoreboard_common/lib/src/data/team_match/team_match.freezed.dart @@ -436,7 +436,7 @@ class _$TeamMatchImpl extends _TeamMatch { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$TeamMatchImpl && diff --git a/wrestling_scoreboard_common/lib/src/data/team_match/team_match_bout.freezed.dart b/wrestling_scoreboard_common/lib/src/data/team_match/team_match_bout.freezed.dart index 03285e73..93bee361 100644 --- a/wrestling_scoreboard_common/lib/src/data/team_match/team_match_bout.freezed.dart +++ b/wrestling_scoreboard_common/lib/src/data/team_match/team_match_bout.freezed.dart @@ -21,9 +21,9 @@ TeamMatchBout _$TeamMatchBoutFromJson(Map json) { /// @nodoc mixin _$TeamMatchBout { int? get id => throw _privateConstructorUsedError; + int get pos => throw _privateConstructorUsedError; TeamMatch get teamMatch => throw _privateConstructorUsedError; Bout get bout => throw _privateConstructorUsedError; - int get pos => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) @@ -37,7 +37,7 @@ abstract class $TeamMatchBoutCopyWith<$Res> { TeamMatchBout value, $Res Function(TeamMatchBout) then) = _$TeamMatchBoutCopyWithImpl<$Res, TeamMatchBout>; @useResult - $Res call({int? id, TeamMatch teamMatch, Bout bout, int pos}); + $Res call({int? id, int pos, TeamMatch teamMatch, Bout bout}); $TeamMatchCopyWith<$Res> get teamMatch; $BoutCopyWith<$Res> get bout; @@ -57,15 +57,19 @@ class _$TeamMatchBoutCopyWithImpl<$Res, $Val extends TeamMatchBout> @override $Res call({ Object? id = freezed, + Object? pos = null, Object? teamMatch = null, Object? bout = null, - Object? pos = null, }) { return _then(_value.copyWith( id: freezed == id ? _value.id : id // ignore: cast_nullable_to_non_nullable as int?, + pos: null == pos + ? _value.pos + : pos // ignore: cast_nullable_to_non_nullable + as int, teamMatch: null == teamMatch ? _value.teamMatch : teamMatch // ignore: cast_nullable_to_non_nullable @@ -74,10 +78,6 @@ class _$TeamMatchBoutCopyWithImpl<$Res, $Val extends TeamMatchBout> ? _value.bout : bout // ignore: cast_nullable_to_non_nullable as Bout, - pos: null == pos - ? _value.pos - : pos // ignore: cast_nullable_to_non_nullable - as int, ) as $Val); } @@ -101,12 +101,12 @@ class _$TeamMatchBoutCopyWithImpl<$Res, $Val extends TeamMatchBout> /// @nodoc abstract class _$$TeamMatchBoutImplCopyWith<$Res> implements $TeamMatchBoutCopyWith<$Res> { - factory _$$TeamMatchBoutImplCopyWith(_$TeamMatchBoutImpl value, - $Res Function(_$TeamMatchBoutImpl) then) = + factory _$$TeamMatchBoutImplCopyWith( + _$TeamMatchBoutImpl value, $Res Function(_$TeamMatchBoutImpl) then) = __$$TeamMatchBoutImplCopyWithImpl<$Res>; @override @useResult - $Res call({int? id, TeamMatch teamMatch, Bout bout, int pos}); + $Res call({int? id, int pos, TeamMatch teamMatch, Bout bout}); @override $TeamMatchCopyWith<$Res> get teamMatch; @@ -126,15 +126,19 @@ class __$$TeamMatchBoutImplCopyWithImpl<$Res> @override $Res call({ Object? id = freezed, + Object? pos = null, Object? teamMatch = null, Object? bout = null, - Object? pos = null, }) { return _then(_$TeamMatchBoutImpl( id: freezed == id ? _value.id : id // ignore: cast_nullable_to_non_nullable as int?, + pos: null == pos + ? _value.pos + : pos // ignore: cast_nullable_to_non_nullable + as int, teamMatch: null == teamMatch ? _value.teamMatch : teamMatch // ignore: cast_nullable_to_non_nullable @@ -143,10 +147,6 @@ class __$$TeamMatchBoutImplCopyWithImpl<$Res> ? _value.bout : bout // ignore: cast_nullable_to_non_nullable as Bout, - pos: null == pos - ? _value.pos - : pos // ignore: cast_nullable_to_non_nullable - as int, )); } } @@ -155,10 +155,7 @@ class __$$TeamMatchBoutImplCopyWithImpl<$Res> @JsonSerializable() class _$TeamMatchBoutImpl extends _TeamMatchBout { const _$TeamMatchBoutImpl( - {this.id, - required this.teamMatch, - required this.bout, - required this.pos}) + {this.id, required this.pos, required this.teamMatch, required this.bout}) : super._(); factory _$TeamMatchBoutImpl.fromJson(Map json) => @@ -167,39 +164,38 @@ class _$TeamMatchBoutImpl extends _TeamMatchBout { @override final int? id; @override + final int pos; + @override final TeamMatch teamMatch; @override final Bout bout; - @override - final int pos; @override String toString() { - return 'TeamMatchBout(id: $id, teamMatch: $teamMatch, bout: $bout, pos: $pos)'; + return 'TeamMatchBout(id: $id, pos: $pos, teamMatch: $teamMatch, bout: $bout)'; } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$TeamMatchBoutImpl && (identical(other.id, id) || other.id == id) && + (identical(other.pos, pos) || other.pos == pos) && (identical(other.teamMatch, teamMatch) || other.teamMatch == teamMatch) && - (identical(other.bout, bout) || other.bout == bout) && - (identical(other.pos, pos) || other.pos == pos)); + (identical(other.bout, bout) || other.bout == bout)); } @JsonKey(ignore: true) @override - int get hashCode => Object.hash(runtimeType, id, teamMatch, bout, pos); + int get hashCode => Object.hash(runtimeType, id, pos, teamMatch, bout); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') _$$TeamMatchBoutImplCopyWith<_$TeamMatchBoutImpl> get copyWith => - __$$TeamMatchBoutImplCopyWithImpl<_$TeamMatchBoutImpl>( - this, _$identity); + __$$TeamMatchBoutImplCopyWithImpl<_$TeamMatchBoutImpl>(this, _$identity); @override Map toJson() { @@ -212,9 +208,9 @@ class _$TeamMatchBoutImpl extends _TeamMatchBout { abstract class _TeamMatchBout extends TeamMatchBout { const factory _TeamMatchBout( {final int? id, + required final int pos, required final TeamMatch teamMatch, - required final Bout bout, - required final int pos}) = _$TeamMatchBoutImpl; + required final Bout bout}) = _$TeamMatchBoutImpl; const _TeamMatchBout._() : super._(); factory _TeamMatchBout.fromJson(Map json) = @@ -223,12 +219,12 @@ abstract class _TeamMatchBout extends TeamMatchBout { @override int? get id; @override + int get pos; + @override TeamMatch get teamMatch; @override Bout get bout; @override - int get pos; - @override @JsonKey(ignore: true) _$$TeamMatchBoutImplCopyWith<_$TeamMatchBoutImpl> get copyWith => throw _privateConstructorUsedError; diff --git a/wrestling_scoreboard_common/lib/src/data/team_match/team_match_bout.g.dart b/wrestling_scoreboard_common/lib/src/data/team_match/team_match_bout.g.dart index 64bff9a2..3af8a147 100644 --- a/wrestling_scoreboard_common/lib/src/data/team_match/team_match_bout.g.dart +++ b/wrestling_scoreboard_common/lib/src/data/team_match/team_match_bout.g.dart @@ -9,16 +9,15 @@ part of 'team_match_bout.dart'; _$TeamMatchBoutImpl _$$TeamMatchBoutImplFromJson(Map json) => _$TeamMatchBoutImpl( id: json['id'] as int?, + pos: json['pos'] as int, teamMatch: TeamMatch.fromJson(json['teamMatch'] as Map), bout: Bout.fromJson(json['bout'] as Map), - pos: json['pos'] as int, ); -Map _$$TeamMatchBoutImplToJson( - _$TeamMatchBoutImpl instance) => +Map _$$TeamMatchBoutImplToJson(_$TeamMatchBoutImpl instance) => { 'id': instance.id, + 'pos': instance.pos, 'teamMatch': instance.teamMatch.toJson(), 'bout': instance.bout.toJson(), - 'pos': instance.pos, }; diff --git a/wrestling_scoreboard_server/database/dump/PostgreSQL-wrestling_scoreboard-dump.sql b/wrestling_scoreboard_server/database/dump/PostgreSQL-wrestling_scoreboard-dump.sql index c2ad2a6a..53aa0754 100644 --- a/wrestling_scoreboard_server/database/dump/PostgreSQL-wrestling_scoreboard-dump.sql +++ b/wrestling_scoreboard_server/database/dump/PostgreSQL-wrestling_scoreboard-dump.sql @@ -135,6 +135,61 @@ SET default_tablespace = ''; SET default_table_access_method = heap; +-- +-- Name: bout; Type: TABLE; Schema: public; Owner: wrestling +-- + +CREATE TABLE public.bout ( + id integer NOT NULL, + red_id integer, + blue_id integer, + weight_class_id integer, + winner_role public.bout_role, + bout_result public.bout_result, + duration_millis integer +); + + +ALTER TABLE public.bout OWNER TO wrestling; + +-- +-- Name: bout_action; Type: TABLE; Schema: public; Owner: wrestling +-- + +CREATE TABLE public.bout_action ( + id integer NOT NULL, + duration_millis integer NOT NULL, + point_count smallint, + action_type public.bout_action_type NOT NULL, + bout_role public.bout_role NOT NULL, + bout_id integer NOT NULL +); + + +ALTER TABLE public.bout_action OWNER TO wrestling; + +-- +-- Name: bout_action_id_seq; Type: SEQUENCE; Schema: public; Owner: wrestling +-- + +CREATE SEQUENCE public.bout_action_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER SEQUENCE public.bout_action_id_seq OWNER TO wrestling; + +-- +-- Name: bout_action_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: wrestling +-- + +ALTER SEQUENCE public.bout_action_id_seq OWNED BY public.bout_action.id; + + -- -- Name: bout_config; Type: TABLE; Schema: public; Owner: wrestling -- @@ -173,6 +228,28 @@ ALTER SEQUENCE public.bout_config_id_seq OWNER TO wrestling; ALTER SEQUENCE public.bout_config_id_seq OWNED BY public.bout_config.id; +-- +-- Name: bout_id_seq; Type: SEQUENCE; Schema: public; Owner: wrestling +-- + +CREATE SEQUENCE public.bout_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER SEQUENCE public.bout_id_seq OWNER TO wrestling; + +-- +-- Name: bout_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: wrestling +-- + +ALTER SEQUENCE public.bout_id_seq OWNED BY public.bout.id; + + -- -- Name: club; Type: TABLE; Schema: public; Owner: wrestling -- @@ -209,79 +286,74 @@ ALTER SEQUENCE public.club_id_seq OWNED BY public.club.id; -- --- Name: competition_person; Type: TABLE; Schema: public; Owner: wrestling +-- Name: wrestling_event; Type: TABLE; Schema: public; Owner: wrestling -- -CREATE TABLE public.competition_person ( +CREATE TABLE public.wrestling_event ( id integer NOT NULL, - competition_id integer NOT NULL, - person_id integer NOT NULL, - person_role public.person_role + date date, + location character varying(100), + visitors_count integer, + comment text, + no character varying(16) ); -ALTER TABLE public.competition_person OWNER TO wrestling; +ALTER TABLE public.wrestling_event OWNER TO wrestling; -- --- Name: event_person_id_seq; Type: SEQUENCE; Schema: public; Owner: wrestling +-- Name: competition; Type: TABLE; Schema: public; Owner: wrestling -- -CREATE SEQUENCE public.event_person_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; +CREATE TABLE public.competition ( + name character varying(127), + bout_config_id integer NOT NULL +) +INHERITS (public.wrestling_event); -ALTER SEQUENCE public.event_person_id_seq OWNER TO wrestling; +ALTER TABLE public.competition OWNER TO wrestling; -- --- Name: event_person_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: wrestling +-- Name: competition_bout; Type: TABLE; Schema: public; Owner: wrestling -- -ALTER SEQUENCE public.event_person_id_seq OWNED BY public.competition_person.id; +CREATE TABLE public.competition_bout ( + id integer NOT NULL, + competition_id integer NOT NULL, + bout_id integer +); +ALTER TABLE public.competition_bout OWNER TO wrestling; + -- --- Name: bout; Type: TABLE; Schema: public; Owner: wrestling +-- Name: competition_bout_id_seq; Type: SEQUENCE; Schema: public; Owner: wrestling -- -CREATE TABLE public.bout ( - id integer NOT NULL, - red_id integer, - blue_id integer, - weight_class_id integer NOT NULL, - winner_role public.bout_role, - bout_result public.bout_result, - duration_millis integer -); +CREATE SEQUENCE public.competition_bout_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; -ALTER TABLE public.bout OWNER TO wrestling; +ALTER SEQUENCE public.competition_bout_id_seq OWNER TO wrestling; -- --- Name: bout_action; Type: TABLE; Schema: public; Owner: wrestling +-- Name: competition_bout_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: wrestling -- -CREATE TABLE public.bout_action ( - id integer NOT NULL, - duration_millis integer NOT NULL, - point_count smallint, - action_type public.bout_action_type NOT NULL, - bout_role public.bout_role NOT NULL, - bout_id integer NOT NULL -); - +ALTER SEQUENCE public.competition_bout_id_seq OWNED BY public.competition_bout.id; -ALTER TABLE public.bout_action OWNER TO wrestling; -- --- Name: bout_action_id_seq; Type: SEQUENCE; Schema: public; Owner: wrestling +-- Name: competition_id_seq; Type: SEQUENCE; Schema: public; Owner: wrestling -- -CREATE SEQUENCE public.bout_action_id_seq +CREATE SEQUENCE public.competition_id_seq AS integer START WITH 1 INCREMENT BY 1 @@ -290,20 +362,34 @@ CREATE SEQUENCE public.bout_action_id_seq CACHE 1; -ALTER SEQUENCE public.bout_action_id_seq OWNER TO wrestling; +ALTER SEQUENCE public.competition_id_seq OWNER TO wrestling; -- --- Name: bout_action_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: wrestling +-- Name: competition_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: wrestling -- -ALTER SEQUENCE public.bout_action_id_seq OWNED BY public.bout_action.id; +ALTER SEQUENCE public.competition_id_seq OWNED BY public.competition.id; -- --- Name: bout_id_seq; Type: SEQUENCE; Schema: public; Owner: wrestling +-- Name: competition_person; Type: TABLE; Schema: public; Owner: wrestling -- -CREATE SEQUENCE public.bout_id_seq +CREATE TABLE public.competition_person ( + id integer NOT NULL, + competition_id integer NOT NULL, + person_id integer NOT NULL, + person_role public.person_role +); + + +ALTER TABLE public.competition_person OWNER TO wrestling; + +-- +-- Name: event_person_id_seq; Type: SEQUENCE; Schema: public; Owner: wrestling +-- + +CREATE SEQUENCE public.event_person_id_seq AS integer START WITH 1 INCREMENT BY 1 @@ -312,13 +398,13 @@ CREATE SEQUENCE public.bout_id_seq CACHE 1; -ALTER SEQUENCE public.bout_id_seq OWNER TO wrestling; +ALTER SEQUENCE public.event_person_id_seq OWNER TO wrestling; -- --- Name: bout_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: wrestling +-- Name: event_person_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: wrestling -- -ALTER SEQUENCE public.bout_id_seq OWNED BY public.bout.id; +ALTER SEQUENCE public.event_person_id_seq OWNED BY public.competition_person.id; -- @@ -543,7 +629,7 @@ CREATE TABLE public.participation ( id integer NOT NULL, membership_id integer NOT NULL, lineup_id integer NOT NULL, - weight_class_id integer NOT NULL, + weight_class_id integer, weight numeric(5,2) ); @@ -645,22 +731,6 @@ ALTER SEQUENCE public.team_id_seq OWNER TO wrestling; ALTER SEQUENCE public.team_id_seq OWNED BY public.team.id; --- --- Name: wrestling_event; Type: TABLE; Schema: public; Owner: wrestling --- - -CREATE TABLE public.wrestling_event ( - id integer NOT NULL, - date date, - location character varying(100), - visitors_count integer, - comment text, - no character varying(16) -); - - -ALTER TABLE public.wrestling_event OWNER TO wrestling; - -- -- Name: team_match; Type: TABLE; Schema: public; Owner: wrestling -- @@ -743,76 +813,6 @@ ALTER SEQUENCE public.team_match_id_seq OWNER TO wrestling; ALTER SEQUENCE public.team_match_id_seq OWNED BY public.team_match.id; --- --- Name: competition; Type: TABLE; Schema: public; Owner: wrestling --- - -CREATE TABLE public.competition ( - name character varying(127), - bout_config_id integer NOT NULL -) -INHERITS (public.wrestling_event); - - -ALTER TABLE public.competition OWNER TO wrestling; - --- --- Name: competition_bout; Type: TABLE; Schema: public; Owner: wrestling --- - -CREATE TABLE public.competition_bout ( - id integer NOT NULL, - competition_id integer NOT NULL, - bout_id integer -); - - -ALTER TABLE public.competition_bout OWNER TO wrestling; - --- --- Name: competition_bout_id_seq; Type: SEQUENCE; Schema: public; Owner: wrestling --- - -CREATE SEQUENCE public.competition_bout_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - -ALTER SEQUENCE public.competition_bout_id_seq OWNER TO wrestling; - --- --- Name: competition_bout_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: wrestling --- - -ALTER SEQUENCE public.competition_bout_id_seq OWNED BY public.competition_bout.id; - - --- --- Name: competition_id_seq; Type: SEQUENCE; Schema: public; Owner: wrestling --- - -CREATE SEQUENCE public.competition_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - -ALTER SEQUENCE public.competition_id_seq OWNER TO wrestling; - --- --- Name: competition_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: wrestling --- - -ALTER SEQUENCE public.competition_id_seq OWNED BY public.competition.id; - - -- -- Name: weight_class; Type: TABLE; Schema: public; Owner: wrestling -- @@ -872,6 +872,20 @@ ALTER SEQUENCE public.wrestling_event_id_seq OWNER TO wrestling; ALTER SEQUENCE public.wrestling_event_id_seq OWNED BY public.wrestling_event.id; +-- +-- Name: bout id; Type: DEFAULT; Schema: public; Owner: wrestling +-- + +ALTER TABLE ONLY public.bout ALTER COLUMN id SET DEFAULT nextval('public.bout_id_seq'::regclass); + + +-- +-- Name: bout_action id; Type: DEFAULT; Schema: public; Owner: wrestling +-- + +ALTER TABLE ONLY public.bout_action ALTER COLUMN id SET DEFAULT nextval('public.bout_action_id_seq'::regclass); + + -- -- Name: bout_config id; Type: DEFAULT; Schema: public; Owner: wrestling -- @@ -887,17 +901,24 @@ ALTER TABLE ONLY public.club ALTER COLUMN id SET DEFAULT nextval('public.club_id -- --- Name: bout id; Type: DEFAULT; Schema: public; Owner: wrestling +-- Name: competition id; Type: DEFAULT; Schema: public; Owner: wrestling -- -ALTER TABLE ONLY public.bout ALTER COLUMN id SET DEFAULT nextval('public.bout_id_seq'::regclass); +ALTER TABLE ONLY public.competition ALTER COLUMN id SET DEFAULT nextval('public.competition_id_seq'::regclass); + + +-- +-- Name: competition_bout id; Type: DEFAULT; Schema: public; Owner: wrestling +-- + +ALTER TABLE ONLY public.competition_bout ALTER COLUMN id SET DEFAULT nextval('public.competition_bout_id_seq'::regclass); -- --- Name: bout_action id; Type: DEFAULT; Schema: public; Owner: wrestling +-- Name: competition_person id; Type: DEFAULT; Schema: public; Owner: wrestling -- -ALTER TABLE ONLY public.bout_action ALTER COLUMN id SET DEFAULT nextval('public.bout_action_id_seq'::regclass); +ALTER TABLE ONLY public.competition_person ALTER COLUMN id SET DEFAULT nextval('public.event_person_id_seq'::regclass); -- @@ -978,38 +999,43 @@ ALTER TABLE ONLY public.team_match_bout ALTER COLUMN id SET DEFAULT nextval('pub -- --- Name: competition id; Type: DEFAULT; Schema: public; Owner: wrestling --- - -ALTER TABLE ONLY public.competition ALTER COLUMN id SET DEFAULT nextval('public.competition_id_seq'::regclass); - - --- --- Name: competition_bout id; Type: DEFAULT; Schema: public; Owner: wrestling +-- Name: weight_class id; Type: DEFAULT; Schema: public; Owner: wrestling -- -ALTER TABLE ONLY public.competition_bout ALTER COLUMN id SET DEFAULT nextval('public.competition_bout_id_seq'::regclass); +ALTER TABLE ONLY public.weight_class ALTER COLUMN id SET DEFAULT nextval('public.weight_class_id_seq'::regclass); -- --- Name: competition_person id; Type: DEFAULT; Schema: public; Owner: wrestling +-- Name: wrestling_event id; Type: DEFAULT; Schema: public; Owner: wrestling -- -ALTER TABLE ONLY public.competition_person ALTER COLUMN id SET DEFAULT nextval('public.event_person_id_seq'::regclass); +ALTER TABLE ONLY public.wrestling_event ALTER COLUMN id SET DEFAULT nextval('public.wrestling_event_id_seq'::regclass); -- --- Name: weight_class id; Type: DEFAULT; Schema: public; Owner: wrestling +-- Data for Name: bout; Type: TABLE DATA; Schema: public; Owner: wrestling -- -ALTER TABLE ONLY public.weight_class ALTER COLUMN id SET DEFAULT nextval('public.weight_class_id_seq'::regclass); +COPY public.bout (id, red_id, blue_id, weight_class_id, winner_role, bout_result, duration_millis) FROM stdin; +22 \N \N 2 \N \N \N +23 25 \N 3 \N \N \N +24 \N 26 4 \N \N \N +25 27 28 7 \N \N \N +26 29 30 10 \N \N \N +21 23 24 1 red vfa 45000 +\. -- --- Name: wrestling_event id; Type: DEFAULT; Schema: public; Owner: wrestling +-- Data for Name: bout_action; Type: TABLE DATA; Schema: public; Owner: wrestling -- -ALTER TABLE ONLY public.wrestling_event ALTER COLUMN id SET DEFAULT nextval('public.wrestling_event_id_seq'::regclass); +COPY public.bout_action (id, duration_millis, point_count, action_type, bout_role, bout_id) FROM stdin; +1 20000 2 points red 21 +2 25000 1 points red 21 +3 30000 1 points blue 21 +4 36000 \N passivity blue 21 +\. -- @@ -1032,28 +1058,27 @@ COPY public.club (id, no, name) FROM stdin; -- --- Data for Name: bout; Type: TABLE DATA; Schema: public; Owner: wrestling +-- Data for Name: competition; Type: TABLE DATA; Schema: public; Owner: wrestling -- -COPY public.bout (id, red_id, blue_id, weight_class_id, winner_role, bout_result, duration_millis) FROM stdin; -22 \N \N 2 \N \N \N -23 25 \N 3 \N \N \N -24 \N 26 4 \N \N \N -25 27 28 7 \N \N \N -26 29 30 10 \N \N \N -21 23 24 1 red vfa 45000 +COPY public.competition (id, date, location, visitors_count, comment, no, name, bout_config_id) FROM stdin; +1 2021-07-17 Quahog 15 \N \N The Griffin-Simpson Competition 1 \. -- --- Data for Name: bout_action; Type: TABLE DATA; Schema: public; Owner: wrestling +-- Data for Name: competition_bout; Type: TABLE DATA; Schema: public; Owner: wrestling -- -COPY public.bout_action (id, duration_millis, point_count, action_type, bout_role, bout_id) FROM stdin; -1 20000 2 points red 21 -2 25000 1 points red 21 -3 30000 1 points blue 21 -4 36000 \N passivity blue 21 +COPY public.competition_bout (id, competition_id, bout_id) FROM stdin; +\. + + +-- +-- Data for Name: competition_person; Type: TABLE DATA; Schema: public; Owner: wrestling +-- + +COPY public.competition_person (id, competition_id, person_id, person_role) FROM stdin; \. @@ -1207,31 +1232,6 @@ COPY public.team_match_bout (id, team_match_id, bout_id, pos) FROM stdin; \. --- --- Data for Name: competition; Type: TABLE DATA; Schema: public; Owner: wrestling --- - -COPY public.competition (id, date, location, visitors_count, comment, no, name, bout_config_id) FROM stdin; -1 2021-07-17 Quahog 15 \N \N The Griffin-Simpson Competition 1 -\. - - --- --- Data for Name: competition_bout; Type: TABLE DATA; Schema: public; Owner: wrestling --- - -COPY public.competition_bout (id, competition_id, bout_id) FROM stdin; -\. - - --- --- Data for Name: competition_person; Type: TABLE DATA; Schema: public; Owner: wrestling --- - -COPY public.competition_person (id, competition_id, person_id, person_role) FROM stdin; -\. - - -- -- Data for Name: weight_class; Type: TABLE DATA; Schema: public; Owner: wrestling -- @@ -1258,6 +1258,13 @@ COPY public.wrestling_event (id, date, location, visitors_count, comment, no) FR \. +-- +-- Name: bout_action_id_seq; Type: SEQUENCE SET; Schema: public; Owner: wrestling +-- + +SELECT pg_catalog.setval('public.bout_action_id_seq', 4, true); + + -- -- Name: bout_config_id_seq; Type: SEQUENCE SET; Schema: public; Owner: wrestling -- @@ -1265,6 +1272,13 @@ COPY public.wrestling_event (id, date, location, visitors_count, comment, no) FR SELECT pg_catalog.setval('public.bout_config_id_seq', 1, true); +-- +-- Name: bout_id_seq; Type: SEQUENCE SET; Schema: public; Owner: wrestling +-- + +SELECT pg_catalog.setval('public.bout_id_seq', 26, true); + + -- -- Name: club_id_seq; Type: SEQUENCE SET; Schema: public; Owner: wrestling -- @@ -1273,24 +1287,24 @@ SELECT pg_catalog.setval('public.club_id_seq', 2, true); -- --- Name: event_person_id_seq; Type: SEQUENCE SET; Schema: public; Owner: wrestling +-- Name: competition_bout_id_seq; Type: SEQUENCE SET; Schema: public; Owner: wrestling -- -SELECT pg_catalog.setval('public.event_person_id_seq', 1, false); +SELECT pg_catalog.setval('public.competition_bout_id_seq', 1, false); -- --- Name: bout_action_id_seq; Type: SEQUENCE SET; Schema: public; Owner: wrestling +-- Name: competition_id_seq; Type: SEQUENCE SET; Schema: public; Owner: wrestling -- -SELECT pg_catalog.setval('public.bout_action_id_seq', 4, true); +SELECT pg_catalog.setval('public.competition_id_seq', 1, false); -- --- Name: bout_id_seq; Type: SEQUENCE SET; Schema: public; Owner: wrestling +-- Name: event_person_id_seq; Type: SEQUENCE SET; Schema: public; Owner: wrestling -- -SELECT pg_catalog.setval('public.bout_id_seq', 26, true); +SELECT pg_catalog.setval('public.event_person_id_seq', 1, false); -- @@ -1371,39 +1385,41 @@ SELECT pg_catalog.setval('public.team_match_id_seq', 1, true); -- --- Name: competition_bout_id_seq; Type: SEQUENCE SET; Schema: public; Owner: wrestling +-- Name: weight_class_id_seq; Type: SEQUENCE SET; Schema: public; Owner: wrestling -- -SELECT pg_catalog.setval('public.competition_bout_id_seq', 1, false); +SELECT pg_catalog.setval('public.weight_class_id_seq', 10, true); -- --- Name: competition_id_seq; Type: SEQUENCE SET; Schema: public; Owner: wrestling +-- Name: wrestling_event_id_seq; Type: SEQUENCE SET; Schema: public; Owner: wrestling -- -SELECT pg_catalog.setval('public.competition_id_seq', 1, false); +SELECT pg_catalog.setval('public.wrestling_event_id_seq', 1, true); -- --- Name: weight_class_id_seq; Type: SEQUENCE SET; Schema: public; Owner: wrestling +-- Name: bout_action bout_action_pk; Type: CONSTRAINT; Schema: public; Owner: wrestling -- -SELECT pg_catalog.setval('public.weight_class_id_seq', 10, true); +ALTER TABLE ONLY public.bout_action + ADD CONSTRAINT bout_action_pk PRIMARY KEY (id); -- --- Name: wrestling_event_id_seq; Type: SEQUENCE SET; Schema: public; Owner: wrestling +-- Name: bout_config bout_config_pk; Type: CONSTRAINT; Schema: public; Owner: wrestling -- -SELECT pg_catalog.setval('public.wrestling_event_id_seq', 1, true); +ALTER TABLE ONLY public.bout_config + ADD CONSTRAINT bout_config_pk PRIMARY KEY (id); -- --- Name: bout_config bout_config_pk; Type: CONSTRAINT; Schema: public; Owner: wrestling +-- Name: bout bout_pk; Type: CONSTRAINT; Schema: public; Owner: wrestling -- -ALTER TABLE ONLY public.bout_config - ADD CONSTRAINT bout_config_pk PRIMARY KEY (id); +ALTER TABLE ONLY public.bout + ADD CONSTRAINT bout_pk PRIMARY KEY (id); -- @@ -1415,27 +1431,27 @@ ALTER TABLE ONLY public.club -- --- Name: competition_person event_person_pk; Type: CONSTRAINT; Schema: public; Owner: wrestling +-- Name: competition_bout competition_bout_pk; Type: CONSTRAINT; Schema: public; Owner: wrestling -- -ALTER TABLE ONLY public.competition_person - ADD CONSTRAINT event_person_pk PRIMARY KEY (id); +ALTER TABLE ONLY public.competition_bout + ADD CONSTRAINT competition_bout_pk PRIMARY KEY (id); -- --- Name: bout_action bout_action_pk; Type: CONSTRAINT; Schema: public; Owner: wrestling +-- Name: competition competition_pk; Type: CONSTRAINT; Schema: public; Owner: wrestling -- -ALTER TABLE ONLY public.bout_action - ADD CONSTRAINT bout_action_pk PRIMARY KEY (id); +ALTER TABLE ONLY public.competition + ADD CONSTRAINT competition_pk PRIMARY KEY (id); -- --- Name: bout bout_pk; Type: CONSTRAINT; Schema: public; Owner: wrestling +-- Name: competition_person event_person_pk; Type: CONSTRAINT; Schema: public; Owner: wrestling -- -ALTER TABLE ONLY public.bout - ADD CONSTRAINT bout_pk PRIMARY KEY (id); +ALTER TABLE ONLY public.competition_person + ADD CONSTRAINT event_person_pk PRIMARY KEY (id); -- @@ -1534,22 +1550,6 @@ ALTER TABLE ONLY public.team ADD CONSTRAINT team_pk PRIMARY KEY (id); --- --- Name: competition_bout competition_bout_pk; Type: CONSTRAINT; Schema: public; Owner: wrestling --- - -ALTER TABLE ONLY public.competition_bout - ADD CONSTRAINT competition_bout_pk PRIMARY KEY (id); - - --- --- Name: competition competition_pk; Type: CONSTRAINT; Schema: public; Owner: wrestling --- - -ALTER TABLE ONLY public.competition - ADD CONSTRAINT competition_pk PRIMARY KEY (id); - - -- -- Name: weight_class weight_class_pk; Type: CONSTRAINT; Schema: public; Owner: wrestling -- @@ -1608,22 +1608,6 @@ CREATE UNIQUE INDEX league_weight_class_id_uindex ON public.league_weight_class CREATE UNIQUE INDEX team_match_bout_id_uindex ON public.team_match_bout USING btree (id); --- --- Name: competition_person event_person_person_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: wrestling --- - -ALTER TABLE ONLY public.competition_person - ADD CONSTRAINT event_person_person_id_fk FOREIGN KEY (person_id) REFERENCES public.person(id) ON DELETE CASCADE; - - --- --- Name: competition_person event_person_wrestling_event_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: wrestling --- - -ALTER TABLE ONLY public.competition_person - ADD CONSTRAINT event_person_wrestling_event_id_fk FOREIGN KEY (competition_id) REFERENCES public.wrestling_event(id) ON DELETE CASCADE; - - -- -- Name: bout_action bout_action_bout_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: wrestling -- @@ -1656,6 +1640,46 @@ ALTER TABLE ONLY public.bout ADD CONSTRAINT bout_weight_class_id_fk FOREIGN KEY (weight_class_id) REFERENCES public.weight_class(id) ON DELETE CASCADE; +-- +-- Name: competition_bout competition_bout_bout_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: wrestling +-- + +ALTER TABLE ONLY public.competition_bout + ADD CONSTRAINT competition_bout_bout_id_fk FOREIGN KEY (bout_id) REFERENCES public.bout(id) ON DELETE CASCADE; + + +-- +-- Name: competition_bout competition_bout_competition_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: wrestling +-- + +ALTER TABLE ONLY public.competition_bout + ADD CONSTRAINT competition_bout_competition_id_fk FOREIGN KEY (competition_id) REFERENCES public.competition(id) ON DELETE CASCADE; + + +-- +-- Name: competition competition_bout_config_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: wrestling +-- + +ALTER TABLE ONLY public.competition + ADD CONSTRAINT competition_bout_config_id_fk FOREIGN KEY (bout_config_id) REFERENCES public.bout_config(id) ON DELETE CASCADE; + + +-- +-- Name: competition_person event_person_person_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: wrestling +-- + +ALTER TABLE ONLY public.competition_person + ADD CONSTRAINT event_person_person_id_fk FOREIGN KEY (person_id) REFERENCES public.person(id) ON DELETE CASCADE; + + +-- +-- Name: competition_person event_person_wrestling_event_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: wrestling +-- + +ALTER TABLE ONLY public.competition_person + ADD CONSTRAINT event_person_wrestling_event_id_fk FOREIGN KEY (competition_id) REFERENCES public.wrestling_event(id) ON DELETE CASCADE; + + -- -- Name: league league_bout_config_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: wrestling -- @@ -1848,30 +1872,6 @@ ALTER TABLE ONLY public.team_match ADD CONSTRAINT team_match_person_id_fk_5 FOREIGN KEY (judge_id) REFERENCES public.person(id) ON DELETE CASCADE; --- --- Name: competition competition_bout_config_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: wrestling --- - -ALTER TABLE ONLY public.competition - ADD CONSTRAINT competition_bout_config_id_fk FOREIGN KEY (bout_config_id) REFERENCES public.bout_config(id) ON DELETE CASCADE; - - --- --- Name: competition_bout competition_bout_bout_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: wrestling --- - -ALTER TABLE ONLY public.competition_bout - ADD CONSTRAINT competition_bout_bout_id_fk FOREIGN KEY (bout_id) REFERENCES public.bout(id) ON DELETE CASCADE; - - --- --- Name: competition_bout competition_bout_competition_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: wrestling --- - -ALTER TABLE ONLY public.competition_bout - ADD CONSTRAINT competition_bout_competition_id_fk FOREIGN KEY (competition_id) REFERENCES public.competition(id) ON DELETE CASCADE; - - -- -- PostgreSQL database dump complete -- diff --git a/wrestling_scoreboard_server/lib/controllers/team_match_controller.dart b/wrestling_scoreboard_server/lib/controllers/team_match_controller.dart index 43b0c610..823aed41 100644 --- a/wrestling_scoreboard_server/lib/controllers/team_match_controller.dart +++ b/wrestling_scoreboard_server/lib/controllers/team_match_controller.dart @@ -69,7 +69,7 @@ class TeamMatchController extends EntityController { JOIN team_match_bout AS tmf ON f.id = tmf.bout_id ${hasRed ? 'JOIN participant_state AS ps_red ON ps_red.id = f.red_id' : ''} ${hasBlue ? 'JOIN participant_state AS ps_blue ON ps_blue.id = f.blue_id' : ''} - WHERE f.weight_class_id = ${bout.weightClass.id} + WHERE f.weight_class_id = ${bout.weightClass!.id} AND tmf.team_match_id = ${teamMatch.id} AND ${hasRed ? 'ps_red.participation_id = ${bout.r!.participation.id}' : 'f.red_id IS NULL'} AND ${hasBlue ? 'ps_blue.participation_id = ${bout.b!.participation.id}' : 'f.blue_id IS NULL'};