Skip to content

Commit

Permalink
Fix Bugs in Digital Student Card, Calendar and Search (#201)
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobkoerber authored Jan 26, 2024
1 parent 6d5c78a commit 1641973
Show file tree
Hide file tree
Showing 56 changed files with 334 additions and 537 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
![xcodebuild](https://github.com/TUM-Dev/campus_flutter/actions/workflows/deploy_beta.yml/badge.svg?branch=development)
![xcodebuild](https://github.com/TUM-Dev/campus_flutter/actions/workflows/deploy_web.yml/badge.svg?branch=development)
[![Discord Channel](https://img.shields.io/badge/Chat-on%20Discord-brightgreen)](https://discord.gg/k558T6ktuh)
<a href="https://testflight.apple.com/join/4Ddi6f2f">
<img src="https://developer.apple.com/assets/elements/icons/testflight/testflight-64x64_2x.png" height="42" align="right">
</a>
Expand Down Expand Up @@ -49,7 +48,7 @@ If you want to participate in the beta of this app, enter your details [here](ht
- [Privacy policy](https://app.tum.de/landing/privacy/)

## Support
You can reach us on [Discord](https://discord.gg/k558T6ktuh), [GitHub](https://github.com/TUM-Dev/campus_flutter) or via E-Mail [[email protected]](mailto:[email protected])
You can reach us on [GitHub](https://github.com/TUM-Dev/campus_flutter) or via E-Mail [[email protected]](mailto:[email protected])

## Development

Expand Down
4 changes: 2 additions & 2 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ SPEC CHECKSUMS:
flutter_secure_storage: 23fc622d89d073675f2eaa109381aefbcf5a49be
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
geolocator_apple: 9157311f654584b9bb72686c55fc02a97b73f461
google_maps_flutter_ios: 19fa4ef0fb77132d131df7cd974cb74c76f0fcd4
google_maps_flutter_ios: d9b9a308a1f14275c2967aefa639018a02bd44e8
GoogleDataTransport: 57c22343ab29bc686febbf7cbb13bad167c2d8fe
GoogleMaps: b47b67bd63d708477d6ff457da2d695c0d8ceb5f
GoogleUtilities: 0759d1a57ebb953965c2dfe0ba4c82e95ccc2e34
Expand All @@ -197,7 +197,7 @@ SPEC CHECKSUMS:
PromisesObjC: c50d2056b5253dadbd6c2bea79b0674bd5a52fa4
PromisesSwift: 28dca69a9c40779916ac2d6985a0192a5cb4a265
shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695
sqflite: 31f7eba61e3074736dff8807a9b41581e4f7f15a
sqflite: 50a33e1d72bd59ee092a519a35d107502757ebed
url_launcher_ios: bbd758c6e7f9fd7b5b1d4cde34d2b95fcce5e812
video_player_avfoundation: 02011213dab73ae3687df27ce441fbbcc82b5579

Expand Down
16 changes: 5 additions & 11 deletions lib/base/localization/app_de.arb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"hideFailedGrades":"Durchgefallene Noten ausblenden",
"defaultMapsApplication":"Standard-Kartenanwendung",
"map":"Karte",
"maps":"Karten",
"contactMore":"Kontakt & Mehr",
"tokenPermissions":"Berechtigungen für Token",
"permissionChangePossibleInTUMonline":"Du kannst deine Berechtigungen in TUMOnline ändern",
Expand Down Expand Up @@ -43,7 +44,6 @@
"nearestStudyRooms":"Nächste Lernräume",
"noNearFreeStudyRoomsFound":"Keine Lernräume in deiner Nähe gefunden",
"mostSearchedRooms":"Meist gesuchte Räume",
"noMoviesFound":"Keine Filme gefunden",
"tuition":"Tuition",
"tuitionFees":"Studiengebühren",
"tuitionPaid":"Bezahlt",
Expand Down Expand Up @@ -83,7 +83,6 @@
"thisMeeting":"Dieser Termin",
"lectureDetails":"Vorlesungsdetails",
"noLecturesSelected":"keine vorlesungen ausgewählt",
"noLecturesFound":"keine vorlesungen gefunden",
"showDirections":"Wegbeschreibung anzeigen",
"notAvailableAbbrev":"n. v.",
"becomeABetaTester":"Werde Beta-Tester",
Expand Down Expand Up @@ -158,11 +157,9 @@
}
}
},
"noNewsFound":"Keine Nachrichten gefunden",
"news":"Nachrichten",
"movies":"Filme",
"personalData":"Persönliche Daten",
"noGradesFound":"Keine Noten gefunden",
"calendarViewToday":"Heute",
"calendarViewDay":"Tag",
"calendarViewWeek":"Woche",
Expand Down Expand Up @@ -200,14 +197,12 @@
}
}
},
"noRoomsFound":"Keine Räume gefunden",
"noMealPlanFound":"Kein Essensplan gefunden",
"mealPlan":"Essensplan",
"noEntriesFoundSearch":"Keine {searchCategory} gefunden",
"@noEntriesFoundSearch":{
"description":"Title of Search Category",
"noEntriesFound":"Keine {category} gefunden!",
"@noEntriesFound":{
"description":"Category",
"placeholders":{
"searchCategory":{
"category":{
"type":"String",
"example":"Grades"
}
Expand All @@ -219,7 +214,6 @@
"search":"Suche",
"today":"Heute",
"tomorrow":"Morgen",
"noMapsFound":"Keine Karten gefunden",
"roomSearch":"Raum Suche",
"personSearch":"Personen Suche",
"badResponse":"Ungültige Antwort",
Expand Down
18 changes: 6 additions & 12 deletions lib/base/localization/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"hideFailedGrades":"Hide Failed Grades",
"defaultMapsApplication":"Default Maps Application",
"map":"Map",
"maps":"Maps",
"contactMore":"Contact & More",
"tokenPermissions":"Token Permissions",
"permissionChangePossibleInTUMonline":"You can change your permissions on TUMOnline",
Expand All @@ -41,9 +42,8 @@
"done":"Done",
"studyRooms":"Study Rooms",
"nearestStudyRooms":"Nearest Study Rooms",
"noNearFreeStudyRoomsFound":"no study rooms near you found",
"noNearFreeStudyRoomsFound":"No Study Rooms Near You Found!",
"mostSearchedRooms":"Most Searched Rooms",
"noMoviesFound":"no movies found",
"tuition":"Tuition",
"tuitionFees":"Tuition fees",
"tuitionPaid":"Tuition Paid",
Expand Down Expand Up @@ -83,7 +83,6 @@
"thisMeeting":"This Meeting",
"lectureDetails":"Lecture Details",
"noLecturesSelected":"no lecture selected",
"noLecturesFound":"no lectures found",
"showDirections":"Show Directions",
"notAvailableAbbrev":"n/a",
"becomeABetaTester":"Become a Beta Tester",
Expand Down Expand Up @@ -158,11 +157,9 @@
}
}
},
"noNewsFound":"no news found",
"news":"News",
"movies":"Movies",
"personalData":"Personal Data",
"noGradesFound":"no grades found",
"calendarViewToday":"Today",
"calendarViewDay":"Day",
"calendarViewWeek":"Week",
Expand Down Expand Up @@ -200,14 +197,12 @@
}
}
},
"noRoomsFound":"No Rooms Found",
"noMealPlanFound":"No Meal Plan Found",
"mealPlan":"Meal Plan",
"noEntriesFoundSearch":"No {searchCategory} Found",
"@noEntriesFoundSearch":{
"description":"Title of Search Category",
"noEntriesFound":"No {category} Found!",
"@noEntriesFound":{
"description":"Category",
"placeholders":{
"searchCategory":{
"category":{
"type":"String",
"example":"Grades"
}
Expand All @@ -219,7 +214,6 @@
"search":"Search",
"today":"Today",
"tomorrow":"Tomorrow",
"noMapsFound":"No Maps Found",
"roomSearch":"Room Search",
"personSearch":"Person Search",
"badResponse":"Bad Response",
Expand Down
38 changes: 20 additions & 18 deletions lib/base/networking/base/rest_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,16 @@ class RESTClient {
if (body.headers["content-type"]?.first.contains("xml") ?? false) {
final transformer = Xml2Json();
transformer.parse(decoded);
return transformer.toParkerWithAttrsCustom(
array: [
"row",
"event",
"studium",
"raeume",
"gruppen",
"telefon_nebenstellen",
],
return transformer.toParkerWithAttrs(
entries: {
"row": "rowset",
"event": "events",
"studium": "studien",
"raum": "raeume",
"gruppe": "gruppen",
"nebenstelle": "telefon_nebenstellen",
"card": "cards",
},
);
} else {
return decoded;
Expand Down Expand Up @@ -85,15 +86,16 @@ class RESTClient {
if (body.headers["content-type"]?.first.contains("xml") ?? false) {
final transformer = Xml2Json();
transformer.parse(decoded);
return transformer.toParkerWithAttrsCustom(
array: [
"row",
"event",
"studium",
"raeume",
"gruppen",
"telefon_nebenstellen",
],
return transformer.toParkerWithAttrs(
entries: {
"row": "rowset",
"event": "events",
"studium": "studien",
"raum": "raeume",
"gruppe": "gruppen",
"nebenstelle": "telefon_nebenstellen",
"card": "cards",
},
);
} else {
return decoded;
Expand Down
17 changes: 3 additions & 14 deletions lib/calendarComponent/model/calendar_event.dart
Original file line number Diff line number Diff line change
Expand Up @@ -111,23 +111,12 @@ class CalendarEvent extends Searchable {
Map<String, dynamic> toJson() => _$CalendarEventToJson(this);
}

@JsonSerializable()
class CalendarEventsData {
final CalendarEvents? events;

CalendarEventsData({required this.events});

factory CalendarEventsData.fromJson(Map<String, dynamic> json) =>
_$CalendarEventsDataFromJson(json);

Map<String, dynamic> toJson() => _$CalendarEventsDataToJson(this);
}

@JsonSerializable()
class CalendarEvents {
final List<CalendarEvent> event;
@JsonKey(name: "event", defaultValue: [])
final List<CalendarEvent> events;

CalendarEvents({required this.event});
CalendarEvents({required this.events});

factory CalendarEvents.fromJson(Map<String, dynamic> json) =>
_$CalendarEventsFromJson(json);
Expand Down
21 changes: 5 additions & 16 deletions lib/calendarComponent/model/calendar_event.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions lib/calendarComponent/services/calendar_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ class CalendarService {
bool forcedRefresh,
) async {
RESTClient restClient = getIt<RESTClient>();
final response = await restClient.getWithException<CalendarEventsData,
TumOnlineApi, TumOnlineApiException>(
final response = await restClient
.getWithException<CalendarEvents, TumOnlineApi, TumOnlineApiException>(
TumOnlineApi(TumOnlineServiceCalendar()),
CalendarEventsData.fromJson,
CalendarEvents.fromJson,
TumOnlineApiException.fromJson,
forcedRefresh,
);
return (response.saved, response.data.events?.event ?? []);
return (response.saved, response.data.events);
}

static Future<CalendarCreationConfirmation> createCalendarEvent(
Expand Down
4 changes: 2 additions & 2 deletions lib/calendarComponent/viewModels/calendar_viewmodel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class CalendarViewModel {

final filteredEvents = events.value
?.where(
(element) => element.startDate.isBefore(
(element) => element.startDate.isAfter(
DateTime.now(),
),
)
Expand All @@ -40,7 +40,7 @@ class CalendarViewModel {
final currentDay =
DateTime(currentDate.year, currentDate.month, currentDate.day);

for (CalendarEvent event in events.value ?? []) {
for (CalendarEvent event in filteredEvents) {
final dateToCheck = DateTime(
event.startDate.year,
event.startDate.month,
Expand Down
1 change: 0 additions & 1 deletion lib/calendarComponent/views/calendar_day_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ class CalendarDayView extends ConsumerWidget {
},
headerDateFormat: "EEEE, dd.MM.yyyy",
showNavigationArrow: true,
maxDate: getIt<CalendarViewService>().maxDate(ref),
timeSlotViewSettings: const TimeSlotViewSettings(
startHour: 7,
endHour: 22,
Expand Down
1 change: 0 additions & 1 deletion lib/calendarComponent/views/calendar_month_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ class CalendarMonthView extends ConsumerWidget {
firstDayOfWeek: 1,
showDatePickerButton: true,
showNavigationArrow: true,
maxDate: getIt<CalendarViewService>().maxDate(ref),
onTap: (details) {
if (details.targetElement == CalendarElement.appointment) {
getIt<CalendarViewService>().showDetails(
Expand Down
1 change: 0 additions & 1 deletion lib/calendarComponent/views/calendar_week_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ class CalendarWeekView extends ConsumerWidget {
headerDateFormat: "",
showWeekNumber: true,
showNavigationArrow: true,
maxDate: getIt<CalendarViewService>().maxDate(ref),
timeSlotViewSettings: const TimeSlotViewSettings(
startHour: 7,
endHour: 22,
Expand Down
15 changes: 1 addition & 14 deletions lib/gradeComponent/model/average_grade.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,9 @@ class AverageGrade {
Map<String, dynamic> toJson() => _$AverageGradeToJson(this);
}

@JsonSerializable()
class AverageGradeResponse {
@JsonKey(name: "studien")
final AverageGrades? averageGradeData;

AverageGradeResponse({required this.averageGradeData});

factory AverageGradeResponse.fromJson(Map<String, dynamic> json) =>
_$AverageGradeResponseFromJson(json);

Map<String, dynamic> toJson() => _$AverageGradeResponseToJson(this);
}

@JsonSerializable()
class AverageGrades {
@JsonKey(name: "studium")
@JsonKey(name: "studium", defaultValue: [])
final List<AverageGrade> averageGrades;

AverageGrades({required this.averageGrades});
Expand Down
21 changes: 4 additions & 17 deletions lib/gradeComponent/model/average_grade.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1641973

Please sign in to comment.