Skip to content

Commit 3cf15d7

Browse files
Remove percentage (#215)
* Remove percentage * [CI UPDATE GOLDENS] * Fix test * [CI UPDATE GOLDENS] * Update golden files Co-authored-by: camillebrulotte <camillebrulotte@users.noreply.github.com>
1 parent cd54f1e commit 3cf15d7

File tree

8 files changed

+17
-9
lines changed

8 files changed

+17
-9
lines changed

lib/core/utils/utils.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ mixin Utils {
2020
return 0.0;
2121
}
2222

23-
return ((grade / maxGrade) * 100).roundToDouble();
23+
return double.parse(((grade / maxGrade) * 100).toStringAsFixed(1));
2424
}
2525

2626
static Color getColorByBrightness(

lib/ui/views/grade_details_view.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,9 @@ class _GradesDetailsViewState extends State<GradesDetailsView>
214214
context,
215215
model.course.summary.median.toString(),
216216
AppIntl.of(context).grades_grade_in_percentage(
217-
model.course.summary.median),
217+
Utils.getGradeInPercentage(
218+
model.course.summary.median,
219+
model.course.summary.markOutOf)),
218220
),
219221
),
220222
),

lib/ui/widgets/grade_evaluation_tile.dart

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,15 @@ class _GradeEvaluationTileState extends State<GradeEvaluationTile>
196196
evaluation.correctedEvaluationOutOfFormatted),
197197
),
198198
),
199-
_buildSummary(AppIntl.of(context).grades_median,
200-
validateResult(context, evaluation.median.toString())),
199+
_buildSummary(
200+
AppIntl.of(context).grades_median,
201+
AppIntl.of(context).grades_grade_with_percentage(
202+
evaluation.median ?? 0.0,
203+
evaluation.correctedEvaluationOutOf ?? 0.0,
204+
Utils.getGradeInPercentage(evaluation.median,
205+
evaluation.correctedEvaluationOutOfFormatted),
206+
),
207+
),
201208
_buildSummary(
202209
AppIntl.of(context).grades_standard_deviation,
203210
validateResult(

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
1515
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
1616
# Read more about iOS versioning at
1717
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
18-
version: 4.2.3+1
18+
version: 4.2.4+1
1919

2020
environment:
2121
sdk: ">=2.10.0 <3.0.0"
-16 Bytes
Loading
-16 Bytes
Loading

test/ui/widgets/grade_evaluation_tile_test.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,11 @@ void main() {
108108
expect(label2, findsOneWidget);
109109

110110
final label3 = find.text(intl.grades_not_available);
111-
//grades_median, grades_standard_deviation, grades_percentile_rank
112-
expect(label3, findsNWidgets(3));
111+
//grades_standard_deviation, grades_percentile_rank
112+
expect(label3, findsNWidgets(2));
113113

114114
final label4 = find.text("0.0/30 (0.0%)");
115-
expect(label4, findsNWidgets(2));
115+
expect(label4, findsNWidgets(3));
116116
});
117117
});
118118
});

test/viewmodels/dashboard_viewmodel_test.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,6 @@ void main() {
380380
PreferencesFlag.scheduleCard);
381381
SettingsManagerMock.stubSetInt(settingsManager as SettingsManagerMock,
382382
PreferencesFlag.progressBarCard);
383-
384383
SettingsManagerMock.stubGetDashboard(
385384
settingsManager as SettingsManagerMock,
386385
toReturn: dashboard);

0 commit comments

Comments
 (0)