Skip to content

Commit

Permalink
Fix Tuition Status
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobkoerber committed Oct 4, 2024
1 parent a286179 commit bdd9fa0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions lib/base/util/string_parser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ class StringParser {
).format(dateTime);
}

static double stringToDouble(String? number) {
static double? stringToDouble(String? number) {
if (number != null) {
number = number.replaceAll(",", ".");
return double.tryParse(number) ?? 0.0;
return double.tryParse(number);
} else {
return 0.0;
return null;
}
}

Expand Down
4 changes: 2 additions & 2 deletions lib/homeComponent/view/contactCard/tuition_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ class TuitionView extends ConsumerWidget {
BuildContext context,
AsyncSnapshot<Tuition?> snapshot,
) {
if (snapshot.hasData) {
if (snapshot.data?.amount == 0.0) {
if (snapshot.hasData && snapshot.data!.amount != null) {
if (snapshot.data!.amount! <= 0.0) {
return IconText(
iconData: Icons.check,
label: context.tr("tuitionPaid"),
Expand Down
2 changes: 1 addition & 1 deletion lib/studiesComponent/model/average_grade.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class AverageGrade {
name: "avg_grade_weighted_by_credits",
fromJson: StringParser.stringToDouble,
)
final double averageGrade;
final double? averageGrade;

AverageGrade({
required this.id,
Expand Down

0 comments on commit bdd9fa0

Please sign in to comment.