mirror of
https://github.com/robertvokac/time-calc.git
synced 2025-03-25 07:27:49 +01:00
Added several improvements, changes and bug fixes
This commit is contained in:
parent
f4717913b6
commit
402ff5b0a5
10
Readme.md
10
Readme.md
@ -184,14 +184,20 @@ Smileys can be colored or white-black (can be set in configuration)
|
|||||||
## Command button
|
## Command button
|
||||||
|
|
||||||
## Todos
|
## Todos
|
||||||
* New table: YEAR
|
|
||||||
|
### New features
|
||||||
|
|
||||||
* Custom arrival target
|
* Custom arrival target
|
||||||
* Split to Maven modules
|
* Split to Maven modules
|
||||||
* Junit, Mockito, etc.
|
* Junit, Mockito, etc.
|
||||||
* Checkstyle
|
* Checkstyle
|
||||||
* Sonarlint
|
* Sonarlint
|
||||||
* Sonarqube
|
* Sonarqube
|
||||||
* Add SQLite support and store times of arrivals and departures and time of activities
|
|
||||||
|
### Fix these known bugs
|
||||||
|
|
||||||
|
* Clock, square and circle are grey, if visibility mode is weakly colored.
|
||||||
|
* Decreasing real time sometimes does not work correctly.
|
||||||
|
|
||||||
## For Developers
|
## For Developers
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ import lombok.ToString;
|
|||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@ToString
|
@ToString
|
||||||
public class Activity {
|
public class Activity implements Comparable<Activity> {
|
||||||
|
|
||||||
private static final String SUBJECT_FIELD_SEPARATOR = " : ";
|
private static final String SUBJECT_FIELD_SEPARATOR = " : ";
|
||||||
|
|
||||||
@ -28,6 +28,7 @@ public class Activity {
|
|||||||
private int spentHours;
|
private int spentHours;
|
||||||
private int spentMinutes;
|
private int spentMinutes;
|
||||||
private String flags;
|
private String flags;
|
||||||
|
private String nextActivityId;
|
||||||
|
|
||||||
public String createSubject() {
|
public String createSubject() {
|
||||||
return ticket + SUBJECT_FIELD_SEPARATOR + name;
|
return ticket + SUBJECT_FIELD_SEPARATOR + name;
|
||||||
@ -56,6 +57,28 @@ public class Activity {
|
|||||||
set.remove(flag);
|
set.remove(flag);
|
||||||
this.flags = set.stream().collect(Collectors.joining(":"));
|
this.flags = set.stream().collect(Collectors.joining(":"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compareTo(Activity o) {
|
||||||
|
|
||||||
|
int result = Integer.valueOf(year).compareTo(Integer.valueOf(o.year));
|
||||||
|
if(result != 0) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
result = Integer.valueOf(month).compareTo(Integer.valueOf(o.month));
|
||||||
|
if(result != 0) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
result = Integer.valueOf(day).compareTo(Integer.valueOf(o.day));
|
||||||
|
if(result != 0) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
if(this.nextActivityId != null && this.nextActivityId.equals(o.getId())) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if(o.nextActivityId != null && o.nextActivityId.equals(o.getId())) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package org.nanoboot.utils.timecalc.persistence.api;
|
package org.nanoboot.utils.timecalc.persistence.api;
|
||||||
|
|
||||||
import org.nanoboot.utils.timecalc.entity.Activity;
|
import org.nanoboot.utils.timecalc.entity.Activity;
|
||||||
import org.nanoboot.utils.timecalc.entity.WorkingDay;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -13,11 +12,13 @@ public interface ActivityRepositoryApi {
|
|||||||
|
|
||||||
void create(Activity activity);
|
void create(Activity activity);
|
||||||
|
|
||||||
|
Activity getLastActivityForDay(int year, int month, int day);
|
||||||
|
|
||||||
List<Activity> list(int year, int month, int day);
|
List<Activity> list(int year, int month, int day);
|
||||||
|
|
||||||
void update(Activity activity);
|
void update(Activity activity);
|
||||||
|
|
||||||
WorkingDay read(String id);
|
Activity read(String id);
|
||||||
|
|
||||||
void delete(String id);
|
void delete(String id);
|
||||||
|
|
||||||
|
@ -4,8 +4,8 @@ import java.sql.Connection;
|
|||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
import java.sql.Types;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import org.nanoboot.utils.timecalc.entity.WorkingDay;
|
|
||||||
import org.nanoboot.utils.timecalc.persistence.api.ActivityRepositoryApi;
|
import org.nanoboot.utils.timecalc.persistence.api.ActivityRepositoryApi;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -23,17 +23,15 @@ public class ActivityRepositorySQLiteImpl implements ActivityRepositoryApi {
|
|||||||
public ActivityRepositorySQLiteImpl(SqliteConnectionFactory sqliteConnectionFactory) {
|
public ActivityRepositorySQLiteImpl(SqliteConnectionFactory sqliteConnectionFactory) {
|
||||||
this.sqliteConnectionFactory = sqliteConnectionFactory;
|
this.sqliteConnectionFactory = sqliteConnectionFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void create(Activity activity) {
|
public void create(Activity activity) {
|
||||||
|
Activity lastActivityForDay = getLastActivityForDay(activity.getYear(), activity.getMonth(), activity.getDay());
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb
|
sb
|
||||||
.append("INSERT INTO ")
|
.append("INSERT INTO ")
|
||||||
.append(ActivityTable.TABLE_NAME)
|
.append(ActivityTable.TABLE_NAME)
|
||||||
.append(" VALUES (?,?,?,?, ?,?,?,?,?)");
|
.append(" VALUES (?,?,?,?, ?,?,?,?,?,?)");
|
||||||
|
|
||||||
String sql = sb.toString();
|
String sql = sb.toString();
|
||||||
|
|
||||||
@ -52,6 +50,7 @@ public class ActivityRepositorySQLiteImpl implements ActivityRepositoryApi {
|
|||||||
stmt.setInt(++i, activity.getSpentHours());
|
stmt.setInt(++i, activity.getSpentHours());
|
||||||
stmt.setInt(++i, activity.getSpentMinutes());
|
stmt.setInt(++i, activity.getSpentMinutes());
|
||||||
stmt.setString(++i, activity.getFlags());
|
stmt.setString(++i, activity.getFlags());
|
||||||
|
stmt.setNull(++i, Types.VARCHAR);
|
||||||
|
|
||||||
//
|
//
|
||||||
stmt.execute();
|
stmt.execute();
|
||||||
@ -64,6 +63,11 @@ public class ActivityRepositorySQLiteImpl implements ActivityRepositoryApi {
|
|||||||
throw new TimeCalcException(ex);
|
throw new TimeCalcException(ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(lastActivityForDay != null) {
|
||||||
|
lastActivityForDay.setNextActivityId(activity.getId());
|
||||||
|
update(lastActivityForDay);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -72,7 +76,7 @@ public class ActivityRepositorySQLiteImpl implements ActivityRepositoryApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public WorkingDay read(String id) {
|
public Activity read(String id) {
|
||||||
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -244,6 +248,12 @@ public class ActivityRepositorySQLiteImpl implements ActivityRepositoryApi {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Activity getLastActivityForDay(int year, int month, int day) {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Activity> list(int year, int month, int day) {
|
public List<Activity> list(int year, int month, int day) {
|
||||||
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
||||||
|
@ -37,6 +37,7 @@ class ActivityTable {
|
|||||||
public static final String SPENT_HOURS = "SPENT_HOURS";
|
public static final String SPENT_HOURS = "SPENT_HOURS";
|
||||||
public static final String SPENT_MINUTES = "SPENT_MINUTES";
|
public static final String SPENT_MINUTES = "SPENT_MINUTES";
|
||||||
public static final String FLAGS = "FLAGS";
|
public static final String FLAGS = "FLAGS";
|
||||||
|
public static final String NEXT_ACTIVITY_ID = "NEXT_ACTIVITY_ID";
|
||||||
|
|
||||||
private ActivityTable() {
|
private ActivityTable() {
|
||||||
//Not meant to be instantiated.
|
//Not meant to be instantiated.
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
ALTER TABLE "ACTIVITY" ADD COLUMN "NEXT_ACTIVITY_ID" TEXT;
|
@ -184,13 +184,20 @@ Smileys can be colored or white-black (can be set in configuration)
|
|||||||
## Command button
|
## Command button
|
||||||
|
|
||||||
## Todos
|
## Todos
|
||||||
* New table: YEAR
|
|
||||||
|
### New features
|
||||||
|
|
||||||
|
* Custom arrival target
|
||||||
* Split to Maven modules
|
* Split to Maven modules
|
||||||
* Junit, Mockito, etc.
|
* Junit, Mockito, etc.
|
||||||
* Checkstyle
|
* Checkstyle
|
||||||
* Sonarlint
|
* Sonarlint
|
||||||
* Sonarqube
|
* Sonarqube
|
||||||
* Add SQLite support and store times of arrivals and departures and time of activities
|
|
||||||
|
### Fix these known bugs
|
||||||
|
|
||||||
|
* Clock, square and circle are grey, if visibility mode is weakly colored.
|
||||||
|
* Decreasing real time sometimes does not work correctly.
|
||||||
|
|
||||||
## For Developers
|
## For Developers
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user