Skip to content

Commit

Permalink
feat: using score instead of quarters
Browse files Browse the repository at this point in the history
  • Loading branch information
maximeroucher committed Dec 15, 2023
1 parent 0289988 commit 655d22c
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 32 deletions.
18 changes: 9 additions & 9 deletions lib/elocaps/class/game_player.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@ class GamePlayer {
{required this.playerId,
required this.eloGain,
required this.team,
required this.quarters,
required this.score,
required this.user});

late final String playerId;
late final int eloGain;
late final int team;
late final int quarters;
late final int score;
late final SimpleUser user;

GamePlayer.fromJson(Map<String, dynamic> json) {
playerId = json['user_id'];
eloGain = json['elo_gain'];
team = json['team'];
quarters = json['quarters'];
score = json['score'];
user = SimpleUser.fromJson(json['user']);
}

Expand All @@ -27,7 +27,7 @@ class GamePlayer {
data['user_id'] = playerId;
data['elo_gain'] = eloGain;
data['team'] = team;
data['quarters'] = quarters;
data['score'] = score;
data['user'] = user.toJson();
return data;
}
Expand All @@ -36,35 +36,35 @@ class GamePlayer {
final data = <String, dynamic>{};
data['user_id'] = playerId;
data['team'] = team;
data['quarters'] = quarters;
data['score'] = score;
return data;
}

GamePlayer copyWith({
String? playerId,
int? eloGain,
int? team,
int? quarters,
int? score,
SimpleUser? user,
}) =>
GamePlayer(
playerId: playerId ?? this.playerId,
eloGain: eloGain ?? this.eloGain,
team: team ?? this.team,
quarters: quarters ?? this.quarters,
score: score ?? this.score,
user: user ?? this.user,
);

GamePlayer.empty() {
playerId = '';
eloGain = 0;
team = 1;
quarters = 0;
score = 0;
user = SimpleUser.empty();
}

