diff --git a/lib/core/models/prescribed_execution_rule.dart b/lib/core/models/prescribed_execution_rule.dart index b2198d1..6bc846b 100644 --- a/lib/core/models/prescribed_execution_rule.dart +++ b/lib/core/models/prescribed_execution_rule.dart @@ -20,12 +20,10 @@ class ExecutionScoreCriterion { } abstract final class PrescribedExecutionRuleCatalog { - static const displayLabels = { - '动作准确性': '动作的准确性(个人30分/集体20分)', - '动作熟练性': '动作的熟练性(个人20分/集体15分)', - '动作合拍性': '动作的合拍性(个人30分/集体15分)', - '运动能力一致性': '运动能力一致性(集体15分)', - '表演技巧一致性': '表演技巧一致性(集体15分)', + static const displayNames = { + '动作准确性': '动作的准确性', + '动作熟练性': '动作的熟练性', + '动作合拍性': '动作的合拍性', }; /// 服务端规定赛评分项编码到平板控件键的映射。 @@ -92,5 +90,6 @@ abstract final class PrescribedExecutionRuleCatalog { PrescribedEntryType.collective => collective, }; - static String displayLabelFor(String item) => displayLabels[item] ?? item; + static String displayLabelFor(String item, double maximum) => + '${displayNames[item] ?? item}(${maximum.round()}分)'; } diff --git a/lib/modules/scoring/controllers/scoring_controller.dart b/lib/modules/scoring/controllers/scoring_controller.dart index b0287f7..d56d528 100644 --- a/lib/modules/scoring/controllers/scoring_controller.dart +++ b/lib/modules/scoring/controllers/scoring_controller.dart @@ -886,7 +886,10 @@ class ScoringController extends GetxController { String performanceItemDisplayLabel(String item) { if (profile.role == ScoreRole.execution) { - return PrescribedExecutionRuleCatalog.displayLabelFor(item); + return PrescribedExecutionRuleCatalog.displayLabelFor( + item, + performanceItemMaximum(item), + ); } return '$item(${performanceItemMaximum(item).round()})'; } diff --git a/test/prescribed_execution_rule_test.dart b/test/prescribed_execution_rule_test.dart index 8cbf36f..59e044a 100644 --- a/test/prescribed_execution_rule_test.dart +++ b/test/prescribed_execution_rule_test.dart @@ -30,26 +30,37 @@ void main() { expect(rules.fold(0, (sum, item) => sum + item.maximum), 80); }); - test('完成质量评分项同时标明个人与集体分值', () { + test('完成质量评分项只显示当前项目对应分值', () { + final individual = PrescribedExecutionRuleCatalog.forType( + PrescribedEntryType.individual, + ); + final collective = PrescribedExecutionRuleCatalog.forType( + PrescribedEntryType.collective, + ); + expect( - PrescribedExecutionRuleCatalog.displayLabelFor('动作准确性'), - '动作的准确性(个人30分/集体20分)', + individual.map( + (item) => PrescribedExecutionRuleCatalog.displayLabelFor( + item.name, + item.maximum, + ), + ), + ['动作的准确性(30分)', '动作的熟练性(20分)', '动作的合拍性(30分)'], ); expect( - PrescribedExecutionRuleCatalog.displayLabelFor('动作熟练性'), - '动作的熟练性(个人20分/集体15分)', - ); - expect( - PrescribedExecutionRuleCatalog.displayLabelFor('动作合拍性'), - '动作的合拍性(个人30分/集体15分)', - ); - expect( - PrescribedExecutionRuleCatalog.displayLabelFor('运动能力一致性'), - '运动能力一致性(集体15分)', - ); - expect( - PrescribedExecutionRuleCatalog.displayLabelFor('表演技巧一致性'), - '表演技巧一致性(集体15分)', + collective.map( + (item) => PrescribedExecutionRuleCatalog.displayLabelFor( + item.name, + item.maximum, + ), + ), + [ + '动作的准确性(20分)', + '动作的熟练性(15分)', + '动作的合拍性(15分)', + '运动能力一致性(15分)', + '表演技巧一致性(15分)', + ], ); });