LCOV - code coverage report
Current view: top level - lib/models - score_model.dart Coverage Total Hit
Test: lcov.info Lines: 97.6 % 41 40
Test Date: 2025-08-12 03:21:51 Functions: - 0 0

            Line data    Source code
       1              : class Score {
       2              :   final String id;
       3              :   final String memberId;
       4              :   final String eventId;
       5              :   final String clubId;
       6              :   final List<int> frames;
       7              :   final int totalScore;
       8              :   final int? handicap; // 핸디캡 추가
       9              :   final DateTime date;
      10              :   final String? notes;
      11              :   final String? participantName;
      12              : 
      13            8 :   Score({
      14              :     required this.id,
      15              :     required this.memberId,
      16              :     required this.eventId,
      17              :     required this.clubId,
      18              :     required this.frames,
      19              :     required this.totalScore,
      20              :     this.handicap,
      21              :     required this.date,
      22              :     this.notes,
      23              :     this.participantName,
      24              :   });
      25              :   
      26              :   // 핸디캡 포함 총점 계산
      27            0 :   int get totalWithHandicap => totalScore + (handicap ?? 0);
      28              : 
      29            5 :   factory Score.fromJson(Map<String, dynamic> json) {
      30            5 :     return Score(
      31           10 :       id: json['id']?.toString() ?? '',
      32            9 :       memberId: json['memberId']?.toString() ?? '',
      33           10 :       eventId: json['eventId']?.toString() ?? '',
      34            9 :       clubId: json['clubId']?.toString() ?? '',
      35           15 :       frames: json['frames'] != null ? List<int>.from(json['frames']) : [],
      36            5 :       totalScore: json['totalScore'] ?? 0,
      37            5 :       handicap: json['handicap'],
      38           19 :       date: json['date'] != null ? DateTime.parse(json['date'].toString()) : DateTime.now(),
      39            8 :       notes: json['notes']?.toString(),
      40            7 :       participantName: json['participantName']?.toString(),
      41              :     );
      42              :   }
      43              : 
      44            1 :   Map<String, dynamic> toJson() {
      45            1 :     return {
      46            1 :       'id': id,
      47            1 :       'memberId': memberId,
      48            1 :       'eventId': eventId,
      49            1 :       'clubId': clubId,
      50            1 :       'frames': frames,
      51            1 :       'totalScore': totalScore,
      52            1 :       'handicap': handicap,
      53            2 :       'date': date.toIso8601String(),
      54            1 :       'notes': notes,
      55            1 :       'participantName': participantName,
      56              :     };
      57              :   }
      58              : }
      59              : 
      60              : class ScoreStatistics {
      61              :   final double average;
      62              :   final int highScore;
      63              :   final int lowScore;
      64              :   final int gamesPlayed;
      65              :   final Map<String, dynamic>? additionalStats;
      66              : 
      67            3 :   ScoreStatistics({
      68              :     required this.average,
      69              :     required this.highScore,
      70              :     required this.lowScore,
      71              :     required this.gamesPlayed,
      72              :     this.additionalStats,
      73              :   });
      74              : 
      75            3 :   factory ScoreStatistics.fromJson(Map<String, dynamic> json) {
      76            3 :     return ScoreStatistics(
      77           17 :       average: json['average'] != null ? (json['average'] is int ? (json['average'] as int).toDouble() : json['average'].toDouble()) : 0.0,
      78            3 :       highScore: json['highScore'] ?? 0,
      79            3 :       lowScore: json['lowScore'] ?? 0,
      80            3 :       gamesPlayed: json['gamesPlayed'] ?? 0,
      81            3 :       additionalStats: json['additionalStats'],
      82              :     );
      83              :   }
      84              : 
      85            1 :   Map<String, dynamic> toJson() {
      86            1 :     return {
      87            1 :       'average': average,
      88            1 :       'highScore': highScore,
      89            1 :       'lowScore': lowScore,
      90            1 :       'gamesPlayed': gamesPlayed,
      91            1 :       'additionalStats': additionalStats,
      92              :     };
      93              :   }
      94              : }
        

Generated by: LCOV version 2.3.1-1