From b78368684ff49e81b30eb35a2cb7a4d41236a141 Mon Sep 17 00:00:00 2001 From: Gustl22 Date: Sun, 3 Mar 2024 00:37:02 +0100 Subject: [PATCH] feat: Adding season partition (closes #3) --- .../lib/l10n/app_de.arb | 5 + .../lib/l10n/app_en.arb | 5 + .../lib/localization/gender.dart | 2 +- .../lib/localization/season.dart | 16 + .../lib/mocks/services/network/data.dart | 3 + .../screens/edit/team_match/league_edit.dart | 30 +- .../team_match/league_weight_class_edit.dart | 27 +- .../edit/team_match/team_match_edit.dart | 19 +- .../overview/team_match/league_overview.dart | 11 +- .../league_weight_class_overview.dart | 31 +- .../team_match/team_match_overview.dart | 23 +- .../lib/view/widgets/toggle_buttons.dart | 36 +++ wrestling_scoreboard_common/README.md | 18 +- .../lib/src/data/bout.freezed.dart | 2 +- .../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 | 2 +- .../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.freezed.dart | 2 +- .../lib/src/data/person.freezed.dart | 2 +- .../lib/src/data/team.freezed.dart | 2 +- .../lib/src/data/team_match/league.dart | 11 +- .../src/data/team_match/league.freezed.dart | 35 ++- .../lib/src/data/team_match/league.g.dart | 2 + .../league_team_participation.freezed.dart | 2 +- .../data/team_match/league_weight_class.dart | 5 +- .../league_weight_class.freezed.dart | 34 ++- .../team_match/league_weight_class.g.dart | 2 + .../lib/src/data/team_match/team_match.dart | 3 + .../data/team_match/team_match.freezed.dart | 28 +- .../lib/src/data/team_match/team_match.g.dart | 2 + .../team_match/team_match_bout.freezed.dart | 2 +- .../lib/src/data/weight_class.freezed.dart | 2 +- .../database/README.md | 2 +- .../PostgreSQL-wrestling_scoreboard-dump.sql | 283 +++++++++--------- .../lib/controllers/league_controller.dart | 20 +- .../controllers/team_match_controller.dart | 3 +- 43 files changed, 467 insertions(+), 223 deletions(-) create mode 100644 wrestling_scoreboard_client/lib/localization/season.dart create mode 100644 wrestling_scoreboard_client/lib/view/widgets/toggle_buttons.dart diff --git a/wrestling_scoreboard_client/lib/l10n/app_de.arb b/wrestling_scoreboard_client/lib/l10n/app_de.arb index 8d7e56f2..3d581af7 100644 --- a/wrestling_scoreboard_client/lib/l10n/app_de.arb +++ b/wrestling_scoreboard_client/lib/l10n/app_de.arb @@ -80,6 +80,11 @@ "participatingTeams": "Teilnehmende Mannschaften", "league": "Liga", "leagues": "Ligen", + "season": "Saison", + "seasonPartition": "Saison-Abschnitt", + "seasonPartitions": "Season-Abschnitte", + "seasonFirstHalf": "Hinrunde", + "seasonSecondHalf": "Rückrunde", "competitions": "Turniere", "match": "Begegnung", "matches": "Begegnungen", diff --git a/wrestling_scoreboard_client/lib/l10n/app_en.arb b/wrestling_scoreboard_client/lib/l10n/app_en.arb index 2f6ca433..d766027c 100644 --- a/wrestling_scoreboard_client/lib/l10n/app_en.arb +++ b/wrestling_scoreboard_client/lib/l10n/app_en.arb @@ -83,6 +83,11 @@ "participatingTeams": "Participating Teams", "league": "League", "leagues": "Leagues", + "season": "Season", + "seasonPartition": "Season Partition", + "seasonPartitions": "Season Partitions", + "seasonFirstHalf": "First Half", + "seasonSecondHalf": "Second Half", "competitions": "Competitions", "match": "Match", "matches": "Matches", diff --git a/wrestling_scoreboard_client/lib/localization/gender.dart b/wrestling_scoreboard_client/lib/localization/gender.dart index 3f1d5f31..3a787bce 100644 --- a/wrestling_scoreboard_client/lib/localization/gender.dart +++ b/wrestling_scoreboard_client/lib/localization/gender.dart @@ -1,4 +1,4 @@ -import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:wrestling_scoreboard_common/common.dart'; diff --git a/wrestling_scoreboard_client/lib/localization/season.dart b/wrestling_scoreboard_client/lib/localization/season.dart new file mode 100644 index 00000000..24460505 --- /dev/null +++ b/wrestling_scoreboard_client/lib/localization/season.dart @@ -0,0 +1,16 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; + +extension SeasonLocalization on int { + String asSeasonPartition(BuildContext context, int? seasonPartitions) { + final localizations = AppLocalizations.of(context)!; + if (seasonPartitions == 2) { + if (this == 0) { + return localizations.seasonFirstHalf; + } else { + return localizations.seasonSecondHalf; + } + } + return (this + 1).toString(); + } +} diff --git a/wrestling_scoreboard_client/lib/mocks/services/network/data.dart b/wrestling_scoreboard_client/lib/mocks/services/network/data.dart index 96fd465a..ad5afdba 100644 --- a/wrestling_scoreboard_client/lib/mocks/services/network/data.dart +++ b/wrestling_scoreboard_client/lib/mocks/services/network/data.dart @@ -5,18 +5,21 @@ League _leagueMenRPW = League( name: 'Real Pro Wrestling', startDate: DateTime(2021), boutConfig: const BoutConfig(id: 1), + seasonPartitions: 2, ); League _leagueJnRPW = League( id: 2, name: 'Real Pro Wrestling Jn', startDate: DateTime(2021), boutConfig: const BoutConfig(id: 2), + seasonPartitions: 2, ); League _leagueNational = League( id: 3, name: 'National League', startDate: DateTime(2021), boutConfig: const BoutConfig(id: 3), + seasonPartitions: 2, ); Club _homeClub = const Club(id: 1, name: 'Springfield Wrestlers'); diff --git a/wrestling_scoreboard_client/lib/view/screens/edit/team_match/league_edit.dart b/wrestling_scoreboard_client/lib/view/screens/edit/team_match/league_edit.dart index 30189a9a..14b2c295 100644 --- a/wrestling_scoreboard_client/lib/view/screens/edit/team_match/league_edit.dart +++ b/wrestling_scoreboard_client/lib/view/screens/edit/team_match/league_edit.dart @@ -1,9 +1,10 @@ import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:wrestling_scoreboard_client/localization/date_time.dart'; import 'package:wrestling_scoreboard_client/provider/network_provider.dart'; import 'package:wrestling_scoreboard_client/view/screens/edit/bout_config_edit.dart'; -import 'package:wrestling_scoreboard_client/localization/date_time.dart'; import 'package:wrestling_scoreboard_common/common.dart'; class LeagueEdit extends BoutConfigEdit { @@ -17,11 +18,13 @@ class LeagueEdit extends BoutConfigEdit { class LeagueEditState extends BoutConfigEditState { String? _name; + late int _seasonPartitions; late DateTime _startDate; @override void initState() { _startDate = widget.league?.startDate ?? DateTime.now(); + _seasonPartitions = widget.league?.seasonPartitions ?? 1; super.initState(); } @@ -70,12 +73,33 @@ class LeagueEditState extends BoutConfigEditState { initialValue: _startDate.toDateString(context), ), ), + ListTile( + leading: const Icon(Icons.sunny_snowing), + title: TextFormField( + initialValue: widget.league?.seasonPartitions.toString() ?? '', + keyboardType: TextInputType.number, + decoration: InputDecoration( + contentPadding: const EdgeInsets.symmetric(vertical: 20), + labelText: localizations.seasonPartitions, + ), + inputFormatters: [FilteringTextInputFormatter.allow(RegExp(r'^\d'))], + onSaved: (String? value) { + _seasonPartitions = int.tryParse(value ?? '') ?? 1; + if (_seasonPartitions < 1) _seasonPartitions = 1; + }, + ), + ), ]); } @override Future handleNested(BoutConfig dataObject) async { - await (await ref.read(dataManagerNotifierProvider)).createOrUpdateSingle( - League(id: widget.league?.id, name: _name!, startDate: _startDate, boutConfig: dataObject)); + await (await ref.read(dataManagerNotifierProvider)).createOrUpdateSingle(League( + id: widget.league?.id, + name: _name!, + startDate: _startDate, + boutConfig: dataObject, + seasonPartitions: _seasonPartitions, + )); } } diff --git a/wrestling_scoreboard_client/lib/view/screens/edit/team_match/league_weight_class_edit.dart b/wrestling_scoreboard_client/lib/view/screens/edit/team_match/league_weight_class_edit.dart index 952f20b4..65874c0a 100644 --- a/wrestling_scoreboard_client/lib/view/screens/edit/team_match/league_weight_class_edit.dart +++ b/wrestling_scoreboard_client/lib/view/screens/edit/team_match/league_weight_class_edit.dart @@ -2,8 +2,10 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:wrestling_scoreboard_client/localization/season.dart'; import 'package:wrestling_scoreboard_client/provider/network_provider.dart'; import 'package:wrestling_scoreboard_client/view/screens/edit/weight_class_edit.dart'; +import 'package:wrestling_scoreboard_client/view/widgets/toggle_buttons.dart'; import 'package:wrestling_scoreboard_common/common.dart'; class LeagueWeightClassEdit extends WeightClassEdit { @@ -19,6 +21,13 @@ class LeagueWeightClassEdit extends WeightClassEdit { class LeagueWeightClassEditState extends WeightClassEditState { int _pos = 0; + late int _seasonPartition; + + @override + void initState() { + super.initState(); + _seasonPartition = widget.leagueWeightClass?.seasonPartition ?? 0; + } @override Widget build(BuildContext context) { @@ -39,13 +48,29 @@ class LeagueWeightClassEditState extends WeightClassEditState 1) + ListTile( + leading: const Icon(Icons.sunny_snowing), + title: IndexedToggleButtons( + label: localizations.seasonPartition, + onPressed: (e) => setState(() => _seasonPartition = e), + selected: _seasonPartition, + numOptions: widget.initialLeague.seasonPartitions, + getTitle: (e) => e.asSeasonPartition(context, widget.initialLeague.seasonPartitions), + ), + ), ]); } @override Future handleNested(weightClass) async { var leagueWeightClass = LeagueWeightClass( - id: widget.leagueWeightClass?.id, league: widget.initialLeague, pos: _pos, weightClass: weightClass); + id: widget.leagueWeightClass?.id, + league: widget.initialLeague, + pos: _pos, + weightClass: weightClass, + seasonPartition: _seasonPartition, + ); leagueWeightClass = leagueWeightClass .copyWithId(await (await ref.read(dataManagerNotifierProvider)).createOrUpdateSingle(leagueWeightClass)); } diff --git a/wrestling_scoreboard_client/lib/view/screens/edit/team_match/team_match_edit.dart b/wrestling_scoreboard_client/lib/view/screens/edit/team_match/team_match_edit.dart index 11b70a9d..30bc6c42 100644 --- a/wrestling_scoreboard_client/lib/view/screens/edit/team_match/team_match_edit.dart +++ b/wrestling_scoreboard_client/lib/view/screens/edit/team_match/team_match_edit.dart @@ -1,10 +1,12 @@ import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:wrestling_scoreboard_client/localization/date_time.dart'; +import 'package:wrestling_scoreboard_client/localization/season.dart'; import 'package:wrestling_scoreboard_client/provider/network_provider.dart'; import 'package:wrestling_scoreboard_client/view/widgets/dropdown.dart'; import 'package:wrestling_scoreboard_client/view/widgets/edit.dart'; -import 'package:wrestling_scoreboard_client/localization/date_time.dart'; +import 'package:wrestling_scoreboard_client/view/widgets/toggle_buttons.dart'; import 'package:wrestling_scoreboard_common/common.dart'; class TeamMatchEdit extends ConsumerStatefulWidget { @@ -36,6 +38,7 @@ class TeamMatchEditState extends ConsumerState { Team? _homeTeam; Team? _guestTeam; League? _league; + int? _seasonPartition; late DateTime _date; @override @@ -45,6 +48,8 @@ class TeamMatchEditState extends ConsumerState { _guestTeam = widget.teamMatch?.guest.team ?? widget.initialGuestTeam; _date = widget.teamMatch?.date ?? DateTime.now(); _league = widget.teamMatch?.league ?? widget.initialLeague; + // Set initial season partition to 0, if match has a league. + _seasonPartition = widget.teamMatch?.seasonPartition ?? (_league != null ? 0 : null); } @override @@ -163,6 +168,17 @@ class TeamMatchEditState extends ConsumerState { }, ), ), + if (_league != null && _league!.seasonPartitions > 1) + ListTile( + leading: const Icon(Icons.sunny_snowing), + title: IndexedToggleButtons( + label: localizations.seasonPartition, + onPressed: (e) => setState(() => _seasonPartition = e), + selected: _seasonPartition, + numOptions: _league!.seasonPartitions, + getTitle: (e) => e.asSeasonPartition(context, _league!.seasonPartitions), + ), + ), ]; return Form( @@ -210,6 +226,7 @@ class TeamMatchEditState extends ConsumerState { guest: guest, date: _date, league: _league, + seasonPartition: _seasonPartition, ), ); navigator.pop(); diff --git a/wrestling_scoreboard_client/lib/view/screens/overview/team_match/league_overview.dart b/wrestling_scoreboard_client/lib/view/screens/overview/team_match/league_overview.dart index 68a13bc9..d5a4d4c1 100644 --- a/wrestling_scoreboard_client/lib/view/screens/overview/team_match/league_overview.dart +++ b/wrestling_scoreboard_client/lib/view/screens/overview/team_match/league_overview.dart @@ -3,6 +3,7 @@ import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:go_router/go_router.dart'; import 'package:wrestling_scoreboard_client/localization/date_time.dart'; +import 'package:wrestling_scoreboard_client/localization/season.dart'; import 'package:wrestling_scoreboard_client/localization/wrestling_style.dart'; import 'package:wrestling_scoreboard_client/provider/network_provider.dart'; import 'package:wrestling_scoreboard_client/view/screens/edit/team_match/league_edit.dart'; @@ -52,7 +53,12 @@ class LeagueOverview extends ConsumerWidget { // '${localizations.injuryDurationInSecs}: ${data.boutConfig.injuryDuration.inSeconds}', subtitle: localizations.periodDurationInSecs, // Start date icon: Icons.timer, - ) + ), + ContentItem( + title: data.seasonPartitions.toString(), + subtitle: localizations.seasonPartitions, + icon: Icons.sunny_snowing, + ), ], ); return Scaffold( @@ -117,7 +123,8 @@ class LeagueOverview extends ConsumerWidget { initialData: e, builder: (context, data) { return ContentItem( - title: '${data.weightClass.name} ${data.weightClass.style.localize(context)}', + title: + '${data.weightClass.name} ${data.weightClass.style.localize(context)} ${data.seasonPartition == null ? '' : '(${data.seasonPartition!.asSeasonPartition(context, data.league.seasonPartitions)})'}', icon: Icons.fitness_center, onTap: () => handleSelectedWeightClass(data, context)); }, diff --git a/wrestling_scoreboard_client/lib/view/screens/overview/team_match/league_weight_class_overview.dart b/wrestling_scoreboard_client/lib/view/screens/overview/team_match/league_weight_class_overview.dart index 194d1d5b..e573d746 100644 --- a/wrestling_scoreboard_client/lib/view/screens/overview/team_match/league_weight_class_overview.dart +++ b/wrestling_scoreboard_client/lib/view/screens/overview/team_match/league_weight_class_overview.dart @@ -1,10 +1,12 @@ import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:wrestling_scoreboard_client/localization/season.dart'; import 'package:wrestling_scoreboard_client/provider/network_provider.dart'; -import 'package:wrestling_scoreboard_client/view/widgets/consumer.dart'; import 'package:wrestling_scoreboard_client/view/screens/edit/team_match/league_weight_class_edit.dart'; import 'package:wrestling_scoreboard_client/view/screens/overview/weight_class_overview.dart'; +import 'package:wrestling_scoreboard_client/view/widgets/consumer.dart'; +import 'package:wrestling_scoreboard_client/view/widgets/grouped_list.dart'; import 'package:wrestling_scoreboard_common/common.dart'; class LeagueWeightClassOverview extends WeightClassOverview { @@ -22,16 +24,25 @@ class LeagueWeightClassOverview extends WeightClassOverview { id: id, initialData: leagueWeightClass, builder: (context, data) { - return buildOverview(context, ref, - classLocale: localizations.weightClass, - editPage: LeagueWeightClassEdit( - leagueWeightClass: data, - initialLeague: data.league, + return buildOverview( + context, + ref, + classLocale: localizations.weightClass, + editPage: LeagueWeightClassEdit( + leagueWeightClass: data, + initialLeague: data.league, + ), + onDelete: () async => (await ref.read(dataManagerNotifierProvider)).deleteSingle(data), + tiles: [ + ContentItem( + title: data.seasonPartition?.asSeasonPartition(context, data.league.seasonPartitions) ?? '-', + subtitle: localizations.seasonPartition, + icon: Icons.sunny_snowing, ), - onDelete: () async => (await ref.read(dataManagerNotifierProvider)).deleteSingle(data), - tiles: [], - dataId: data.weightClass.id!, - initialData: data.weightClass); + ], + dataId: data.weightClass.id!, + initialData: data.weightClass, + ); }, ); } diff --git a/wrestling_scoreboard_client/lib/view/screens/overview/team_match/team_match_overview.dart b/wrestling_scoreboard_client/lib/view/screens/overview/team_match/team_match_overview.dart index 15c985e9..d4618c5e 100644 --- a/wrestling_scoreboard_client/lib/view/screens/overview/team_match/team_match_overview.dart +++ b/wrestling_scoreboard_client/lib/view/screens/overview/team_match/team_match_overview.dart @@ -3,18 +3,19 @@ import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:go_router/go_router.dart'; import 'package:wrestling_scoreboard_client/localization/bout_utils.dart'; +import 'package:wrestling_scoreboard_client/localization/date_time.dart'; +import 'package:wrestling_scoreboard_client/localization/season.dart'; import 'package:wrestling_scoreboard_client/provider/network_provider.dart'; -import 'package:wrestling_scoreboard_client/view/widgets/consumer.dart'; -import 'package:wrestling_scoreboard_client/view/widgets/grouped_list.dart'; -import 'package:wrestling_scoreboard_client/view/widgets/info.dart'; +import 'package:wrestling_scoreboard_client/services/network/data_manager.dart'; import 'package:wrestling_scoreboard_client/view/screens/display/match/match_display.dart'; import 'package:wrestling_scoreboard_client/view/screens/edit/lineup_edit.dart'; import 'package:wrestling_scoreboard_client/view/screens/edit/team_match/team_match_bout_edit.dart'; import 'package:wrestling_scoreboard_client/view/screens/edit/team_match/team_match_edit.dart'; import 'package:wrestling_scoreboard_client/view/screens/overview/common.dart'; import 'package:wrestling_scoreboard_client/view/screens/overview/team_match/team_match_bout_overview.dart'; -import 'package:wrestling_scoreboard_client/localization/date_time.dart'; -import 'package:wrestling_scoreboard_client/services/network/data_manager.dart'; +import 'package:wrestling_scoreboard_client/view/widgets/consumer.dart'; +import 'package:wrestling_scoreboard_client/view/widgets/grouped_list.dart'; +import 'package:wrestling_scoreboard_client/view/widgets/info.dart'; import 'package:wrestling_scoreboard_common/common.dart'; class TeamMatchOverview extends ConsumerWidget { @@ -98,6 +99,12 @@ class TeamMatchOverview extends ConsumerWidget { subtitle: localizations.league, icon: Icons.emoji_events, ), + ContentItem( + title: match.seasonPartition?.asSeasonPartition(context, match.league?.seasonPartitions) ?? + '-', + subtitle: localizations.seasonPartition, + icon: Icons.sunny_snowing, + ), ]), ListGroup( header: HeadingItem(title: localizations.persons), @@ -211,12 +218,14 @@ class TeamMatchOverview extends ConsumerWidget { handleSelectedLineup( Lineup lineup, League league, TeamMatch match, NavigatorState navigator, DataManager dataManager) async { final participations = await dataManager.readMany(filterObject: lineup); - final weightClasses = await dataManager.readMany(filterObject: league); + final weightClasses = (await dataManager.readMany(filterObject: league)) + .where((element) => element.seasonPartition == match.seasonPartition) + .toList(); navigator.push( MaterialPageRoute( builder: (context) { return LineupEdit( - weightClasses: weightClasses, + weightClasses: weightClasses.map((e) => e.weightClass).toList(), participations: participations, lineup: lineup, onSubmitGenerate: () { diff --git a/wrestling_scoreboard_client/lib/view/widgets/toggle_buttons.dart b/wrestling_scoreboard_client/lib/view/widgets/toggle_buttons.dart new file mode 100644 index 00000000..3f41e0ea --- /dev/null +++ b/wrestling_scoreboard_client/lib/view/widgets/toggle_buttons.dart @@ -0,0 +1,36 @@ +import 'package:flutter/material.dart'; + +class IndexedToggleButtons extends StatelessWidget { + final Function(int index) onPressed; + final String Function(int index) getTitle; + final String label; + final int numOptions; + final int? selected; + + const IndexedToggleButtons({ + super.key, + required this.onPressed, + required this.numOptions, + required this.selected, + required this.getTitle, + required this.label, + }); + + @override + Widget build(BuildContext context) { + return Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text(label), + ToggleButtons( + borderRadius: const BorderRadius.all(Radius.circular(4)), + onPressed: onPressed, + isSelected: Iterable.generate(numOptions, (e) => e == selected).toList(), + children: Iterable.generate(numOptions, (e) { + return Padding(padding: const EdgeInsets.all(8), child: Text(getTitle(e))); + }).toList(), + ), + ], + ); + } +} diff --git a/wrestling_scoreboard_common/README.md b/wrestling_scoreboard_common/README.md index 452a43ba..93303e48 100644 --- a/wrestling_scoreboard_common/README.md +++ b/wrestling_scoreboard_common/README.md @@ -23,13 +23,13 @@ flutter pub run build_runner build --delete-conflicting-outputs ## Adding a new data object type Update following files accordingly: -- `package:common/lib/src/util/data_wrapper.dart` -- `package:common/lib/src/data/data_oject.dart` -- `package:common/lib/src/data.dart` -- `package:server/lib/routes/api_route.dart` -- `package:server/lib/controllers/websocket_handler.dart` -- `package:server/lib/controllers/entity_controller.dart@getControllerFromDataType` -- `package:server/public/index.html` +- `package:wrestling_scoreboard_common/lib/src/util/data_wrapper.dart` +- `package:wrestling_scoreboard_common/lib/src/data/data_oject.dart` +- `package:wrestling_scoreboard_common/lib/src/data.dart` +- `package:wrestling_scoreboard_server/lib/routes/api_route.dart` +- `package:wrestling_scoreboard_server/lib/controllers/websocket_handler.dart` +- `package:wrestling_scoreboard_server/lib/controllers/entity_controller.dart@getControllerFromDataType` +- `package:wrestling_scoreboard_server/public/index.html` - Adapt and export database -- `package:client/lib/mocks/mock_data_provider.dart` -- `package:client/lib/mocks/mocks.dart` +- `package:wrestling_scoreboard_client/lib/mocks/mock_data_provider.dart` +- `package:wrestling_scoreboard_client/lib/mocks/mocks.dart` diff --git a/wrestling_scoreboard_common/lib/src/data/bout.freezed.dart b/wrestling_scoreboard_common/lib/src/data/bout.freezed.dart index 1db10b87..877fe55c 100644 --- a/wrestling_scoreboard_common/lib/src/data/bout.freezed.dart +++ b/wrestling_scoreboard_common/lib/src/data/bout.freezed.dart @@ -12,7 +12,7 @@ part of 'bout.dart'; T _$identity(T value) => value; final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); Bout _$BoutFromJson(Map json) { return _Bout.fromJson(json); 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 5e9c3558..2b51eba8 100644 --- a/wrestling_scoreboard_common/lib/src/data/bout_action.freezed.dart +++ b/wrestling_scoreboard_common/lib/src/data/bout_action.freezed.dart @@ -12,7 +12,7 @@ part of 'bout_action.dart'; T _$identity(T value) => value; final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); BoutAction _$BoutActionFromJson(Map json) { return _BoutAction.fromJson(json); 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 217ec3a2..b9717b02 100644 --- a/wrestling_scoreboard_common/lib/src/data/bout_config.freezed.dart +++ b/wrestling_scoreboard_common/lib/src/data/bout_config.freezed.dart @@ -12,7 +12,7 @@ part of 'bout_config.dart'; T _$identity(T value) => value; final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); BoutConfig _$BoutConfigFromJson(Map json) { return _BoutConfig.fromJson(json); diff --git a/wrestling_scoreboard_common/lib/src/data/club.freezed.dart b/wrestling_scoreboard_common/lib/src/data/club.freezed.dart index a5501790..6a6c882e 100644 --- a/wrestling_scoreboard_common/lib/src/data/club.freezed.dart +++ b/wrestling_scoreboard_common/lib/src/data/club.freezed.dart @@ -12,7 +12,7 @@ part of 'club.dart'; T _$identity(T value) => value; final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); Club _$ClubFromJson(Map json) { return _Club.fromJson(json); 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 e6a30dca..e7de8043 100644 --- a/wrestling_scoreboard_common/lib/src/data/competition/competition.freezed.dart +++ b/wrestling_scoreboard_common/lib/src/data/competition/competition.freezed.dart @@ -12,7 +12,7 @@ part of 'competition.dart'; T _$identity(T value) => value; final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); Competition _$CompetitionFromJson(Map json) { return _Competition.fromJson(json); 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 a94df923..1378ba44 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 @@ -12,7 +12,7 @@ part of 'competition_bout.dart'; T _$identity(T value) => value; final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); CompetitionBout _$CompetitionBoutFromJson(Map json) { return _CompetitionBout.fromJson(json); 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 f6fe13bc..6bc6f8a6 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 @@ -12,7 +12,7 @@ part of 'competition_person.dart'; T _$identity(T value) => value; final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); CompetitionPerson _$CompetitionPersonFromJson(Map json) { return _CompetitionPerson.fromJson(json); 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 daaafcb5..7f8d7d04 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 @@ -12,7 +12,7 @@ part of 'competition_team_participation.dart'; T _$identity(T value) => value; final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); CompetitionTeamParticipation _$CompetitionTeamParticipationFromJson(Map json) { return _CompetitionTeamParticipation.fromJson(json); diff --git a/wrestling_scoreboard_common/lib/src/data/lineup.freezed.dart b/wrestling_scoreboard_common/lib/src/data/lineup.freezed.dart index 3d0e5cf1..4f12b206 100644 --- a/wrestling_scoreboard_common/lib/src/data/lineup.freezed.dart +++ b/wrestling_scoreboard_common/lib/src/data/lineup.freezed.dart @@ -12,7 +12,7 @@ part of 'lineup.dart'; T _$identity(T value) => value; final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); Lineup _$LineupFromJson(Map json) { return _Lineup.fromJson(json); diff --git a/wrestling_scoreboard_common/lib/src/data/membership.freezed.dart b/wrestling_scoreboard_common/lib/src/data/membership.freezed.dart index ecd47d86..d620fa2f 100644 --- a/wrestling_scoreboard_common/lib/src/data/membership.freezed.dart +++ b/wrestling_scoreboard_common/lib/src/data/membership.freezed.dart @@ -12,7 +12,7 @@ part of 'membership.dart'; T _$identity(T value) => value; final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); Membership _$MembershipFromJson(Map json) { return _Membership.fromJson(json); 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 e5390351..0a13ea61 100644 --- a/wrestling_scoreboard_common/lib/src/data/participant_state.freezed.dart +++ b/wrestling_scoreboard_common/lib/src/data/participant_state.freezed.dart @@ -12,7 +12,7 @@ part of 'participant_state.dart'; T _$identity(T value) => value; final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); ParticipantState _$ParticipantStateFromJson(Map json) { return _ParticipantState.fromJson(json); diff --git a/wrestling_scoreboard_common/lib/src/data/participation.freezed.dart b/wrestling_scoreboard_common/lib/src/data/participation.freezed.dart index c45e01f3..1bd9043c 100644 --- a/wrestling_scoreboard_common/lib/src/data/participation.freezed.dart +++ b/wrestling_scoreboard_common/lib/src/data/participation.freezed.dart @@ -12,7 +12,7 @@ part of 'participation.dart'; T _$identity(T value) => value; final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); Participation _$ParticipationFromJson(Map json) { return _Participation.fromJson(json); diff --git a/wrestling_scoreboard_common/lib/src/data/person.freezed.dart b/wrestling_scoreboard_common/lib/src/data/person.freezed.dart index 53b85772..f569c505 100644 --- a/wrestling_scoreboard_common/lib/src/data/person.freezed.dart +++ b/wrestling_scoreboard_common/lib/src/data/person.freezed.dart @@ -12,7 +12,7 @@ part of 'person.dart'; T _$identity(T value) => value; final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); Person _$PersonFromJson(Map json) { return _Person.fromJson(json); diff --git a/wrestling_scoreboard_common/lib/src/data/team.freezed.dart b/wrestling_scoreboard_common/lib/src/data/team.freezed.dart index 74d738aa..b5be94cf 100644 --- a/wrestling_scoreboard_common/lib/src/data/team.freezed.dart +++ b/wrestling_scoreboard_common/lib/src/data/team.freezed.dart @@ -12,7 +12,7 @@ part of 'team.dart'; T _$identity(T value) => value; final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); Team _$TeamFromJson(Map json) { return _Team.fromJson(json); diff --git a/wrestling_scoreboard_common/lib/src/data/team_match/league.dart b/wrestling_scoreboard_common/lib/src/data/team_match/league.dart index 9fbb8995..5be6c8a7 100644 --- a/wrestling_scoreboard_common/lib/src/data/team_match/league.dart +++ b/wrestling_scoreboard_common/lib/src/data/team_match/league.dart @@ -9,8 +9,12 @@ part 'league.g.dart'; /// The league in which the team is bouting. @freezed class League with _$League implements DataObject { - static League outOfCompetition = - League(name: 'Out of competition', startDate: DateTime(DateTime.now().year), boutConfig: BoutConfig()); + static League outOfCompetition = League( + name: 'Out of competition', + startDate: DateTime(DateTime.now().year), + boutConfig: BoutConfig(), + seasonPartitions: 1, + ); const League._(); @@ -19,6 +23,7 @@ class League with _$League implements DataObject { required String name, required DateTime startDate, required BoutConfig boutConfig, + required int seasonPartitions, }) = _League; factory League.fromJson(Map json) => _$LeagueFromJson(json); @@ -29,6 +34,7 @@ class League with _$League implements DataObject { id: e['id'] as int?, name: e['name'] as String, startDate: e['start_date'] as DateTime, + seasonPartitions: e['season_partitions'] as int, boutConfig: boutConfig!, ); } @@ -40,6 +46,7 @@ class League with _$League implements DataObject { 'name': name, 'start_date': startDate, 'bout_config_id': boutConfig.id, + 'season_partitions': seasonPartitions, }; } 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 515eac52..c3875e66 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 @@ -12,7 +12,7 @@ part of 'league.dart'; T _$identity(T value) => value; final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); League _$LeagueFromJson(Map json) { return _League.fromJson(json); @@ -24,6 +24,7 @@ mixin _$League { String get name => throw _privateConstructorUsedError; DateTime get startDate => throw _privateConstructorUsedError; BoutConfig get boutConfig => throw _privateConstructorUsedError; + int get seasonPartitions => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) @@ -34,7 +35,7 @@ mixin _$League { abstract class $LeagueCopyWith<$Res> { factory $LeagueCopyWith(League value, $Res Function(League) then) = _$LeagueCopyWithImpl<$Res, League>; @useResult - $Res call({int? id, String name, DateTime startDate, BoutConfig boutConfig}); + $Res call({int? id, String name, DateTime startDate, BoutConfig boutConfig, int seasonPartitions}); $BoutConfigCopyWith<$Res> get boutConfig; } @@ -55,6 +56,7 @@ class _$LeagueCopyWithImpl<$Res, $Val extends League> implements $LeagueCopyWith Object? name = null, Object? startDate = null, Object? boutConfig = null, + Object? seasonPartitions = null, }) { return _then(_value.copyWith( id: freezed == id @@ -73,6 +75,10 @@ class _$LeagueCopyWithImpl<$Res, $Val extends League> implements $LeagueCopyWith ? _value.boutConfig : boutConfig // ignore: cast_nullable_to_non_nullable as BoutConfig, + seasonPartitions: null == seasonPartitions + ? _value.seasonPartitions + : seasonPartitions // ignore: cast_nullable_to_non_nullable + as int, ) as $Val); } @@ -91,7 +97,7 @@ abstract class _$$LeagueImplCopyWith<$Res> implements $LeagueCopyWith<$Res> { __$$LeagueImplCopyWithImpl<$Res>; @override @useResult - $Res call({int? id, String name, DateTime startDate, BoutConfig boutConfig}); + $Res call({int? id, String name, DateTime startDate, BoutConfig boutConfig, int seasonPartitions}); @override $BoutConfigCopyWith<$Res> get boutConfig; @@ -109,6 +115,7 @@ class __$$LeagueImplCopyWithImpl<$Res> extends _$LeagueCopyWithImpl<$Res, _$Leag Object? name = null, Object? startDate = null, Object? boutConfig = null, + Object? seasonPartitions = null, }) { return _then(_$LeagueImpl( id: freezed == id @@ -127,6 +134,10 @@ class __$$LeagueImplCopyWithImpl<$Res> extends _$LeagueCopyWithImpl<$Res, _$Leag ? _value.boutConfig : boutConfig // ignore: cast_nullable_to_non_nullable as BoutConfig, + seasonPartitions: null == seasonPartitions + ? _value.seasonPartitions + : seasonPartitions // ignore: cast_nullable_to_non_nullable + as int, )); } } @@ -134,7 +145,9 @@ class __$$LeagueImplCopyWithImpl<$Res> extends _$LeagueCopyWithImpl<$Res, _$Leag /// @nodoc @JsonSerializable() class _$LeagueImpl extends _League { - const _$LeagueImpl({this.id, required this.name, required this.startDate, required this.boutConfig}) : super._(); + const _$LeagueImpl( + {this.id, required this.name, required this.startDate, required this.boutConfig, required this.seasonPartitions}) + : super._(); factory _$LeagueImpl.fromJson(Map json) => _$$LeagueImplFromJson(json); @@ -146,10 +159,12 @@ class _$LeagueImpl extends _League { final DateTime startDate; @override final BoutConfig boutConfig; + @override + final int seasonPartitions; @override String toString() { - return 'League(id: $id, name: $name, startDate: $startDate, boutConfig: $boutConfig)'; + return 'League(id: $id, name: $name, startDate: $startDate, boutConfig: $boutConfig, seasonPartitions: $seasonPartitions)'; } @override @@ -160,12 +175,13 @@ class _$LeagueImpl extends _League { (identical(other.id, id) || other.id == id) && (identical(other.name, name) || other.name == name) && (identical(other.startDate, startDate) || other.startDate == startDate) && - (identical(other.boutConfig, boutConfig) || other.boutConfig == boutConfig)); + (identical(other.boutConfig, boutConfig) || other.boutConfig == boutConfig) && + (identical(other.seasonPartitions, seasonPartitions) || other.seasonPartitions == seasonPartitions)); } @JsonKey(ignore: true) @override - int get hashCode => Object.hash(runtimeType, id, name, startDate, boutConfig); + int get hashCode => Object.hash(runtimeType, id, name, startDate, boutConfig, seasonPartitions); @JsonKey(ignore: true) @override @@ -185,7 +201,8 @@ abstract class _League extends League { {final int? id, required final String name, required final DateTime startDate, - required final BoutConfig boutConfig}) = _$LeagueImpl; + required final BoutConfig boutConfig, + required final int seasonPartitions}) = _$LeagueImpl; const _League._() : super._(); factory _League.fromJson(Map json) = _$LeagueImpl.fromJson; @@ -199,6 +216,8 @@ abstract class _League extends League { @override BoutConfig get boutConfig; @override + int get seasonPartitions; + @override @JsonKey(ignore: true) _$$LeagueImplCopyWith<_$LeagueImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/wrestling_scoreboard_common/lib/src/data/team_match/league.g.dart b/wrestling_scoreboard_common/lib/src/data/team_match/league.g.dart index a79da856..a82317ef 100644 --- a/wrestling_scoreboard_common/lib/src/data/team_match/league.g.dart +++ b/wrestling_scoreboard_common/lib/src/data/team_match/league.g.dart @@ -11,6 +11,7 @@ _$LeagueImpl _$$LeagueImplFromJson(Map json) => _$LeagueImpl( name: json['name'] as String, startDate: DateTime.parse(json['startDate'] as String), boutConfig: BoutConfig.fromJson(json['boutConfig'] as Map), + seasonPartitions: json['seasonPartitions'] as int, ); Map _$$LeagueImplToJson(_$LeagueImpl instance) => { @@ -18,4 +19,5 @@ Map _$$LeagueImplToJson(_$LeagueImpl instance) => (T value) => value; final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); LeagueTeamParticipation _$LeagueTeamParticipationFromJson(Map json) { return _LeagueTeamParticipation.fromJson(json); diff --git a/wrestling_scoreboard_common/lib/src/data/team_match/league_weight_class.dart b/wrestling_scoreboard_common/lib/src/data/team_match/league_weight_class.dart index 814edb0f..45cb494a 100644 --- a/wrestling_scoreboard_common/lib/src/data/team_match/league_weight_class.dart +++ b/wrestling_scoreboard_common/lib/src/data/team_match/league_weight_class.dart @@ -16,6 +16,7 @@ class LeagueWeightClass with _$LeagueWeightClass implements DataObject { required int pos, required League league, required WeightClass weightClass, + int? seasonPartition, }) = _LeagueWeightClass; factory LeagueWeightClass.fromJson(Map json) => _$LeagueWeightClassFromJson(json); @@ -27,6 +28,7 @@ class LeagueWeightClass with _$LeagueWeightClass implements DataObject { 'pos': pos, 'league_id': league.id, 'weight_class_id': weightClass.id, + 'season_partition': seasonPartition, }; } @@ -35,7 +37,8 @@ class LeagueWeightClass with _$LeagueWeightClass implements DataObject { id: e['id'] as int?, league: (await getSingle(e['league_id'] as int))!, weightClass: (await getSingle(e['weight_class_id'] as int))!, - pos: e['pos'], + pos: e['pos'] as int, + seasonPartition: e['season_partition'] as int?, ); @override 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 417cffa6..68924b11 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 @@ -12,7 +12,7 @@ part of 'league_weight_class.dart'; T _$identity(T value) => value; final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); LeagueWeightClass _$LeagueWeightClassFromJson(Map json) { return _LeagueWeightClass.fromJson(json); @@ -24,6 +24,7 @@ mixin _$LeagueWeightClass { int get pos => throw _privateConstructorUsedError; League get league => throw _privateConstructorUsedError; WeightClass get weightClass => throw _privateConstructorUsedError; + int? get seasonPartition => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) @@ -35,7 +36,7 @@ abstract class $LeagueWeightClassCopyWith<$Res> { factory $LeagueWeightClassCopyWith(LeagueWeightClass value, $Res Function(LeagueWeightClass) then) = _$LeagueWeightClassCopyWithImpl<$Res, LeagueWeightClass>; @useResult - $Res call({int? id, int pos, League league, WeightClass weightClass}); + $Res call({int? id, int pos, League league, WeightClass weightClass, int? seasonPartition}); $LeagueCopyWith<$Res> get league; $WeightClassCopyWith<$Res> get weightClass; @@ -58,6 +59,7 @@ class _$LeagueWeightClassCopyWithImpl<$Res, $Val extends LeagueWeightClass> Object? pos = null, Object? league = null, Object? weightClass = null, + Object? seasonPartition = freezed, }) { return _then(_value.copyWith( id: freezed == id @@ -76,6 +78,10 @@ class _$LeagueWeightClassCopyWithImpl<$Res, $Val extends LeagueWeightClass> ? _value.weightClass : weightClass // ignore: cast_nullable_to_non_nullable as WeightClass, + seasonPartition: freezed == seasonPartition + ? _value.seasonPartition + : seasonPartition // ignore: cast_nullable_to_non_nullable + as int?, ) as $Val); } @@ -102,7 +108,7 @@ abstract class _$$LeagueWeightClassImplCopyWith<$Res> implements $LeagueWeightCl __$$LeagueWeightClassImplCopyWithImpl<$Res>; @override @useResult - $Res call({int? id, int pos, League league, WeightClass weightClass}); + $Res call({int? id, int pos, League league, WeightClass weightClass, int? seasonPartition}); @override $LeagueCopyWith<$Res> get league; @@ -123,6 +129,7 @@ class __$$LeagueWeightClassImplCopyWithImpl<$Res> extends _$LeagueWeightClassCop Object? pos = null, Object? league = null, Object? weightClass = null, + Object? seasonPartition = freezed, }) { return _then(_$LeagueWeightClassImpl( id: freezed == id @@ -141,6 +148,10 @@ class __$$LeagueWeightClassImplCopyWithImpl<$Res> extends _$LeagueWeightClassCop ? _value.weightClass : weightClass // ignore: cast_nullable_to_non_nullable as WeightClass, + seasonPartition: freezed == seasonPartition + ? _value.seasonPartition + : seasonPartition // ignore: cast_nullable_to_non_nullable + as int?, )); } } @@ -148,7 +159,8 @@ class __$$LeagueWeightClassImplCopyWithImpl<$Res> extends _$LeagueWeightClassCop /// @nodoc @JsonSerializable() class _$LeagueWeightClassImpl extends _LeagueWeightClass { - const _$LeagueWeightClassImpl({this.id, required this.pos, required this.league, required this.weightClass}) + const _$LeagueWeightClassImpl( + {this.id, required this.pos, required this.league, required this.weightClass, this.seasonPartition}) : super._(); factory _$LeagueWeightClassImpl.fromJson(Map json) => _$$LeagueWeightClassImplFromJson(json); @@ -161,10 +173,12 @@ class _$LeagueWeightClassImpl extends _LeagueWeightClass { final League league; @override final WeightClass weightClass; + @override + final int? seasonPartition; @override String toString() { - return 'LeagueWeightClass(id: $id, pos: $pos, league: $league, weightClass: $weightClass)'; + return 'LeagueWeightClass(id: $id, pos: $pos, league: $league, weightClass: $weightClass, seasonPartition: $seasonPartition)'; } @override @@ -175,12 +189,13 @@ class _$LeagueWeightClassImpl extends _LeagueWeightClass { (identical(other.id, id) || other.id == id) && (identical(other.pos, pos) || other.pos == pos) && (identical(other.league, league) || other.league == league) && - (identical(other.weightClass, weightClass) || other.weightClass == weightClass)); + (identical(other.weightClass, weightClass) || other.weightClass == weightClass) && + (identical(other.seasonPartition, seasonPartition) || other.seasonPartition == seasonPartition)); } @JsonKey(ignore: true) @override - int get hashCode => Object.hash(runtimeType, id, pos, league, weightClass); + int get hashCode => Object.hash(runtimeType, id, pos, league, weightClass, seasonPartition); @JsonKey(ignore: true) @override @@ -201,7 +216,8 @@ abstract class _LeagueWeightClass extends LeagueWeightClass { {final int? id, required final int pos, required final League league, - required final WeightClass weightClass}) = _$LeagueWeightClassImpl; + required final WeightClass weightClass, + final int? seasonPartition}) = _$LeagueWeightClassImpl; const _LeagueWeightClass._() : super._(); factory _LeagueWeightClass.fromJson(Map json) = _$LeagueWeightClassImpl.fromJson; @@ -215,6 +231,8 @@ abstract class _LeagueWeightClass extends LeagueWeightClass { @override WeightClass get weightClass; @override + int? get seasonPartition; + @override @JsonKey(ignore: true) _$$LeagueWeightClassImplCopyWith<_$LeagueWeightClassImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/wrestling_scoreboard_common/lib/src/data/team_match/league_weight_class.g.dart b/wrestling_scoreboard_common/lib/src/data/team_match/league_weight_class.g.dart index c8b39eef..42ca0a61 100644 --- a/wrestling_scoreboard_common/lib/src/data/team_match/league_weight_class.g.dart +++ b/wrestling_scoreboard_common/lib/src/data/team_match/league_weight_class.g.dart @@ -11,6 +11,7 @@ _$LeagueWeightClassImpl _$$LeagueWeightClassImplFromJson(Map js pos: json['pos'] as int, league: League.fromJson(json['league'] as Map), weightClass: WeightClass.fromJson(json['weightClass'] as Map), + seasonPartition: json['seasonPartition'] as int?, ); Map _$$LeagueWeightClassImplToJson(_$LeagueWeightClassImpl instance) => { @@ -18,4 +19,5 @@ Map _$$LeagueWeightClassImplToJson(_$LeagueWeightClassImpl inst 'pos': instance.pos, 'league': instance.league.toJson(), 'weightClass': instance.weightClass.toJson(), + 'seasonPartition': instance.seasonPartition, }; diff --git a/wrestling_scoreboard_common/lib/src/data/team_match/team_match.dart b/wrestling_scoreboard_common/lib/src/data/team_match/team_match.dart index 2abd86de..5db68254 100644 --- a/wrestling_scoreboard_common/lib/src/data/team_match/team_match.dart +++ b/wrestling_scoreboard_common/lib/src/data/team_match/team_match.dart @@ -24,6 +24,7 @@ class TeamMatch extends WrestlingEvent with _$TeamMatch { required Lineup home, required Lineup guest, League? league, + int? seasonPartition, Person? matChairman, Person? referee, Person? judge, @@ -68,6 +69,7 @@ class TeamMatch extends WrestlingEvent with _$TeamMatch { transcriptWriter: transcriptWriterId == null ? null : await getSingle(transcriptWriterId), timeKeeper: timeKeeperId == null ? null : await getSingle(timeKeeperId), league: leagueId == null ? null : await getSingle(leagueId), + seasonPartition: e['season_partition'] as int?, ); } @@ -78,6 +80,7 @@ class TeamMatch extends WrestlingEvent with _$TeamMatch { 'home_id': home.id, 'guest_id': guest.id, 'league_id': league?.id, + 'season_partition': seasonPartition, 'referee_id': referee?.id, 'judge_id': judge?.id, 'mat_chairman_id': matChairman?.id, 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 8f0220a2..855249fb 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 @@ -12,7 +12,7 @@ part of 'team_match.dart'; T _$identity(T value) => value; final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); TeamMatch _$TeamMatchFromJson(Map json) { return _TeamMatch.fromJson(json); @@ -24,6 +24,7 @@ mixin _$TeamMatch { Lineup get home => throw _privateConstructorUsedError; Lineup get guest => throw _privateConstructorUsedError; League? get league => throw _privateConstructorUsedError; + int? get seasonPartition => throw _privateConstructorUsedError; Person? get matChairman => throw _privateConstructorUsedError; Person? get referee => throw _privateConstructorUsedError; Person? get judge => throw _privateConstructorUsedError; @@ -49,6 +50,7 @@ abstract class $TeamMatchCopyWith<$Res> { Lineup home, Lineup guest, League? league, + int? seasonPartition, Person? matChairman, Person? referee, Person? judge, @@ -86,6 +88,7 @@ class _$TeamMatchCopyWithImpl<$Res, $Val extends TeamMatch> implements $TeamMatc Object? home = null, Object? guest = null, Object? league = freezed, + Object? seasonPartition = freezed, Object? matChairman = freezed, Object? referee = freezed, Object? judge = freezed, @@ -114,6 +117,10 @@ class _$TeamMatchCopyWithImpl<$Res, $Val extends TeamMatch> implements $TeamMatc ? _value.league : league // ignore: cast_nullable_to_non_nullable as League?, + seasonPartition: freezed == seasonPartition + ? _value.seasonPartition + : seasonPartition // ignore: cast_nullable_to_non_nullable + as int?, matChairman: freezed == matChairman ? _value.matChairman : matChairman // ignore: cast_nullable_to_non_nullable @@ -257,6 +264,7 @@ abstract class _$$TeamMatchImplCopyWith<$Res> implements $TeamMatchCopyWith<$Res Lineup home, Lineup guest, League? league, + int? seasonPartition, Person? matChairman, Person? referee, Person? judge, @@ -298,6 +306,7 @@ class __$$TeamMatchImplCopyWithImpl<$Res> extends _$TeamMatchCopyWithImpl<$Res, Object? home = null, Object? guest = null, Object? league = freezed, + Object? seasonPartition = freezed, Object? matChairman = freezed, Object? referee = freezed, Object? judge = freezed, @@ -326,6 +335,10 @@ class __$$TeamMatchImplCopyWithImpl<$Res> extends _$TeamMatchCopyWithImpl<$Res, ? _value.league : league // ignore: cast_nullable_to_non_nullable as League?, + seasonPartition: freezed == seasonPartition + ? _value.seasonPartition + : seasonPartition // ignore: cast_nullable_to_non_nullable + as int?, matChairman: freezed == matChairman ? _value.matChairman : matChairman // ignore: cast_nullable_to_non_nullable @@ -378,6 +391,7 @@ class _$TeamMatchImpl extends _TeamMatch { required this.home, required this.guest, this.league, + this.seasonPartition, this.matChairman, this.referee, this.judge, @@ -401,6 +415,8 @@ class _$TeamMatchImpl extends _TeamMatch { @override final League? league; @override + final int? seasonPartition; + @override final Person? matChairman; @override final Person? referee; @@ -423,7 +439,7 @@ class _$TeamMatchImpl extends _TeamMatch { @override String toString() { - return 'TeamMatch(id: $id, home: $home, guest: $guest, league: $league, matChairman: $matChairman, referee: $referee, judge: $judge, timeKeeper: $timeKeeper, transcriptWriter: $transcriptWriter, no: $no, location: $location, date: $date, visitorsCount: $visitorsCount, comment: $comment)'; + return 'TeamMatch(id: $id, home: $home, guest: $guest, league: $league, seasonPartition: $seasonPartition, matChairman: $matChairman, referee: $referee, judge: $judge, timeKeeper: $timeKeeper, transcriptWriter: $transcriptWriter, no: $no, location: $location, date: $date, visitorsCount: $visitorsCount, comment: $comment)'; } @override @@ -435,6 +451,7 @@ class _$TeamMatchImpl extends _TeamMatch { (identical(other.home, home) || other.home == home) && (identical(other.guest, guest) || other.guest == guest) && (identical(other.league, league) || other.league == league) && + (identical(other.seasonPartition, seasonPartition) || other.seasonPartition == seasonPartition) && (identical(other.matChairman, matChairman) || other.matChairman == matChairman) && (identical(other.referee, referee) || other.referee == referee) && (identical(other.judge, judge) || other.judge == judge) && @@ -449,8 +466,8 @@ class _$TeamMatchImpl extends _TeamMatch { @JsonKey(ignore: true) @override - int get hashCode => Object.hash(runtimeType, id, home, guest, league, matChairman, referee, judge, timeKeeper, - transcriptWriter, no, location, date, visitorsCount, comment); + int get hashCode => Object.hash(runtimeType, id, home, guest, league, seasonPartition, matChairman, referee, judge, + timeKeeper, transcriptWriter, no, location, date, visitorsCount, comment); @JsonKey(ignore: true) @override @@ -472,6 +489,7 @@ abstract class _TeamMatch extends TeamMatch { required final Lineup home, required final Lineup guest, final League? league, + final int? seasonPartition, final Person? matChairman, final Person? referee, final Person? judge, @@ -495,6 +513,8 @@ abstract class _TeamMatch extends TeamMatch { @override League? get league; @override + int? get seasonPartition; + @override Person? get matChairman; @override Person? get referee; diff --git a/wrestling_scoreboard_common/lib/src/data/team_match/team_match.g.dart b/wrestling_scoreboard_common/lib/src/data/team_match/team_match.g.dart index 36c5d371..332c6538 100644 --- a/wrestling_scoreboard_common/lib/src/data/team_match/team_match.g.dart +++ b/wrestling_scoreboard_common/lib/src/data/team_match/team_match.g.dart @@ -11,6 +11,7 @@ _$TeamMatchImpl _$$TeamMatchImplFromJson(Map json) => _$TeamMat home: Lineup.fromJson(json['home'] as Map), guest: Lineup.fromJson(json['guest'] as Map), league: json['league'] == null ? null : League.fromJson(json['league'] as Map), + seasonPartition: json['seasonPartition'] as int?, matChairman: json['matChairman'] == null ? null : Person.fromJson(json['matChairman'] as Map), referee: json['referee'] == null ? null : Person.fromJson(json['referee'] as Map), judge: json['judge'] == null ? null : Person.fromJson(json['judge'] as Map), @@ -29,6 +30,7 @@ Map _$$TeamMatchImplToJson(_$TeamMatchImpl instance) => (T value) => value; final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); TeamMatchBout _$TeamMatchBoutFromJson(Map json) { return _TeamMatchBout.fromJson(json); diff --git a/wrestling_scoreboard_common/lib/src/data/weight_class.freezed.dart b/wrestling_scoreboard_common/lib/src/data/weight_class.freezed.dart index 194f90c4..02a7a251 100644 --- a/wrestling_scoreboard_common/lib/src/data/weight_class.freezed.dart +++ b/wrestling_scoreboard_common/lib/src/data/weight_class.freezed.dart @@ -12,7 +12,7 @@ part of 'weight_class.dart'; T _$identity(T value) => value; final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); WeightClass _$WeightClassFromJson(Map json) { return _WeightClass.fromJson(json); diff --git a/wrestling_scoreboard_server/database/README.md b/wrestling_scoreboard_server/database/README.md index 7d71119d..f32da0ab 100644 --- a/wrestling_scoreboard_server/database/README.md +++ b/wrestling_scoreboard_server/database/README.md @@ -15,7 +15,7 @@ sudo apt install postgresql-client-common sudo apt-get install postgresql-client ``` -On Linux you may want to login as postgres user: `sudo -u postgres -i` +On Linux you may want to log in as postgres user: `sudo -u postgres -i` #### Tipps: 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 acce9b38..c126d5c3 100644 --- a/wrestling_scoreboard_server/database/dump/PostgreSQL-wrestling_scoreboard-dump.sql +++ b/wrestling_scoreboard_server/database/dump/PostgreSQL-wrestling_scoreboard-dump.sql @@ -2,8 +2,8 @@ -- PostgreSQL database dump -- --- Dumped from database version 16.1 --- Dumped by pg_dump version 16.1 +-- Dumped from database version 13.6 (Ubuntu 13.6-0ubuntu0.21.10.1) +-- Dumped by pg_dump version 15.6 (Ubuntu 15.6-0ubuntu0.23.10.1) SET statement_timeout = 0; SET lock_timeout = 0; @@ -42,7 +42,7 @@ CREATE TYPE public.bout_action_type AS ENUM ( 'verbal', 'caution', 'dismissal' -); + ); ALTER TYPE public.bout_action_type OWNER TO wrestling; @@ -62,7 +62,7 @@ CREATE TYPE public.bout_result AS ENUM ( 'vfo', 'dsq', 'dsq2' -); + ); ALTER TYPE public.bout_result OWNER TO wrestling; @@ -74,7 +74,7 @@ ALTER TYPE public.bout_result OWNER TO wrestling; CREATE TYPE public.bout_role AS ENUM ( 'red', 'blue' -); + ); ALTER TYPE public.bout_role OWNER TO wrestling; @@ -87,7 +87,7 @@ CREATE TYPE public.gender AS ENUM ( 'male', 'female', 'other' -); + ); ALTER TYPE public.gender OWNER TO wrestling; @@ -102,7 +102,7 @@ CREATE TYPE public.person_role AS ENUM ( 'timeKeeper', 'matPresident', 'steward' -); + ); ALTER TYPE public.person_role OWNER TO wrestling; @@ -114,7 +114,7 @@ ALTER TYPE public.person_role OWNER TO wrestling; CREATE TYPE public.weight_unit AS ENUM ( 'pound', 'kilogram' -); + ); ALTER TYPE public.weight_unit OWNER TO wrestling; @@ -126,7 +126,7 @@ ALTER TYPE public.weight_unit OWNER TO wrestling; CREATE TYPE public.wrestling_style AS ENUM ( 'free', 'greco' -); + ); ALTER TYPE public.wrestling_style OWNER TO wrestling; @@ -140,13 +140,13 @@ SET default_table_access_method = heap; -- 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 + 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 ); @@ -157,12 +157,12 @@ ALTER TABLE public.bout OWNER TO 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 + 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 ); @@ -181,7 +181,7 @@ CREATE SEQUENCE public.bout_action_id_seq CACHE 1; -ALTER SEQUENCE public.bout_action_id_seq OWNER TO wrestling; +ALTER TABLE public.bout_action_id_seq OWNER TO wrestling; -- -- Name: bout_action_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: wrestling @@ -195,12 +195,12 @@ ALTER SEQUENCE public.bout_action_id_seq OWNED BY public.bout_action.id; -- CREATE TABLE public.bout_config ( - id integer NOT NULL, - period_duration_secs integer, - break_duration_secs integer, - activity_duration_secs integer, - injury_duration_secs integer, - period_count smallint + id integer NOT NULL, + period_duration_secs integer, + break_duration_secs integer, + activity_duration_secs integer, + injury_duration_secs integer, + period_count smallint ); @@ -219,7 +219,7 @@ CREATE SEQUENCE public.bout_config_id_seq CACHE 1; -ALTER SEQUENCE public.bout_config_id_seq OWNER TO wrestling; +ALTER TABLE public.bout_config_id_seq OWNER TO wrestling; -- -- Name: bout_config_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: wrestling @@ -241,7 +241,7 @@ CREATE SEQUENCE public.bout_id_seq CACHE 1; -ALTER SEQUENCE public.bout_id_seq OWNER TO wrestling; +ALTER TABLE public.bout_id_seq OWNER TO wrestling; -- -- Name: bout_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: wrestling @@ -255,9 +255,9 @@ ALTER SEQUENCE public.bout_id_seq OWNED BY public.bout.id; -- CREATE TABLE public.club ( - id integer NOT NULL, - no character varying(8), - name character varying(255) NOT NULL + id integer NOT NULL, + no character varying(8), + name character varying(255) NOT NULL ); @@ -276,7 +276,7 @@ CREATE SEQUENCE public.club_id_seq CACHE 1; -ALTER SEQUENCE public.club_id_seq OWNER TO wrestling; +ALTER TABLE public.club_id_seq OWNER TO wrestling; -- -- Name: club_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: wrestling @@ -290,12 +290,12 @@ ALTER SEQUENCE public.club_id_seq OWNED BY public.club.id; -- CREATE TABLE public.wrestling_event ( - id integer NOT NULL, - date date, - location character varying(100), - visitors_count integer, - comment text, - no character varying(16) + id integer NOT NULL, + date date, + location character varying(100), + visitors_count integer, + comment text, + no character varying(16) ); @@ -306,10 +306,10 @@ ALTER TABLE public.wrestling_event OWNER TO wrestling; -- CREATE TABLE public.competition ( - name character varying(127), - bout_config_id integer NOT NULL + name character varying(127), + bout_config_id integer NOT NULL ) -INHERITS (public.wrestling_event); + INHERITS (public.wrestling_event); ALTER TABLE public.competition OWNER TO wrestling; @@ -319,9 +319,9 @@ ALTER TABLE public.competition OWNER TO wrestling; -- CREATE TABLE public.competition_bout ( - id integer NOT NULL, - competition_id integer NOT NULL, - bout_id integer + id integer NOT NULL, + competition_id integer NOT NULL, + bout_id integer ); @@ -340,7 +340,7 @@ CREATE SEQUENCE public.competition_bout_id_seq CACHE 1; -ALTER SEQUENCE public.competition_bout_id_seq OWNER TO wrestling; +ALTER TABLE public.competition_bout_id_seq OWNER TO wrestling; -- -- Name: competition_bout_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: wrestling @@ -362,7 +362,7 @@ CREATE SEQUENCE public.competition_id_seq CACHE 1; -ALTER SEQUENCE public.competition_id_seq OWNER TO wrestling; +ALTER TABLE public.competition_id_seq OWNER TO wrestling; -- -- Name: competition_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: wrestling @@ -376,10 +376,10 @@ ALTER SEQUENCE public.competition_id_seq OWNED BY public.competition.id; -- CREATE TABLE public.competition_person ( - id integer NOT NULL, - competition_id integer NOT NULL, - person_id integer NOT NULL, - person_role public.person_role + id integer NOT NULL, + competition_id integer NOT NULL, + person_id integer NOT NULL, + person_role public.person_role ); @@ -398,7 +398,7 @@ CREATE SEQUENCE public.event_person_id_seq CACHE 1; -ALTER SEQUENCE public.event_person_id_seq OWNER TO wrestling; +ALTER TABLE public.event_person_id_seq OWNER TO wrestling; -- -- Name: event_person_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: wrestling @@ -412,10 +412,11 @@ ALTER SEQUENCE public.event_person_id_seq OWNED BY public.competition_person.id; -- CREATE TABLE public.league ( - id integer NOT NULL, - name character varying(127) NOT NULL, - start_date date NOT NULL, - bout_config_id integer NOT NULL + id integer NOT NULL, + name character varying(127) NOT NULL, + start_date date NOT NULL, + bout_config_id integer NOT NULL, + season_partitions integer DEFAULT 1 NOT NULL ); @@ -434,7 +435,7 @@ CREATE SEQUENCE public.league_id_seq CACHE 1; -ALTER SEQUENCE public.league_id_seq OWNER TO wrestling; +ALTER TABLE public.league_id_seq OWNER TO wrestling; -- -- Name: league_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: wrestling @@ -448,9 +449,9 @@ ALTER SEQUENCE public.league_id_seq OWNED BY public.league.id; -- CREATE TABLE public.league_team_participation ( - id integer NOT NULL, - league_id integer NOT NULL, - team_id integer NOT NULL + id integer NOT NULL, + league_id integer NOT NULL, + team_id integer NOT NULL ); @@ -469,7 +470,7 @@ CREATE SEQUENCE public.league_team_participation_id_seq CACHE 1; -ALTER SEQUENCE public.league_team_participation_id_seq OWNER TO wrestling; +ALTER TABLE public.league_team_participation_id_seq OWNER TO wrestling; -- -- Name: league_team_participation_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: wrestling @@ -483,10 +484,11 @@ ALTER SEQUENCE public.league_team_participation_id_seq OWNED BY public.league_te -- CREATE TABLE public.league_weight_class ( - id integer NOT NULL, - league_id integer NOT NULL, - weight_class_id integer NOT NULL, - pos integer DEFAULT 0 NOT NULL + id integer NOT NULL, + league_id integer NOT NULL, + weight_class_id integer NOT NULL, + pos integer DEFAULT 0 NOT NULL, + season_partition integer ); @@ -505,7 +507,7 @@ CREATE SEQUENCE public.league_weight_class_id_seq CACHE 1; -ALTER SEQUENCE public.league_weight_class_id_seq OWNER TO wrestling; +ALTER TABLE public.league_weight_class_id_seq OWNER TO wrestling; -- -- Name: league_weight_class_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: wrestling @@ -519,10 +521,10 @@ ALTER SEQUENCE public.league_weight_class_id_seq OWNED BY public.league_weight_c -- CREATE TABLE public.lineup ( - id integer NOT NULL, - team_id integer, - leader_id integer, - coach_id integer + id integer NOT NULL, + team_id integer, + leader_id integer, + coach_id integer ); @@ -541,7 +543,7 @@ CREATE SEQUENCE public.lineup_id_seq CACHE 1; -ALTER SEQUENCE public.lineup_id_seq OWNER TO wrestling; +ALTER TABLE public.lineup_id_seq OWNER TO wrestling; -- -- Name: lineup_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: wrestling @@ -555,10 +557,10 @@ ALTER SEQUENCE public.lineup_id_seq OWNED BY public.lineup.id; -- CREATE TABLE public.membership ( - id integer NOT NULL, - person_id integer NOT NULL, - club_id integer NOT NULL, - no character varying(55) + id integer NOT NULL, + person_id integer NOT NULL, + club_id integer NOT NULL, + no character varying(55) ); @@ -577,7 +579,7 @@ CREATE SEQUENCE public.membership_id_seq CACHE 1; -ALTER SEQUENCE public.membership_id_seq OWNER TO wrestling; +ALTER TABLE public.membership_id_seq OWNER TO wrestling; -- -- Name: membership_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: wrestling @@ -591,9 +593,9 @@ ALTER SEQUENCE public.membership_id_seq OWNED BY public.membership.id; -- CREATE TABLE public.participant_state ( - id integer NOT NULL, - participation_id integer NOT NULL, - classification_points smallint + id integer NOT NULL, + participation_id integer NOT NULL, + classification_points smallint ); @@ -612,7 +614,7 @@ CREATE SEQUENCE public.participant_state_id_seq CACHE 1; -ALTER SEQUENCE public.participant_state_id_seq OWNER TO wrestling; +ALTER TABLE public.participant_state_id_seq OWNER TO wrestling; -- -- Name: participant_state_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: wrestling @@ -626,11 +628,11 @@ ALTER SEQUENCE public.participant_state_id_seq OWNED BY public.participant_state -- CREATE TABLE public.participation ( - id integer NOT NULL, - membership_id integer NOT NULL, - lineup_id integer NOT NULL, - weight_class_id integer, - weight numeric(5,2) + id integer NOT NULL, + membership_id integer NOT NULL, + lineup_id integer NOT NULL, + weight_class_id integer, + weight numeric(5,2) ); @@ -649,7 +651,7 @@ CREATE SEQUENCE public.participation_id_seq CACHE 1; -ALTER SEQUENCE public.participation_id_seq OWNER TO wrestling; +ALTER TABLE public.participation_id_seq OWNER TO wrestling; -- -- Name: participation_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: wrestling @@ -663,11 +665,11 @@ ALTER SEQUENCE public.participation_id_seq OWNED BY public.participation.id; -- CREATE TABLE public.person ( - id integer NOT NULL, - prename character varying(100) NOT NULL, - surname character varying(100) NOT NULL, - birth_date date, - gender public.gender + id integer NOT NULL, + prename character varying(100) NOT NULL, + surname character varying(100) NOT NULL, + birth_date date, + gender public.gender ); @@ -686,7 +688,7 @@ CREATE SEQUENCE public.person_id_seq CACHE 1; -ALTER SEQUENCE public.person_id_seq OWNER TO wrestling; +ALTER TABLE public.person_id_seq OWNER TO wrestling; -- -- Name: person_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: wrestling @@ -700,10 +702,10 @@ ALTER SEQUENCE public.person_id_seq OWNED BY public.person.id; -- CREATE TABLE public.team ( - id integer NOT NULL, - name character varying(100) NOT NULL, - description character varying(255), - club_id integer NOT NULL + id integer NOT NULL, + name character varying(100) NOT NULL, + description character varying(255), + club_id integer NOT NULL ); @@ -722,7 +724,7 @@ CREATE SEQUENCE public.team_id_seq CACHE 1; -ALTER SEQUENCE public.team_id_seq OWNER TO wrestling; +ALTER TABLE public.team_id_seq OWNER TO wrestling; -- -- Name: team_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: wrestling @@ -736,21 +738,22 @@ ALTER SEQUENCE public.team_id_seq OWNED BY public.team.id; -- CREATE TABLE public.team_match ( - id integer, - date date, - location character varying(100), - visitors_count integer, - comment text, - home_id integer, - guest_id integer, - referee_id integer, - transcript_writer_id integer, - time_keeper_id integer, - mat_chairman_id integer, - league_id integer, - judge_id integer + id integer, + date date, + location character varying(100), + visitors_count integer, + comment text, + home_id integer, + guest_id integer, + referee_id integer, + transcript_writer_id integer, + time_keeper_id integer, + mat_chairman_id integer, + league_id integer, + judge_id integer, + season_partition integer ) -INHERITS (public.wrestling_event); + INHERITS (public.wrestling_event); ALTER TABLE public.team_match OWNER TO wrestling; @@ -760,10 +763,10 @@ ALTER TABLE public.team_match OWNER TO wrestling; -- CREATE TABLE public.team_match_bout ( - id integer NOT NULL, - team_match_id integer NOT NULL, - bout_id integer NOT NULL, - pos integer DEFAULT 0 NOT NULL + id integer NOT NULL, + team_match_id integer NOT NULL, + bout_id integer NOT NULL, + pos integer DEFAULT 0 NOT NULL ); @@ -782,7 +785,7 @@ CREATE SEQUENCE public.team_match_bout_id_seq CACHE 1; -ALTER SEQUENCE public.team_match_bout_id_seq OWNER TO wrestling; +ALTER TABLE public.team_match_bout_id_seq OWNER TO wrestling; -- -- Name: team_match_bout_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: wrestling @@ -804,7 +807,7 @@ CREATE SEQUENCE public.team_match_id_seq CACHE 1; -ALTER SEQUENCE public.team_match_id_seq OWNER TO wrestling; +ALTER TABLE public.team_match_id_seq OWNER TO wrestling; -- -- Name: team_match_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: wrestling @@ -818,11 +821,11 @@ ALTER SEQUENCE public.team_match_id_seq OWNED BY public.team_match.id; -- CREATE TABLE public.weight_class ( - id integer NOT NULL, - suffix character varying(255), - weight smallint NOT NULL, - style public.wrestling_style DEFAULT 'free'::public.wrestling_style NOT NULL, - unit public.weight_unit + id integer NOT NULL, + suffix character varying(255), + weight smallint NOT NULL, + style public.wrestling_style DEFAULT 'free'::public.wrestling_style NOT NULL, + unit public.weight_unit ); @@ -841,7 +844,7 @@ CREATE SEQUENCE public.weight_class_id_seq CACHE 1; -ALTER SEQUENCE public.weight_class_id_seq OWNER TO wrestling; +ALTER TABLE public.weight_class_id_seq OWNER TO wrestling; -- -- Name: weight_class_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: wrestling @@ -863,7 +866,7 @@ CREATE SEQUENCE public.wrestling_event_id_seq CACHE 1; -ALTER SEQUENCE public.wrestling_event_id_seq OWNER TO wrestling; +ALTER TABLE public.wrestling_event_id_seq OWNER TO wrestling; -- -- Name: wrestling_event_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: wrestling @@ -1086,10 +1089,10 @@ COPY public.competition_person (id, competition_id, person_id, person_role) FROM -- Data for Name: league; Type: TABLE DATA; Schema: public; Owner: wrestling -- -COPY public.league (id, name, start_date, bout_config_id) FROM stdin; -2 Real Pro Wrestling Jn 2021-10-01 1 -3 National League 2021-10-01 1 -1 Real Pro Wrestling 2021-10-01 1 +COPY public.league (id, name, start_date, bout_config_id, season_partitions) FROM stdin; +2 Real Pro Wrestling Jn 2021-10-01 1 1 +3 National League 2021-10-01 1 2 +1 Real Pro Wrestling 2021-10-01 1 3 \. @@ -1110,14 +1113,14 @@ COPY public.league_team_participation (id, league_id, team_id) FROM stdin; -- Data for Name: league_weight_class; Type: TABLE DATA; Schema: public; Owner: wrestling -- -COPY public.league_weight_class (id, league_id, weight_class_id, pos) FROM stdin; -1 1 1 1 -2 1 3 3 -3 1 4 4 -4 1 7 7 -5 1 2 2 -6 1 10 10 -7 2 1 5 +COPY public.league_weight_class (id, league_id, weight_class_id, pos, season_partition) FROM stdin; +1 1 1 1 \N +2 1 3 3 \N +3 1 4 4 \N +4 1 7 7 \N +5 1 2 2 \N +6 1 10 10 \N +7 2 1 5 \N \. @@ -1213,8 +1216,8 @@ COPY public.team (id, name, description, club_id) FROM stdin; -- Data for Name: team_match; Type: TABLE DATA; Schema: public; Owner: wrestling -- -COPY public.team_match (id, date, location, visitors_count, comment, no, home_id, guest_id, referee_id, transcript_writer_id, time_keeper_id, mat_chairman_id, league_id, judge_id) FROM stdin; -1 2021-07-10 Springfield \N \N \N 1 2 9 \N \N \N 1 \N +COPY public.team_match (id, date, location, visitors_count, comment, no, home_id, guest_id, referee_id, transcript_writer_id, time_keeper_id, mat_chairman_id, league_id, judge_id, season_partition) FROM stdin; +1 2021-07-10 Springfield \N \N 1 2 \N \N \N \N 1 \N 1 \. diff --git a/wrestling_scoreboard_server/lib/controllers/league_controller.dart b/wrestling_scoreboard_server/lib/controllers/league_controller.dart index b1d294c4..6f10a8b4 100644 --- a/wrestling_scoreboard_server/lib/controllers/league_controller.dart +++ b/wrestling_scoreboard_server/lib/controllers/league_controller.dart @@ -1,3 +1,4 @@ +import 'package:shelf/shelf.dart'; import 'package:wrestling_scoreboard_common/common.dart'; import 'package:wrestling_scoreboard_server/controllers/entity_controller.dart'; import 'package:wrestling_scoreboard_server/controllers/league_team_participation_controller.dart'; @@ -5,7 +6,6 @@ import 'package:wrestling_scoreboard_server/controllers/league_weight_class_cont import 'package:wrestling_scoreboard_server/controllers/team_controller.dart'; import 'package:wrestling_scoreboard_server/controllers/team_match_controller.dart'; import 'package:wrestling_scoreboard_server/controllers/weight_class_controller.dart'; -import 'package:shelf/shelf.dart'; class LeagueController extends EntityController { static final LeagueController _singleton = LeagueController._internal(); @@ -21,25 +21,31 @@ class LeagueController extends EntityController { isRaw: isRaw(request), conditions: ['league_id = @id'], substitutionValues: {'id': id}); } - static const _weightClassesQuery = ''' + static String _weightClassesQuery(bool filterBySeasonPartition) => ''' SELECT wc.* FROM weight_class as wc JOIN league_weight_class AS lwc ON lwc.weight_class_id = wc.id - WHERE lwc.league_id = @id + WHERE lwc.league_id = @id ${filterBySeasonPartition ? 'AND lwc.season_partition = @season_partition' : ''} ORDER BY lwc.pos;'''; Future requestWeightClasses(Request request, String id) async { return EntityController.handleRequestManyOfControllerFromQuery(WeightClassController(), - isRaw: isRaw(request), sqlQuery: _weightClassesQuery, substitutionValues: {'id': id}); + isRaw: isRaw(request), sqlQuery: _weightClassesQuery(false), substitutionValues: {'id': id}); } - Future> getWeightClasses(String id) { - return WeightClassController().getManyFromQuery(_weightClassesQuery, substitutionValues: {'id': id}); + Future> getWeightClasses(String id, {int? seasonPartition}) { + return WeightClassController().getManyFromQuery(_weightClassesQuery(seasonPartition != null), substitutionValues: { + 'id': id, + if (seasonPartition != null) 'season_partition': seasonPartition, + }); } Future requestLeagueWeightClasses(Request request, String id) async { return EntityController.handleRequestManyOfController(LeagueWeightClassController(), - isRaw: isRaw(request), conditions: ['league_id = @id'], substitutionValues: {'id': id}, orderBy: ['pos']); + isRaw: isRaw(request), + conditions: ['league_id = @id'], + substitutionValues: {'id': id}, + orderBy: ['season_partition', 'pos']); } Future requestLeagueTeamParticipations(Request request, String id) async { diff --git a/wrestling_scoreboard_server/lib/controllers/team_match_controller.dart b/wrestling_scoreboard_server/lib/controllers/team_match_controller.dart index 64f471ac..b161f83f 100644 --- a/wrestling_scoreboard_server/lib/controllers/team_match_controller.dart +++ b/wrestling_scoreboard_server/lib/controllers/team_match_controller.dart @@ -50,7 +50,8 @@ class TeamMatchController extends EntityController { final oldBouts = (await getBouts(id)); final weightClasses = teamMatch.league?.id == null ? [] - : (await LeagueController().getWeightClasses(teamMatch.league!.id.toString())); + : (await LeagueController() + .getWeightClasses(teamMatch.league!.id.toString(), seasonPartition: teamMatch.seasonPartition)); final homeParticipations = await ParticipationController() .getMany(conditions: ['lineup_id = @id'], substitutionValues: {'id': teamMatch.home.id}); final guestParticipations = await ParticipationController()