mirror of
https://github.com/robertvokac/time-calc.git
synced 2025-03-25 07:27:49 +01:00
Fixed some bugs
This commit is contained in:
parent
cfc945d182
commit
1f18d57c6b
@ -184,7 +184,8 @@ Smileys can be colored or white-black (can be set in configuration)
|
|||||||
## Command button
|
## Command button
|
||||||
|
|
||||||
## Todos
|
## Todos
|
||||||
|
* New table: YEAR
|
||||||
|
* Text field : +- buttons
|
||||||
* Split to Maven modules
|
* Split to Maven modules
|
||||||
* Junit, Mockito, etc.
|
* Junit, Mockito, etc.
|
||||||
* Checkstyle
|
* Checkstyle
|
||||||
|
@ -600,8 +600,8 @@ public class MainWindow extends TWindow {
|
|||||||
}
|
}
|
||||||
workingDay.setArrivalHour(arrival_.getHour());
|
workingDay.setArrivalHour(arrival_.getHour());
|
||||||
workingDay.setArrivalMinute(arrival_.getMinute());
|
workingDay.setArrivalMinute(arrival_.getMinute());
|
||||||
workingDay.setOvertimeHour(overtime_.getHour());
|
workingDay.setOvertimeHour(overtime_.getHour() * (overtime_.isNegative() ? (-1) : 1));
|
||||||
workingDay.setOvertimeMinute(overtime_.getMinute());
|
workingDay.setOvertimeMinute(overtime_.getMinute() * (overtime_.isNegative() ? (-1) : 1));
|
||||||
workingDay.setWorkingTimeInMinutes(work_.toTotalMilliseconds() / 1000 / 60);
|
workingDay.setWorkingTimeInMinutes(work_.toTotalMilliseconds() / 1000 / 60);
|
||||||
workingDay.setPauseTimeInMinutes(pause_.toTotalMilliseconds() / 1000 / 60);
|
workingDay.setPauseTimeInMinutes(pause_.toTotalMilliseconds() / 1000 / 60);
|
||||||
workingDay.setNote(noteTextField.getText());
|
workingDay.setNote(noteTextField.getText());
|
||||||
@ -648,8 +648,8 @@ public class MainWindow extends TWindow {
|
|||||||
wd.setArrivalHour(arrival_.getHour());
|
wd.setArrivalHour(arrival_.getHour());
|
||||||
wd.setArrivalMinute(arrival_.getMinute());
|
wd.setArrivalMinute(arrival_.getMinute());
|
||||||
|
|
||||||
wd.setOvertimeHour(overtime_.getHour());
|
wd.setOvertimeHour(overtime_.getHour() * (overtime_.isNegative() ? (-1) : 1));
|
||||||
wd.setOvertimeMinute(overtime_.getMinute());
|
wd.setOvertimeMinute(overtime_.getMinute() * (overtime_.isNegative() ? (-1) : 1));
|
||||||
|
|
||||||
workingDayRepository.update(wd);
|
workingDayRepository.update(wd);
|
||||||
|
|
||||||
|
@ -169,11 +169,12 @@ public class WorkingDaysWindow extends TWindow {
|
|||||||
list2.add(E);
|
list2.add(E);
|
||||||
} else {
|
} else {
|
||||||
list2.add(wdfs.getDayOfWeekAsString());
|
list2.add(wdfs.getDayOfWeekAsString());
|
||||||
|
TTime overtime = new TTime(wdfs.getOvertimeHour(), wdfs.getOvertimeMinute());
|
||||||
list2.add(wdfs.getDayOfWeek() == 6 || wdfs.getDayOfWeek() == 7 ? YES : NO);
|
list2.add(wdfs.getDayOfWeek() == 6 || wdfs.getDayOfWeek() == 7 ? YES : NO);
|
||||||
list2.add(wdfs.getId());
|
list2.add(wdfs.getId());
|
||||||
list2.add(new TTime(wdfs.getArrivalHour(), wdfs.getArrivalMinute()).toString().substring(0, 5));
|
list2.add(new TTime(wdfs.getArrivalHour(), wdfs.getArrivalMinute()).toString().substring(0, 5));
|
||||||
list2.add(new TTime(wdfs.getDepartureHour(), wdfs.getDepartureMinute()).toString().substring(0, 5));
|
list2.add(new TTime(wdfs.getDepartureHour(), wdfs.getDepartureMinute()).toString().substring(0, 5));
|
||||||
list2.add(new TTime(wdfs.getOvertimeHour(), wdfs.getOvertimeMinute()).toString().substring(0, 5));
|
list2.add(overtime.toString().substring(0, overtime.isNegative() ? 6 : 5));
|
||||||
list2.add(TTime.ofMinutes(wdfs.getWorkingTimeInMinutes()).toString().substring(0, 5));
|
list2.add(TTime.ofMinutes(wdfs.getWorkingTimeInMinutes()).toString().substring(0, 5));
|
||||||
list2.add(TTime.ofMinutes(wdfs.getPauseTimeInMinutes()).toString().substring(0, 5));
|
list2.add(TTime.ofMinutes(wdfs.getPauseTimeInMinutes()).toString().substring(0, 5));
|
||||||
list2.add(wdfs.getNote());
|
list2.add(wdfs.getNote());
|
||||||
|
@ -104,7 +104,7 @@ public class TTime implements Comparable<TTime> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public TTime(int hourIn, int minuteIn, int secondIn, int millisecondIn) {
|
public TTime(int hourIn, int minuteIn, int secondIn, int millisecondIn) {
|
||||||
this(false, hourIn, minuteIn, secondIn, millisecondIn);
|
this(hourIn < 0 || minuteIn < 0 || secondIn < 0 || millisecondIn < 0, Math.abs(hourIn), Math.abs(minuteIn), Math.abs(secondIn), Math.abs(millisecondIn));
|
||||||
}
|
}
|
||||||
|
|
||||||
public TTime(boolean negative, int hourIn, int minuteIn, int secondIn, int millisecondIn) {
|
public TTime(boolean negative, int hourIn, int minuteIn, int secondIn, int millisecondIn) {
|
||||||
@ -148,20 +148,13 @@ public class TTime implements Comparable<TTime> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public TTime add(TTime tTimeToBeAdded) {
|
public TTime add(TTime tTimeToBeAdded) {
|
||||||
TTime result = this.cloneInstance();
|
TTime time1 = this;
|
||||||
if (result.isNegative()) {
|
TTime time2 = tTimeToBeAdded;
|
||||||
result.setNegative(false);
|
int totalMilliseconds1 = time1.toTotalMilliseconds();
|
||||||
result = result.remove(tTimeToBeAdded);
|
int totalMilliseconds2 = time2.toTotalMilliseconds();
|
||||||
result.setNegative(result.toTotalMilliseconds() != 0);
|
int result = totalMilliseconds1 + totalMilliseconds2;
|
||||||
return result;
|
return TTime.ofMilliseconds(result);
|
||||||
}
|
|
||||||
Calendar cal = asCalendar();
|
|
||||||
cal.add(Calendar.HOUR_OF_DAY, tTimeToBeAdded.hour);
|
|
||||||
cal.add(Calendar.MINUTE, tTimeToBeAdded.minute);
|
|
||||||
cal.add(Calendar.SECOND, tTimeToBeAdded.second);
|
|
||||||
cal.add(Calendar.MILLISECOND, tTimeToBeAdded.millisecond);
|
|
||||||
result = TTime.of(cal);
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int countDiffInMinutes(TTime startTime, TTime endTime) {
|
public static int countDiffInMinutes(TTime startTime, TTime endTime) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user