TDD 작성
This commit is contained in:
@@ -5,6 +5,7 @@ class Score {
|
||||
final String clubId;
|
||||
final List<int> frames;
|
||||
final int totalScore;
|
||||
final int? handicap; // 핸디캡 추가
|
||||
final DateTime date;
|
||||
final String? notes;
|
||||
final String? participantName;
|
||||
@@ -16,10 +17,14 @@ class Score {
|
||||
required this.clubId,
|
||||
required this.frames,
|
||||
required this.totalScore,
|
||||
this.handicap,
|
||||
required this.date,
|
||||
this.notes,
|
||||
this.participantName,
|
||||
});
|
||||
|
||||
// 핸디캡 포함 총점 계산
|
||||
int get totalWithHandicap => totalScore + (handicap ?? 0);
|
||||
|
||||
factory Score.fromJson(Map<String, dynamic> json) {
|
||||
return Score(
|
||||
@@ -29,6 +34,7 @@ class Score {
|
||||
clubId: json['clubId']?.toString() ?? '',
|
||||
frames: json['frames'] != null ? List<int>.from(json['frames']) : [],
|
||||
totalScore: json['totalScore'] ?? 0,
|
||||
handicap: json['handicap'],
|
||||
date: json['date'] != null ? DateTime.parse(json['date'].toString()) : DateTime.now(),
|
||||
notes: json['notes']?.toString(),
|
||||
participantName: json['participantName']?.toString(),
|
||||
@@ -43,6 +49,7 @@ class Score {
|
||||
'clubId': clubId,
|
||||
'frames': frames,
|
||||
'totalScore': totalScore,
|
||||
'handicap': handicap,
|
||||
'date': date.toIso8601String(),
|
||||
'notes': notes,
|
||||
'participantName': participantName,
|
||||
|
||||
Reference in New Issue
Block a user