Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

General updates #200

Merged
merged 12 commits into from
Jan 7, 2024
Prev Previous commit
Next Next commit
fix: Do not limit events when start and end times are provided
bdlukaa committed Jan 4, 2024
commit 69017cb972e8410c45b74b080335af2430752483
4 changes: 2 additions & 2 deletions lib/api/events.dart
Original file line number Diff line number Diff line change
@@ -32,7 +32,7 @@ extension EventsExtension on API {

return compute(_getEvents, {
'server': server,
'limit': await eventsLimit,
'limit': (startTime != null && endTime != null) ? -1 : await eventsLimit,
'startTime': startTime,
'endTime': endTime,
'device_id': device?.id,
@@ -46,10 +46,10 @@ extension EventsExtension on API {
return [];
}

final limit = (data['limit'] as int?) ?? -1;
var startTime = data['startTime'] as DateTime?;
final endTime = data['endTime'] as DateTime?;
final deviceId = data['device_id'] as int?;
final limit = (data['limit'] as int?) ?? -1;

if (startTime != null && endTime != null) {
if (startTime == endTime) {
9 changes: 7 additions & 2 deletions lib/widgets/events/events_screen.dart
Original file line number Diff line number Diff line change
@@ -292,10 +292,15 @@ class EventsScreenState<T extends StatefulWidget> extends State<T> {
firstDate: DateTime(1970),
lastDate: DateTime.now(),
initialEntryMode: DatePickerEntryMode.calendarOnly,
initialDateRange: startTime == null || endTime == null
? null
: DateTimeRange(start: startTime!, end: endTime!),
);
if (range != null) {
startTime = range.start;
endTime = range.end;
setState(() {
startTime = range.start;
endTime = range.end;
});
onSelect?.call();
}
},