이벤트 개발완료

This commit is contained in:
2025-10-23 22:04:03 +09:00
parent ce1aee67d6
commit cd0e139b5e
48 changed files with 7855 additions and 3459 deletions
+21 -2
View File
@@ -3,9 +3,11 @@ class Score {
final String memberId;
final String eventId;
final String clubId;
final String? participantId; // 참가자 ID (백엔드 EventScore 필드)
final List<int> frames;
final int totalScore;
final int? handicap; // 핸디캡 추가
final int? gameNumber; // 게임 번호 (백엔드 EventScore 필드)
final DateTime date;
final String? notes;
final String? participantName;
@@ -15,9 +17,11 @@ class Score {
required this.memberId,
required this.eventId,
required this.clubId,
this.participantId,
required this.frames,
required this.totalScore,
this.handicap,
this.gameNumber,
required this.date,
this.notes,
this.participantName,
@@ -32,9 +36,19 @@ class Score {
memberId: json['memberId']?.toString() ?? '',
eventId: json['eventId']?.toString() ?? '',
clubId: json['clubId']?.toString() ?? '',
participantId: json['participantId']?.toString(),
frames: json['frames'] != null ? List<int>.from(json['frames']) : [],
totalScore: json['totalScore'] ?? 0,
// 서버는 base 점수를 'score'로, 합계(핸디 포함)를 'totalScore'로 반환할 수 있음.
// 앱 내부에서는 base 점수를 totalScore 필드에 저장하여 일관되게 사용하고,
// 핸디 포함 합계는 getter(totalWithHandicap)로 계산한다.
totalScore: (json['score'] ?? json['totalScore']) ?? 0,
handicap: json['handicap'],
gameNumber: () {
final v = json['gameNumber'];
if (v == null) return null;
if (v is int) return v;
return int.tryParse(v.toString());
}(),
date: json['date'] != null ? DateTime.parse(json['date'].toString()) : DateTime.now(),
notes: json['notes']?.toString(),
participantName: json['participantName']?.toString(),
@@ -42,7 +56,7 @@ class Score {
}
Map<String, dynamic> toJson() {
return {
final map = {
'id': id,
'memberId': memberId,
'eventId': eventId,
@@ -50,10 +64,15 @@ class Score {
'frames': frames,
'totalScore': totalScore,
'handicap': handicap,
'gameNumber': gameNumber,
'date': date.toIso8601String(),
'notes': notes,
'participantName': participantName,
};
if (participantId != null) {
map['participantId'] = participantId;
}
return map;
}
}