@override
String toString() {
return 'GamePlayer(playerId: $playerId, elo_gain: $eloGain, team: $team, quarters: $quarters, user: ${user.toString()})';
return 'GamePlayer(playerId: $playerId, elo_gain: $eloGain, team: $team, score: $score, user: ${user.toString()})';
}
}
2 changes: 1 addition & 1 deletion lib/elocaps/ui/pages/game_page/game_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ class GamePage extends HookConsumerWidget {
user: e,
eloGain: 0,
playerId: e.id,
quarters: isTeamOne ? scores[0] : scores[1],
score: isTeamOne ? scores[0] : scores[1],
team: isTeamOne ? 1 : 2,
);
}).toList(),
Expand Down
4 changes: 2 additions & 2 deletions lib/elocaps/ui/pages/history_page/game_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class GameCard extends HookConsumerWidget {
.fold<int>(
0,
(previousValue, element) =>
previousValue + element.quarters)
previousValue + element.score)
.toString(),
style: const TextStyle(color: Colors.white, fontSize: 25),
),
Expand All @@ -83,7 +83,7 @@ class GameCard extends HookConsumerWidget {
.fold<int>(
0,
(previousValue, element) =>
previousValue + element.quarters)
previousValue + element.score)
.toString(),
style: const TextStyle(color: Colors.white, fontSize: 25),
),
Expand Down
40 changes: 20 additions & 20 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,10 @@ packages:
dependency: transitive
description:
name: coverage
sha256: ac86d3abab0f165e4b8f561280ff4e066bceaac83c424dd19f1ae2c2fcd12ca9
sha256: "8acabb8306b57a409bf4c83522065672ee13179297a6bb0cb9ead73948df7c76"
url: "https://pub.dev"
source: hosted
version: "1.7.1"
version: "1.7.2"
cross_file:
dependency: transitive
description:
Expand Down Expand Up @@ -301,26 +301,26 @@ packages:
dependency: "direct main"
description:
name: firebase_messaging
sha256: b9b94c7d932d83d36efcf7eb21caf50486a8f330c6f681bb68e7b979d036491e
sha256: "199fe8186a5370d1cf5ce0819191079afc305914e8f38715f5e23943940dfe2d"
url: "https://pub.dev"
source: hosted
version: "14.7.8"
version: "14.7.9"
firebase_messaging_platform_interface:
dependency: transitive
description:
name: firebase_messaging_platform_interface
sha256: "200f27b70a6330d1ac3f0fbf5328412ef3b215cd9dbb7dcea1701d1fd705d37a"
sha256: "54e283a0e41d81d854636ad0dad73066adc53407a60a7c3189c9656e2f1b6107"
url: "https://pub.dev"
source: hosted
version: "4.5.17"
version: "4.5.18"
firebase_messaging_web:
dependency: transitive
description:
name: firebase_messaging_web
sha256: "1c254306714d4d76aea612d81775e8f18c712219f096a7e6abfa234de9fd4bd2"
sha256: "90dc7ed885e90a24bb0e56d661d4d2b5f84429697fd2cbb9e5890a0ca370e6f4"
url: "https://pub.dev"
source: hosted
version: "3.5.17"
version: "3.5.18"
fl_chart:
dependency: "direct main"
description:
Expand Down Expand Up @@ -609,18 +609,18 @@ packages:
dependency: "direct main"
description:
name: image_picker
sha256: "7d7f2768df2a8b0a3cefa5ef4f84636121987d403130e70b17ef7e2cf650ba84"
sha256: fc712337719239b0b6e41316aa133350b078fa39b6cbd706b61f3fd421b03c77
url: "https://pub.dev"
source: hosted
version: "1.0.4"
version: "1.0.5"
image_picker_android:
dependency: transitive
description:
name: image_picker_android
sha256: d6a6e78821086b0b737009b09363018309bbc6de3fd88cc5c26bc2bb44a4957f
sha256: ecdc963d2aa67af5195e723a40580f802d4392e31457a12a562b3e2bd6a396fe
url: "https://pub.dev"
source: hosted
version: "0.8.8+2"
version: "0.8.9+1"
image_picker_for_web:
dependency: transitive
description:
Expand All @@ -633,10 +633,10 @@ packages:
dependency: transitive
description:
name: image_picker_ios
sha256: "76ec722aeea419d03aa915c2c96bf5b47214b053899088c9abb4086ceecf97a7"
sha256: eac0a62104fa12feed213596df0321f57ce5a572562f72a68c4ff81e9e4caacf
url: "https://pub.dev"
source: hosted
version: "0.8.8+4"
version: "0.8.9"
image_picker_linux:
dependency: transitive
description:
Expand Down Expand Up @@ -729,10 +729,10 @@ packages:
dependency: "direct main"
description:
name: load_switch
sha256: dd204ca30327097520011f26bf9e03f390399a7417700db6778cff6890d2d21f
sha256: e4105341890a398172900a7f02c68e0e3856ed77758cf8120cf67c125953039d
url: "https://pub.dev"
source: hosted
version: "2.0.7"
version: "2.0.8"
logging:
dependency: transitive
description:
Expand Down Expand Up @@ -1246,10 +1246,10 @@ packages:
dependency: transitive
description:
name: url_launcher_linux
sha256: "9f2d390e096fdbe1e6e6256f97851e51afc2d9c423d3432f1d6a02a8a9a8b9fd"
sha256: ab360eb661f8879369acac07b6bb3ff09d9471155357da8443fd5d3cf7363811
url: "https://pub.dev"
source: hosted
version: "3.1.0"
version: "3.1.1"
url_launcher_macos:
dependency: transitive
description:
Expand Down Expand Up @@ -1278,10 +1278,10 @@ packages:
dependency: transitive
description:
name: url_launcher_windows
sha256: "7754a1ad30ee896b265f8d14078b0513a4dba28d358eabb9d5f339886f4a1adc"
sha256: ecf9725510600aa2bb6d7ddabe16357691b6d2805f66216a97d1b881e21beff7
url: "https://pub.dev"
source: hosted
version: "3.1.0"
version: "3.1.1"
vector_graphics:
dependency: transitive
description:
Expand Down

0 comments on commit 655d22c

Please sign in to comment.