Added placeholder error timetable entry when parsing errors occur
This commit is contained in:
@ -22,8 +22,20 @@ class AppointmentDetails {
|
||||
GetTimetableResponseObject timetableData = appointment.id as GetTimetableResponseObject;
|
||||
|
||||
//GetTimetableResponseObject timetableData = webuntisData.getTimetableResponse.result.firstWhere((element) => element.id == timetableObject.id);
|
||||
GetSubjectsResponseObject subject = webuntisData.getSubjectsResponse.result.firstWhere((subject) => subject.id == timetableData.su[0]['id']);
|
||||
GetRoomsResponseObject room = webuntisData.getRoomsResponse.result.firstWhere((room) => room.id == timetableData.ro[0]['id']);
|
||||
GetSubjectsResponseObject subject;
|
||||
GetRoomsResponseObject room;
|
||||
|
||||
try {
|
||||
subject = webuntisData.getSubjectsResponse.result.firstWhere((subject) => subject.id == timetableData.su[0]['id']);
|
||||
} catch(e) {
|
||||
subject = GetSubjectsResponseObject(0, "?", "Lesefehler", "?", true);
|
||||
}
|
||||
|
||||
try {
|
||||
room = webuntisData.getRoomsResponse.result.firstWhere((room) => room.id == timetableData.ro[0]['id']);
|
||||
} catch(e) {
|
||||
room = GetRoomsResponseObject(0, "?", "Lesefehler", true, "?");
|
||||
}
|
||||
|
||||
showModalBottomSheet(context: context, builder: (context) => Column(
|
||||
children: [
|
||||
|
@ -200,14 +200,14 @@ class _TimetableState extends State<Timetable> {
|
||||
notes: element.activityType,
|
||||
color: _getEventColor(element.code, startTime, endTime),
|
||||
);
|
||||
} on Error catch(e) {
|
||||
log(e.toString());
|
||||
} catch(e) {
|
||||
return Appointment(
|
||||
id: element,
|
||||
startTime: _parseWebuntisTimestamp(element.date, element.startTime),
|
||||
endTime: _parseWebuntisTimestamp(element.date, element.endTime),
|
||||
subject: "ERROR",
|
||||
subject: "Fehler",
|
||||
notes: element.info,
|
||||
location: 'LOCATION',
|
||||
location: 'Lesefehler',
|
||||
color: Theme.of(context).primaryColor,
|
||||
startTimeZone: '',
|
||||
endTimeZone: '',
|
||||
|
Reference in New Issue
Block a user