-
Notifications
You must be signed in to change notification settings - Fork 2
improve graphs in team lookup #126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,7 @@ class CategoryMetric { | |
| this.hideOverview = false, | ||
| this.hideFlag = false, | ||
| this.max, | ||
| this.units, | ||
| }); | ||
|
|
||
| String abbreviatedLocalizedName; | ||
|
|
@@ -16,27 +17,38 @@ class CategoryMetric { | |
| bool hideOverview; | ||
| bool hideFlag; | ||
| double? max; | ||
|
|
||
| String? units; | ||
| String path; | ||
|
|
||
| /// Optional override for completely custom formatting. | ||
| /// If null, default formatting is used (number + units). | ||
| String Function(dynamic)? valueToString; | ||
|
|
||
| String get abbreviatedNameWithUnits { | ||
| if (units == null || units!.trim().isEmpty) { | ||
| return abbreviatedLocalizedName; | ||
| } | ||
| return "$abbreviatedLocalizedName (${units!.trim()})"; | ||
| } | ||
|
|
||
| String valueVizualizationBuilder(dynamic val) { | ||
| if (val == null) return "--"; | ||
|
|
||
| // If a custom formatter is provided, use it | ||
| if (valueToString != null) { | ||
| if (val is num) { | ||
| return valueToString!(numToStringRounded(val)); | ||
| } else if (val == null) { | ||
| return "--"; | ||
| } else { | ||
| return valueToString!(val); | ||
| } | ||
| return valueToString!(val); | ||
| } | ||
|
|
||
| // Default behavior: number + units (if present) | ||
| if (val is num) { | ||
| return numToStringRounded(val); | ||
| final value = numToStringRounded(val); | ||
| return units != null ? "$value$units" : value; | ||
| } | ||
|
|
||
| return "--"; | ||
| return val.toString(); | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -103,13 +115,14 @@ final List<MetricCategoryData> metricCategories = [ | |
| CategoryMetric( | ||
| localizedName: "Scoring Rate (Fuel / Second)", | ||
| abbreviatedLocalizedName: "Scoring Rate", | ||
| valueToString: ((p0) => "$p0 bps"), | ||
| units: " bps", | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this |
||
| path: "fuelPerSecond", | ||
| ), | ||
| CategoryMetric( | ||
| localizedName: "Accuracy when shooting fuel", | ||
| abbreviatedLocalizedName: "Accuracy", | ||
| valueToString: ((p0) => "$p0%"), | ||
| units: "%", | ||
| max: 100, | ||
| path: "accuracy", | ||
| ), | ||
| CategoryMetric( | ||
|
|
@@ -122,13 +135,13 @@ final List<MetricCategoryData> metricCategories = [ | |
| CategoryMetric( | ||
| localizedName: "Time Spent Feeding", | ||
| abbreviatedLocalizedName: "Time Feeding", | ||
| valueToString: ((p0) => "${p0}s"), | ||
| units: "s", | ||
| path: "timeFeeding", | ||
| ), | ||
| CategoryMetric( | ||
| localizedName: "Feeding Rate (Fuel / Second)", | ||
| abbreviatedLocalizedName: "Feeding Rate", | ||
| valueToString: ((p0) => "$p0 bps"), | ||
| units: " bps", | ||
| path: "feedingRate", | ||
| ), | ||
| CategoryMetric( | ||
|
|
@@ -141,58 +154,59 @@ final List<MetricCategoryData> metricCategories = [ | |
| CategoryMetric( | ||
| localizedName: "Driver Ability", | ||
| abbreviatedLocalizedName: "Driver Ability", | ||
| valueToString: ((p0) => "$p0/5"), | ||
| max: 5, | ||
| units: "1-5", | ||
| path: "driverAbility", | ||
| ), | ||
| CategoryMetric( | ||
| localizedName: "Contact Defense Time", | ||
| abbreviatedLocalizedName: "Contact Defense Time", | ||
| valueToString: ((p0) => "${p0}s"), | ||
| units: "s", | ||
| path: "contactDefenseTime", | ||
| ), | ||
| CategoryMetric( | ||
| localizedName: "Defense effectiveness", | ||
| abbreviatedLocalizedName: "Defense effectiveness", | ||
| valueToString: ((p0) => "$p0/5"), | ||
| units: "1-5", | ||
| max: 5, | ||
| path: "defenseEffectiveness", | ||
| ), | ||
| CategoryMetric( | ||
| localizedName: "Camping Defense Time", | ||
| abbreviatedLocalizedName: "Camping Defense Time", | ||
| valueToString: ((p0) => "${p0}s"), | ||
| units: "s", | ||
| path: "campingDefenseTime", | ||
| ), | ||
| CategoryMetric( | ||
| localizedName: "Total Defense Time (Camping + Contact)", | ||
| abbreviatedLocalizedName: "Total Defense Time", | ||
| valueToString: ((p0) => "${p0}s"), | ||
| units: "s", | ||
| path: "totalDefenseTime", | ||
| ) | ||
| ]), | ||
| MetricCategoryData("Climb", [ | ||
| CategoryMetric( | ||
| localizedName: "Seconds left when starting to climb L1", | ||
| abbreviatedLocalizedName: "L1 Time", | ||
| valueToString: ((p0) => "${p0}s left"), | ||
| units: "s left", | ||
| path: "l1StartTime", | ||
| ), | ||
| CategoryMetric( | ||
| localizedName: "Seconds left when starting to climb L2", | ||
| abbreviatedLocalizedName: "L2 Time", | ||
| valueToString: ((p0) => "${p0}s left"), | ||
| units: "s left", | ||
| path: "l2StartTime", | ||
| ), | ||
| CategoryMetric( | ||
| localizedName: "Seconds left when starting to climb L3", | ||
| abbreviatedLocalizedName: "L3 Time", | ||
| valueToString: ((p0) => "${p0}s left"), | ||
| units: "s left", | ||
| path: "l3StartTime", | ||
| ), | ||
| CategoryMetric( | ||
| localizedName: "Seconds left in auto when starting to climb in auto", | ||
| abbreviatedLocalizedName: "Auto Time", | ||
| valueToString: ((p0) => "${p0}s left"), | ||
| units: "s left", | ||
| path: "autoClimbStartTime", | ||
| ), | ||
| ]), | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Were we going to make this add the units on by default?