Skip to content
This repository was archived by the owner on Sep 7, 2025. It is now read-only.

Commit 30f9d0b

Browse files
committed
climb percentages
1 parent a202355 commit 30f9d0b

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

lib/team_analysis.dart

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,27 @@ class TeamStats {
133133
}
134134
}
135135

136+
// calculate climb percentages
137+
Map<String, double> get climbPercentages {
138+
if (records.isEmpty) {
139+
return {
140+
'Deep': 0,
141+
'Shallow': 0,
142+
'None': 100,
143+
};
144+
}
145+
146+
int deepCount = records.where((r) => r.endgameCageHang == 'Deep').length;
147+
int shallowCount = records.where((r) => r.endgameCageHang == 'Shallow').length;
148+
int noneCount = records.where((r) => r.endgameCageHang == 'None').length;
149+
150+
return {
151+
'Deep': (deepCount / records.length) * 100,
152+
'Shallow': (shallowCount / records.length) * 100,
153+
'None': (noneCount / records.length) * 100,
154+
};
155+
}
156+
136157
// auto scoring potential
137158
double get autoScoringPotential {
138159
return autoAlgaeScoringPotential + autoCoralScoringPotential;
@@ -999,6 +1020,13 @@ class _TeamAnalysisCardState extends State<TeamAnalysisCard> {
9991020
style: Theme.of(context).textTheme.bodyLarge,
10001021
),
10011022
),
1023+
Padding(
1024+
padding: const EdgeInsets.symmetric(vertical: 8),
1025+
child: Text(
1026+
'Climb: ${widget.stats.climbPercentages['Deep']?.round()}% deep, ${widget.stats.climbPercentages['Shallow']?.round()}% shallow, ${widget.stats.climbPercentages['None']?.round()}% no climb',
1027+
style: Theme.of(context).textTheme.bodyLarge,
1028+
),
1029+
),
10021030
if (widget.stats.getStrengths().isNotEmpty) ...[
10031031
_buildStrengthsSection(context, widget.stats.getStrengths()),
10041032
const SizedBox(height: 4),

0 commit comments

Comments
 (0)