重构记分数据模型,替换弓型和靶纸类型为 ID 及名称,更新相关页面以支持新配置。
This commit is contained in:
@@ -7,25 +7,6 @@ enum PointRecordStatus {
|
||||
completed,
|
||||
}
|
||||
|
||||
enum BowType {
|
||||
recurve,
|
||||
compound,
|
||||
barebow,
|
||||
traditional,
|
||||
longbow,
|
||||
other,
|
||||
}
|
||||
|
||||
enum TargetFaceType {
|
||||
cm40,
|
||||
cm60,
|
||||
cm80,
|
||||
cm122,
|
||||
vegas3Spot,
|
||||
vertical3Spot,
|
||||
custom,
|
||||
}
|
||||
|
||||
@embedded
|
||||
class HitPoint {
|
||||
HitPoint({
|
||||
@@ -67,11 +48,17 @@ class PointRecord {
|
||||
@enumerated
|
||||
PointRecordStatus status = PointRecordStatus.draft;
|
||||
|
||||
@enumerated
|
||||
BowType bowType = BowType.recurve;
|
||||
/// Matches [BowOption.id] from point book config.
|
||||
@Index(type: IndexType.value)
|
||||
int bowOptionId = 1;
|
||||
|
||||
@enumerated
|
||||
TargetFaceType targetFaceType = TargetFaceType.cm40;
|
||||
late String bowName;
|
||||
|
||||
/// Matches [TargetOption.id] from point book config.
|
||||
@Index(type: IndexType.value)
|
||||
int targetOptionId = 1;
|
||||
|
||||
late String targetName;
|
||||
|
||||
late String title;
|
||||
int distanceMeters = 18;
|
||||
@@ -88,8 +75,10 @@ class PointRecord {
|
||||
scores.isEmpty ? null : totalScore / scores.length;
|
||||
|
||||
factory PointRecord.createDraft({
|
||||
required BowType bowType,
|
||||
required TargetFaceType targetFaceType,
|
||||
required int bowOptionId,
|
||||
required String bowName,
|
||||
required int targetOptionId,
|
||||
required String targetName,
|
||||
required int distanceMeters,
|
||||
required int endCount,
|
||||
required int arrowsPerEnd,
|
||||
@@ -101,8 +90,10 @@ class PointRecord {
|
||||
return PointRecord()
|
||||
..title = title ?? '未完成记分'
|
||||
..status = PointRecordStatus.draft
|
||||
..bowType = bowType
|
||||
..targetFaceType = targetFaceType
|
||||
..bowOptionId = bowOptionId
|
||||
..bowName = bowName
|
||||
..targetOptionId = targetOptionId
|
||||
..targetName = targetName
|
||||
..distanceMeters = distanceMeters
|
||||
..endCount = endCount
|
||||
..arrowsPerEnd = arrowsPerEnd
|
||||
@@ -117,8 +108,10 @@ class PointRecord {
|
||||
..id = id
|
||||
..title = title
|
||||
..status = PointRecordStatus.completed
|
||||
..bowType = bowType
|
||||
..targetFaceType = targetFaceType
|
||||
..bowOptionId = bowOptionId
|
||||
..bowName = bowName
|
||||
..targetOptionId = targetOptionId
|
||||
..targetName = targetName
|
||||
..distanceMeters = distanceMeters
|
||||
..endCount = endCount
|
||||
..arrowsPerEnd = arrowsPerEnd
|
||||
@@ -136,8 +129,10 @@ class PointRecord {
|
||||
..id = id
|
||||
..title = title
|
||||
..status = status
|
||||
..bowType = bowType
|
||||
..targetFaceType = targetFaceType
|
||||
..bowOptionId = bowOptionId
|
||||
..bowName = bowName
|
||||
..targetOptionId = targetOptionId
|
||||
..targetName = targetName
|
||||
..distanceMeters = distanceMeters
|
||||
..endCount = endCount
|
||||
..arrowsPerEnd = arrowsPerEnd
|
||||
|
||||
Reference in New Issue
Block a user