mirror of
https://github.com/traccar/traccar.git
synced 2025-01-09 04:07:38 +08:00
Summary report start and end hours
This commit is contained in:
parent
b9445651c5
commit
bcbc081507
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2023 Anton Tananaev (anton@traccar.org)
|
||||
* Copyright 2016 - 2024 Anton Tananaev (anton@traccar.org)
|
||||
* Copyright 2016 Andrey Kunitsyn (andrey@traccar.org)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -106,9 +106,10 @@ public class SummaryReportProvider {
|
||||
result.setSpentFuel(reportUtils.calculateFuel(first, last));
|
||||
|
||||
if (first.hasAttribute(Position.KEY_HOURS) && last.hasAttribute(Position.KEY_HOURS)) {
|
||||
long durationMilliseconds = last.getLong(Position.KEY_HOURS) - first.getLong(Position.KEY_HOURS);
|
||||
result.setEngineHours(durationMilliseconds);
|
||||
result.setAverageSpeed(UnitsConverter.knotsFromMps(result.getDistance() * 1000 / durationMilliseconds));
|
||||
result.setStartHours(first.getLong(Position.KEY_HOURS));
|
||||
result.setEndHours(last.getLong(Position.KEY_HOURS));
|
||||
result.setAverageSpeed(UnitsConverter.knotsFromMps(
|
||||
result.getDistance() * 1000 / result.getEngineHours()));
|
||||
}
|
||||
|
||||
if (!ignoreOdometer
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2020 Anton Tananaev (anton@traccar.org)
|
||||
* Copyright 2016 - 2024 Anton Tananaev (anton@traccar.org)
|
||||
* Copyright 2016 - 2017 Andrey Kunitsyn (andrey@traccar.org)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -18,13 +18,28 @@ package org.traccar.reports.model;
|
||||
|
||||
public class SummaryReportItem extends BaseReportItem {
|
||||
|
||||
private long engineHours; // milliseconds
|
||||
|
||||
public long getEngineHours() {
|
||||
return engineHours;
|
||||
return endHours - startHours;
|
||||
}
|
||||
|
||||
public void setEngineHours(long engineHours) {
|
||||
this.engineHours = engineHours;
|
||||
private long startHours; // milliseconds
|
||||
|
||||
public long getStartHours() {
|
||||
return startHours;
|
||||
}
|
||||
|
||||
public void setStartHours(long startHours) {
|
||||
this.startHours = startHours;
|
||||
}
|
||||
|
||||
private long endHours; // milliseconds
|
||||
|
||||
public long getEndHours() {
|
||||
return endHours;
|
||||
}
|
||||
|
||||
public void setEndHours(long endHours) {
|
||||
this.endHours = endHours;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user