Skip to content

Commit

Permalink
i think this fixes it
Browse files Browse the repository at this point in the history
  • Loading branch information
user5522 committed Jun 8, 2024
1 parent 5dc7add commit 5b81c5a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/components/subject_management/subject_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ class SubjectScreen extends HookConsumerWidget {
);
return;
}
subjectNotifier.addSubject(newSubject.toCompanion(false));
subjectNotifier.addSubject(newSubject.toCompanion(true));
Navigator.pop(context, label.value);
}
if (!isSubjectNull) {
Expand Down
16 changes: 10 additions & 6 deletions lib/db/converters/time_of_day_converter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,20 @@ class TimeOfDayConverter extends TypeConverter<TimeOfDay, String> {

@override
TimeOfDay fromSql(String fromDb) {
// Parse TimeOfDay from String
return TimeOfDay(
hour: int.parse(fromDb.split(':')[0].replaceAll("TimeOfDay(", "")),
minute: int.parse(fromDb.split(':')[1].replaceAll(")", "")),
);
String timeOnly = fromDb.substring(10, fromDb.length - 1);

List<String> parts = timeOnly.split(":");
int hour = int.parse(parts[0]);
int minute = int.parse(parts[1]);

TimeOfDay timeOfDay = TimeOfDay(hour: hour, minute: minute);

return timeOfDay;
}

@override
String toSql(TimeOfDay value) {
// Convert TimeOfDay to String
return value.toString();
return "TimeOfDay(${value.hour}:${value.minute})";
}
}

0 comments on commit 5b81c5a

Please sign in to comment.