Skip to content

Commit

Permalink
Mr changes
Browse files Browse the repository at this point in the history
  • Loading branch information
cp-mayank committed Nov 27, 2024
1 parent 74eb134 commit 5ae4c1b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions data/lib/api/ball_score/ball_score_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -703,11 +703,17 @@ extension BallScoreList on List<BallScoreModel> {

inningGroup.forEach((inningId, balls) {
int inningRunScored = 0;
int inningBallFaced = 0;
bool isDismissed = false;

for (final ball in balls) {
if (ball.batsman_id == currentUserId) {
inningRunScored += ball.runs_scored;
if (ball.extras_type == null ||
ball.extras_type == ExtrasType.legBye ||
ball.extras_type == ExtrasType.bye) {
inningBallFaced++;
}
}

if (ball.player_out_id == currentUserId &&
Expand All @@ -722,7 +728,7 @@ extension BallScoreList on List<BallScoreModel> {
fifties++;
}

if (isDismissed && inningRunScored >= 0 && inningRunScored <= 2) {
if (isDismissed && inningBallFaced >= 0 && inningBallFaced <= 2) {
ducks++;
}
});
Expand Down Expand Up @@ -775,7 +781,8 @@ extension BallScoreList on List<BallScoreModel> {
element.wicket_type != WicketType.retiredHurt &&
element.wicket_type != WicketType.timedOut &&
element.extras_type != ExtrasType.penaltyRun,
).length;
)
.length;

final runsConceded = deliveries
.where((element) => element.extras_type != ExtrasType.penaltyRun)
Expand Down

0 comments on commit 5ae4c1b

Please sign in to comment.