diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2016-09-26 22:27:15 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2016-09-26 22:27:15 +1300 |
commit | ccd4a65a4954bcd7d2c38b806440bb766c51b0e2 (patch) | |
tree | 4f0acc8410583dea3ca9c8cbb0b37a28bd2d547c /src/org/traccar/database | |
parent | 53bcb5c788e6b24bf8f6f631445b61a87c5f715f (diff) | |
download | traccar-server-ccd4a65a4954bcd7d2c38b806440bb766c51b0e2.tar.gz traccar-server-ccd4a65a4954bcd7d2c38b806440bb766c51b0e2.tar.bz2 traccar-server-ccd4a65a4954bcd7d2c38b806440bb766c51b0e2.zip |
Change statistics calculation logic
Diffstat (limited to 'src/org/traccar/database')
-rw-r--r-- | src/org/traccar/database/StatisticsManager.java | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/src/org/traccar/database/StatisticsManager.java b/src/org/traccar/database/StatisticsManager.java index b21380332..b9af4d9b7 100644 --- a/src/org/traccar/database/StatisticsManager.java +++ b/src/org/traccar/database/StatisticsManager.java @@ -27,7 +27,7 @@ import java.util.Set; public class StatisticsManager { - private static final int SPLIT_MODE = Calendar.MINUTE; + private static final int SPLIT_MODE = Calendar.DAY_OF_MONTH; private int lastUpdate = Calendar.getInstance().get(SPLIT_MODE); @@ -64,19 +64,12 @@ public class StatisticsManager { } } - public synchronized void registerUser(long userId) { - checkSplit(); - users.add(userId); - } - - public synchronized void registerDevice(long deviceId) { - checkSplit(); - devices.add(deviceId); - } - - public synchronized void registerRequest() { + public synchronized void registerRequest(long userId) { checkSplit(); requests += 1; + if (userId != 0) { + users.add(userId); + } } public synchronized void registerMessageReceived() { @@ -84,9 +77,12 @@ public class StatisticsManager { messagesReceived += 1; } - public synchronized void registerMessageStored() { + public synchronized void registerMessageStored(long deviceId) { checkSplit(); messagesStored += 1; + if (deviceId != 0) { + devices.add(deviceId); + } } } |