implemented time tracking by clicking symbol at task.
next: stop running time, display running time in header Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
@@ -21,7 +21,7 @@ public class Time implements Mappable{
|
||||
private long id;
|
||||
private final long userId;
|
||||
private final String description, subject;
|
||||
private final State state;
|
||||
private State state;
|
||||
|
||||
public enum State{
|
||||
Started(10),
|
||||
@@ -88,9 +88,10 @@ public class Time implements Mappable{
|
||||
|
||||
public static Time of(ResultSet rs) throws SQLException {
|
||||
var startTimestamp = rs.getLong(START_TIME);
|
||||
var start = startTimestamp == 0 ? null : dateTimeOf(startTimestamp);
|
||||
var start = startTimestamp == 0 ? null : LocalDateTime.ofEpochSecond(startTimestamp,0,UTC);
|
||||
var endTimestamp = rs.getLong(END_TIME);
|
||||
var end = endTimestamp == 0 ? null : dateTimeOf(endTimestamp);
|
||||
|
||||
var end = endTimestamp == 0 ? null : LocalDateTime.ofEpochSecond(endTimestamp,0,UTC);
|
||||
|
||||
return new Time(
|
||||
rs.getLong(ID),
|
||||
@@ -120,8 +121,9 @@ public class Time implements Mappable{
|
||||
return state;
|
||||
}
|
||||
|
||||
public Time stop(LocalDateTime now) {
|
||||
end = now;
|
||||
public Time stop(LocalDateTime endTime) {
|
||||
end = endTime;
|
||||
state = State.Open;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -141,9 +143,9 @@ public class Time implements Mappable{
|
||||
map.put(SUBJECT,subject);
|
||||
map.put(DESCRIPTION,mapMarkdown(description));
|
||||
map.put(START_TIME,start.toString().replace("T"," "));
|
||||
map.put(END_TIME,end.toString().replace("T"," "));
|
||||
map.put(END_TIME,end == null ? null : end.toString().replace("T"," "));
|
||||
map.put(STATE,Map.of(STATUS_CODE,state.code,NAME,state.name()));
|
||||
map.put(DURATION,Duration.between(start,end).toMinutes()/60d);
|
||||
map.put(DURATION,end == null ? null : Duration.between(start,end).toMinutes()/60d);
|
||||
map.put(TASK_IDS,taskIds);
|
||||
return map;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user