Skip to content

Commit

Permalink
Rename event time field
Browse files Browse the repository at this point in the history
  • Loading branch information
tananaev committed Mar 8, 2021
1 parent 312cd7b commit e28ae51
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 8 deletions.
15 changes: 15 additions & 0 deletions schema/changelog-4.13.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.4.xsd"
logicalFilePath="changelog-4.13">

<changeSet author="author" id="changelog-4.13">

<renameColumn tableName="tc_events" columnDataType="TIMESTAMP" oldColumnName="servertime" newColumnName="eventtime" />

</changeSet>

</databaseChangeLog>
1 change: 1 addition & 0 deletions schema/changelog-master.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@
<include file="changelog-4.9.xml" relativeToChangelogFile="true" />
<include file="changelog-4.10.xml" relativeToChangelogFile="true" />
<include file="changelog-4.11.xml" relativeToChangelogFile="true" />
<include file="changelog-4.13.xml" relativeToChangelogFile="true" />

</databaseChangeLog>
2 changes: 1 addition & 1 deletion setup/default.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
</entry>

<entry key='database.selectEvents'>
SELECT * FROM tc_events WHERE deviceId = :deviceId AND serverTime BETWEEN :from AND :to ORDER BY serverTime
SELECT * FROM tc_events WHERE deviceId = :deviceId AND eventTime BETWEEN :from AND :to ORDER BY eventTime
</entry>

<entry key='database.selectStatistics'>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public void updateEvent(Event event, Position position) {
usersToForward.add(userId);
}
final Set<String> notificators = new HashSet<>();
for (long notificationId : getEffectiveNotifications(userId, deviceId, event.getServerTime())) {
for (long notificationId : getEffectiveNotifications(userId, deviceId, event.getEventTime())) {
Notification notification = getById(notificationId);
if (getById(notificationId).getType().equals(event.getType())) {
boolean filter = false;
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/org/traccar/model/Event.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public Event(String type, long deviceId, long positionId) {
public Event(String type, long deviceId) {
setType(type);
setDeviceId(deviceId);
this.serverTime = new Date();
this.eventTime = new Date();
}

public Event() {
Expand Down Expand Up @@ -62,14 +62,14 @@ public Event() {

public static final String TYPE_DRIVER_CHANGED = "driverChanged";

private Date serverTime;
private Date eventTime;

public Date getServerTime() {
return serverTime;
public Date getEventTime() {
return eventTime;
}

public void setServerTime(Date serverTime) {
this.serverTime = serverTime;
public void setEventTime(Date eventTime) {
this.eventTime = eventTime;
}

private long positionId;
Expand Down
Binary file modified templates/export/events.xlsx
Binary file not shown.

0 comments on commit e28ae51

Please sign in to comment.