TetraStats/lib/data_objects/cutoff_tetrio.dart

54 lines
1.3 KiB
Dart
Raw Permalink Normal View History

2024-09-05 21:42:21 +00:00
// ignore_for_file: hash_and_equals
class CutoffTetrio {
late int pos;
late double percentile;
late double tr;
late double targetTr;
2024-09-16 22:37:25 +00:00
late double? apm;
late double? pps;
late double? vs;
2024-09-05 21:42:21 +00:00
late int count;
late double countPercentile;
2024-09-16 22:37:25 +00:00
CutoffTetrio({
required this.pos,
required this.percentile,
required this.tr,
required this.targetTr,
required this.apm,
required this.pps,
required this.vs,
required this.count,
required this.countPercentile
});
2024-09-05 21:42:21 +00:00
CutoffTetrio.fromJson(Map<String, dynamic> json, int total){
pos = json['pos'];
percentile = json['percentile'].toDouble();
tr = json['tr'].toDouble();
targetTr = json['targettr'].toDouble();
2024-09-16 22:37:25 +00:00
apm = json['apm']?.toDouble();
pps = json['pps']?.toDouble();
vs = json['vs']?.toDouble();
2024-09-05 21:42:21 +00:00
count = json['count'];
countPercentile = count / total;
}
}
class CutoffsTetrio {
late String id;
late DateTime timestamp;
late int total;
Map<String, CutoffTetrio> data = {};
CutoffsTetrio.fromJson(Map<String, dynamic> json){
id = json['s'];
timestamp = DateTime.parse(json['t']);
total = json['data']['total'];
json['data'].remove("total");
for (String rank in json['data'].keys){
data[rank] = CutoffTetrio.fromJson(json['data'][rank], total);
}
}
}