fix: getTimeTable
This commit is contained in:
parent
632575c5a0
commit
75ba255726
@ -23,11 +23,11 @@ class ApiResponse<T> {
|
|||||||
bool cached;
|
bool cached;
|
||||||
|
|
||||||
ApiResponse(
|
ApiResponse(
|
||||||
this.response,
|
this.response,
|
||||||
this.statusCode,
|
this.statusCode,
|
||||||
this.err,
|
this.err,
|
||||||
this.cached,
|
this.cached,
|
||||||
);
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
@ -211,7 +211,7 @@ class KretaClient {
|
|||||||
try {
|
try {
|
||||||
(resp, statusCode) = await _authJson("GET",
|
(resp, statusCode) = await _authJson("GET",
|
||||||
"${KretaEndpoints.getTimeTable(model.iss!)}?"
|
"${KretaEndpoints.getTimeTable(model.iss!)}?"
|
||||||
"datumTol=$fromStr&datumIg=$toStr");
|
"datumTol=$fromStr&datumIg=$toStr");
|
||||||
|
|
||||||
if (statusCode >= 400) {
|
if (statusCode >= 400) {
|
||||||
if (cache != null) {
|
if (cache != null) {
|
||||||
@ -309,11 +309,9 @@ class KretaClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
lessons.sort((a, b) => a.start.compareTo(b.start));
|
lessons.sort((a, b) => a.start.compareTo(b.start));
|
||||||
lessons.where((lesson) =>
|
lessons = lessons.where((lesson) =>
|
||||||
lesson.end.millisecondsSinceEpoch <= from.millisecondsSinceEpoch
|
lesson.start.isAfter(from) && lesson.end.isBefore(to)
|
||||||
&&
|
).toList();
|
||||||
lesson.start.millisecondsSinceEpoch <= to.millisecondsSinceEpoch
|
|
||||||
);
|
|
||||||
|
|
||||||
return ApiResponse(lessons, 200, err, cached);
|
return ApiResponse(lessons, 200, err, cached);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user