58 lines
1.6 KiB
Dart
58 lines
1.6 KiB
Dart
/*
|
|
* @Author: wangyang 1147192855@qq.com
|
|
* @Date: 2022-07-20 15:20:11
|
|
* @LastEditors: wangyang 1147192855@qq.com
|
|
* @LastEditTime: 2022-07-26 16:42:09
|
|
* @FilePath: \marking_app\lib\common\model\progress\progress_statistics.dart
|
|
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
*/
|
|
import 'package:json_annotation/json_annotation.dart';
|
|
|
|
part 'progress_statistics.g.dart';
|
|
|
|
@JsonSerializable()
|
|
class ProgressStatistics extends Object {
|
|
|
|
@JsonKey(name: 'markingTotal')
|
|
int markingTotal;
|
|
|
|
@JsonKey(name: 'markingFinishedCount')
|
|
int markingFinishedCount;
|
|
|
|
@JsonKey(name: 'markingUnfinishedCount')
|
|
int markingUnfinishedCount;
|
|
|
|
@JsonKey(name: 'overallAverage')
|
|
double overallAverage;
|
|
|
|
@JsonKey(name: 'myAverage')
|
|
double myAverage;
|
|
|
|
// 完成比例
|
|
@JsonKey(name: 'completionRate')
|
|
double completionRate;
|
|
|
|
@JsonKey(name: 'completionRateStr')
|
|
String completionRateStr;
|
|
|
|
ProgressStatistics(
|
|
this.markingUnfinishedCount,
|
|
this.markingFinishedCount,
|
|
this.myAverage,
|
|
this.markingTotal,
|
|
this.overallAverage, {
|
|
this.completionRate = 0,
|
|
this.completionRateStr = '0.0',
|
|
}) {
|
|
if (markingTotal != 0) {
|
|
completionRate = markingFinishedCount / markingTotal;
|
|
completionRateStr = (completionRate * 100).toStringAsFixed(2);
|
|
}
|
|
}
|
|
|
|
factory ProgressStatistics.fromJson(Map<String, dynamic> srcJson) =>
|
|
_$ProgressStatisticsFromJson(srcJson);
|
|
|
|
Map<String, dynamic> toJson() => _$ProgressStatisticsToJson(this);
|
|
}
|