Skip to content

Commit

Permalink
Handle test match format (#83)
Browse files Browse the repository at this point in the history
* score test match

* fix abandon tag

* fix btn enabled without admin selection

* fix lint

* handle test format in match detail

* fix third inning is glitch

* give default val to status

* change need run string for test match

* fix loading issue

* rename identifier
  • Loading branch information
cp-sidhdhi-p authored Aug 21, 2024
1 parent d0decfd commit f4d171d
Show file tree
Hide file tree
Showing 34 changed files with 1,192 additions and 572 deletions.
1 change: 0 additions & 1 deletion .github/workflows/ios_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ jobs:
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.22.2'
channel: 'stable'
cache: true

Expand Down
2 changes: 1 addition & 1 deletion data/.flutter-plugins
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ firebase_core=/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/firebase_core-3.1.1/
firebase_core_web=/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/firebase_core_web-2.17.2/
firebase_storage=/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/firebase_storage-12.1.0/
firebase_storage_web=/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/firebase_storage_web-3.9.10/
flutter_timezone=/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/flutter_timezone-2.0.0/
flutter_timezone=/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/flutter_timezone-2.0.1/
package_info_plus=/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/package_info_plus-8.0.0/
path_provider_linux=/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/
path_provider_windows=/Users/sidhdhi.p/.pub-cache/hosted/pub.dev/path_provider_windows-2.2.1/
Expand Down
2 changes: 1 addition & 1 deletion data/.flutter-plugins-dependencies

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion data/lib/api/innings/inning_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ part 'inning_model.g.dart';
@freezed
class InningModel with _$InningModel {
const factory InningModel({
String? id,
required String id,
required String match_id,
required String team_id,
@Default(0) double overs,
@Default(0) int index,
@Default(0) int total_runs,
@Default(0) int total_wickets,
InningStatus? innings_status,
Expand Down
51 changes: 36 additions & 15 deletions data/lib/api/innings/inning_model.freezed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ InningModel _$InningModelFromJson(Map<String, dynamic> json) {

/// @nodoc
mixin _$InningModel {
String? get id => throw _privateConstructorUsedError;
String get id => throw _privateConstructorUsedError;
String get match_id => throw _privateConstructorUsedError;
String get team_id => throw _privateConstructorUsedError;
double get overs => throw _privateConstructorUsedError;
int get index => throw _privateConstructorUsedError;
int get total_runs => throw _privateConstructorUsedError;
int get total_wickets => throw _privateConstructorUsedError;
InningStatus? get innings_status => throw _privateConstructorUsedError;
Expand All @@ -41,10 +42,11 @@ abstract class $InningModelCopyWith<$Res> {
_$InningModelCopyWithImpl<$Res, InningModel>;
@useResult
$Res call(
{String? id,
{String id,
String match_id,
String team_id,
double overs,
int index,
int total_runs,
int total_wickets,
InningStatus? innings_status});
Expand All @@ -63,19 +65,20 @@ class _$InningModelCopyWithImpl<$Res, $Val extends InningModel>
@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = freezed,
Object? id = null,
Object? match_id = null,
Object? team_id = null,
Object? overs = null,
Object? index = null,
Object? total_runs = null,
Object? total_wickets = null,
Object? innings_status = freezed,
}) {
return _then(_value.copyWith(
id: freezed == id
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String?,
as String,
match_id: null == match_id
? _value.match_id
: match_id // ignore: cast_nullable_to_non_nullable
Expand All @@ -88,6 +91,10 @@ class _$InningModelCopyWithImpl<$Res, $Val extends InningModel>
? _value.overs
: overs // ignore: cast_nullable_to_non_nullable
as double,
index: null == index
? _value.index
: index // ignore: cast_nullable_to_non_nullable
as int,
total_runs: null == total_runs
? _value.total_runs
: total_runs // ignore: cast_nullable_to_non_nullable
Expand All @@ -113,10 +120,11 @@ abstract class _$$InningModelImplCopyWith<$Res>
@override
@useResult
$Res call(
{String? id,
{String id,
String match_id,
String team_id,
double overs,
int index,
int total_runs,
int total_wickets,
InningStatus? innings_status});
Expand All @@ -133,19 +141,20 @@ class __$$InningModelImplCopyWithImpl<$Res>
@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = freezed,
Object? id = null,
Object? match_id = null,
Object? team_id = null,
Object? overs = null,
Object? index = null,
Object? total_runs = null,
Object? total_wickets = null,
Object? innings_status = freezed,
}) {
return _then(_$InningModelImpl(
id: freezed == id
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String?,
as String,
match_id: null == match_id
? _value.match_id
: match_id // ignore: cast_nullable_to_non_nullable
Expand All @@ -158,6 +167,10 @@ class __$$InningModelImplCopyWithImpl<$Res>
? _value.overs
: overs // ignore: cast_nullable_to_non_nullable
as double,
index: null == index
? _value.index
: index // ignore: cast_nullable_to_non_nullable
as int,
total_runs: null == total_runs
? _value.total_runs
: total_runs // ignore: cast_nullable_to_non_nullable
Expand All @@ -178,10 +191,11 @@ class __$$InningModelImplCopyWithImpl<$Res>
@JsonSerializable()
class _$InningModelImpl implements _InningModel {
const _$InningModelImpl(
{this.id,
{required this.id,
required this.match_id,
required this.team_id,
this.overs = 0,
this.index = 0,
this.total_runs = 0,
this.total_wickets = 0,
this.innings_status});
Expand All @@ -190,7 +204,7 @@ class _$InningModelImpl implements _InningModel {
_$$InningModelImplFromJson(json);

@override
final String? id;
final String id;
@override
final String match_id;
@override
Expand All @@ -200,6 +214,9 @@ class _$InningModelImpl implements _InningModel {
final double overs;
@override
@JsonKey()
final int index;
@override
@JsonKey()
final int total_runs;
@override
@JsonKey()
Expand All @@ -209,7 +226,7 @@ class _$InningModelImpl implements _InningModel {

@override
String toString() {
return 'InningModel(id: $id, match_id: $match_id, team_id: $team_id, overs: $overs, total_runs: $total_runs, total_wickets: $total_wickets, innings_status: $innings_status)';
return 'InningModel(id: $id, match_id: $match_id, team_id: $team_id, overs: $overs, index: $index, total_runs: $total_runs, total_wickets: $total_wickets, innings_status: $innings_status)';
}

@override
Expand All @@ -222,6 +239,7 @@ class _$InningModelImpl implements _InningModel {
other.match_id == match_id) &&
(identical(other.team_id, team_id) || other.team_id == team_id) &&
(identical(other.overs, overs) || other.overs == overs) &&
(identical(other.index, index) || other.index == index) &&
(identical(other.total_runs, total_runs) ||
other.total_runs == total_runs) &&
(identical(other.total_wickets, total_wickets) ||
Expand All @@ -233,7 +251,7 @@ class _$InningModelImpl implements _InningModel {
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(runtimeType, id, match_id, team_id, overs,
total_runs, total_wickets, innings_status);
index, total_runs, total_wickets, innings_status);

@JsonKey(ignore: true)
@override
Expand All @@ -251,10 +269,11 @@ class _$InningModelImpl implements _InningModel {

abstract class _InningModel implements InningModel {
const factory _InningModel(
{final String? id,
{required final String id,
required final String match_id,
required final String team_id,
final double overs,
final int index,
final int total_runs,
final int total_wickets,
final InningStatus? innings_status}) = _$InningModelImpl;
Expand All @@ -263,14 +282,16 @@ abstract class _InningModel implements InningModel {
_$InningModelImpl.fromJson;

@override
String? get id;
String get id;
@override
String get match_id;
@override
String get team_id;
@override
double get overs;
@override
int get index;
@override
int get total_runs;
@override
int get total_wickets;
Expand Down
4 changes: 3 additions & 1 deletion data/lib/api/innings/inning_model.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 16 additions & 4 deletions data/lib/api/match/match_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,25 @@ class MatchResult {
class MatchPlayer with _$MatchPlayer {
const factory MatchPlayer({
required UserModel player,
PlayerStatus? status,
int? index,
@Default([]) List<PlayerPerformance> performance,
}) = _MatchPlayer;

factory MatchPlayer.fromJson(Map<String, dynamic> json) =>
_$MatchPlayerFromJson(json);
}

@freezed
class PlayerPerformance with _$PlayerPerformance {
const factory PlayerPerformance({
required String inning_id,
PlayerStatus? status,
int? index,
}) = _PlayerPerformance;

factory PlayerPerformance.fromJson(Map<String, dynamic> json) =>
_$PlayerPerformanceFromJson(json);
}

@freezed
class AddEditMatchRequest with _$AddEditMatchRequest {
// ignore: invalid_annotation_target
Expand Down Expand Up @@ -201,8 +212,9 @@ class MatchPlayerRequest with _$MatchPlayerRequest {
@JsonSerializable(anyMap: true, explicitToJson: true)
const factory MatchPlayerRequest({
required String id,
required PlayerStatus status,
int? index,
@Default(PlayerStatus.played)
PlayerStatus status, // TODO: Remove after release
@Default([]) List<PlayerPerformance> performance,
}) = _MatchPlayerRequest;

factory MatchPlayerRequest.fromJson(Map<String, dynamic> json) =>
Expand Down
Loading

0 comments on commit f4d171d

Please sign in to comment.