add deleted attribute
All checks were successful
Pull Request Pipeline / test (pull_request) Successful in 45s
Pull Request Pipeline / lint (pull_request) Successful in 46s

This commit is contained in:
gelbeinhalb
2026-04-30 11:56:15 +02:00
parent 1ec1df3514
commit 66e657235a
6 changed files with 30 additions and 7 deletions

View File

@@ -16,6 +16,7 @@ class Match {
final List<Player> players;
final String notes;
Map<String, ScoreEntry?> scores;
final bool deleted;
Match({
required this.name,
@@ -27,6 +28,7 @@ class Match {
String? id,
DateTime? createdAt,
Map<String, ScoreEntry?>? scores,
this.deleted = false,
}) : id = id ?? const Uuid().v4(),
createdAt = createdAt ?? clock.now(),
scores = scores ?? {for (Player p in players) p.id: null};
@@ -65,7 +67,8 @@ class Match {
),
)
: {},
notes = json['notes'] ?? '';
notes = json['notes'] ?? '',
deleted = json['deleted'] ?? false;
/// Converts the Match instance to a JSON object. Related objects are
/// represented by their IDs, so the game, group, and players are not fully
@@ -80,6 +83,7 @@ class Match {
'playerIds': players.map((player) => player.id).toList(),
'scores': scores.map((key, value) => MapEntry(key, value?.toJson())),
'notes': notes,
'deleted': deleted,
};
List<Player> get mvp {