diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/org/traccar/reports/Events.java | 22 | ||||
-rw-r--r-- | src/org/traccar/reports/Route.java | 22 | ||||
-rw-r--r-- | src/org/traccar/reports/Trips.java | 22 |
3 files changed, 30 insertions, 36 deletions
diff --git a/src/org/traccar/reports/Events.java b/src/org/traccar/reports/Events.java index 37bf7b227..77d995f56 100644 --- a/src/org/traccar/reports/Events.java +++ b/src/org/traccar/reports/Events.java @@ -98,20 +98,18 @@ public final class Events { iterator.remove(); } } - if (!events.isEmpty()) { - DeviceReport deviceEvents = new DeviceReport(); - Device device = Context.getIdentityManager().getDeviceById(deviceId); - deviceEvents.setDeviceName(device.getName()); - sheetNames.add(deviceEvents.getDeviceName()); - if (device.getGroupId() != 0) { - Group group = Context.getDeviceManager().getGroupById(device.getGroupId()); - if (group != null) { - deviceEvents.setGroupName(group.getName()); - } + DeviceReport deviceEvents = new DeviceReport(); + Device device = Context.getIdentityManager().getDeviceById(deviceId); + deviceEvents.setDeviceName(device.getName()); + sheetNames.add(deviceEvents.getDeviceName()); + if (device.getGroupId() != 0) { + Group group = Context.getDeviceManager().getGroupById(device.getGroupId()); + if (group != null) { + deviceEvents.setGroupName(group.getName()); } - deviceEvents.setObjects(events); - devicesEvents.add(deviceEvents); } + deviceEvents.setObjects(events); + devicesEvents.add(deviceEvents); } String templatePath = Context.getConfig().getString("report.templatesPath", "templates/export/"); diff --git a/src/org/traccar/reports/Route.java b/src/org/traccar/reports/Route.java index 7cefe04a3..6992c89cc 100644 --- a/src/org/traccar/reports/Route.java +++ b/src/org/traccar/reports/Route.java @@ -68,20 +68,18 @@ public final class Route { for (long deviceId: ReportUtils.getDeviceList(deviceIds, groupIds)) { Context.getPermissionsManager().checkDevice(userId, deviceId); Collection<Position> positions = Context.getDataManager().getPositions(deviceId, from, to); - if (positions != null && !positions.isEmpty()) { - DeviceReport deviceRoutes = new DeviceReport(); - Device device = Context.getIdentityManager().getDeviceById(deviceId); - deviceRoutes.setDeviceName(device.getName()); - sheetNames.add(deviceRoutes.getDeviceName()); - if (device.getGroupId() != 0) { - Group group = Context.getDeviceManager().getGroupById(device.getGroupId()); - if (group != null) { - deviceRoutes.setGroupName(group.getName()); - } + DeviceReport deviceRoutes = new DeviceReport(); + Device device = Context.getIdentityManager().getDeviceById(deviceId); + deviceRoutes.setDeviceName(device.getName()); + sheetNames.add(deviceRoutes.getDeviceName()); + if (device.getGroupId() != 0) { + Group group = Context.getDeviceManager().getGroupById(device.getGroupId()); + if (group != null) { + deviceRoutes.setGroupName(group.getName()); } - deviceRoutes.setObjects(positions); - devicesRoutes.add(deviceRoutes); } + deviceRoutes.setObjects(positions); + devicesRoutes.add(deviceRoutes); } String templatePath = Context.getConfig().getString("report.templatesPath", "templates/export/"); diff --git a/src/org/traccar/reports/Trips.java b/src/org/traccar/reports/Trips.java index 27863d877..705644849 100644 --- a/src/org/traccar/reports/Trips.java +++ b/src/org/traccar/reports/Trips.java @@ -187,20 +187,18 @@ public final class Trips { for (long deviceId: ReportUtils.getDeviceList(deviceIds, groupIds)) { Context.getPermissionsManager().checkDevice(userId, deviceId); Collection<TripReport> trips = detectTrips(deviceId, from, to); - if (!trips.isEmpty()) { - DeviceReport deviceTrips = new DeviceReport(); - Device device = Context.getIdentityManager().getDeviceById(deviceId); - deviceTrips.setDeviceName(device.getName()); - sheetNames.add(deviceTrips.getDeviceName()); - if (device.getGroupId() != 0) { - Group group = Context.getDeviceManager().getGroupById(device.getGroupId()); - if (group != null) { - deviceTrips.setGroupName(group.getName()); - } + DeviceReport deviceTrips = new DeviceReport(); + Device device = Context.getIdentityManager().getDeviceById(deviceId); + deviceTrips.setDeviceName(device.getName()); + sheetNames.add(deviceTrips.getDeviceName()); + if (device.getGroupId() != 0) { + Group group = Context.getDeviceManager().getGroupById(device.getGroupId()); + if (group != null) { + deviceTrips.setGroupName(group.getName()); } - deviceTrips.setObjects(detectTrips(deviceId, from, to)); - devicesTrips.add(deviceTrips); } + deviceTrips.setObjects(trips); + devicesTrips.add(deviceTrips); } String templatePath = Context.getConfig().getString("report.templatesPath", "templates/export/"); |