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
|
||||
|
||||
## Todos
|
||||
|
||||
* New table: YEAR
|
||||
* Text field : +- buttons
|
||||
* Split to Maven modules
|
||||
* Junit, Mockito, etc.
|
||||
* Checkstyle
|
||||
|
@ -600,8 +600,8 @@ public class MainWindow extends TWindow {
|
||||
}
|
||||
workingDay.setArrivalHour(arrival_.getHour());
|
||||
workingDay.setArrivalMinute(arrival_.getMinute());
|
||||
workingDay.setOvertimeHour(overtime_.getHour());
|
||||
workingDay.setOvertimeMinute(overtime_.getMinute());
|
||||
workingDay.setOvertimeHour(overtime_.getHour() * (overtime_.isNegative() ? (-1) : 1));
|
||||
workingDay.setOvertimeMinute(overtime_.getMinute() * (overtime_.isNegative() ? (-1) : 1));
|
||||
workingDay.setWorkingTimeInMinutes(work_.toTotalMilliseconds() / 1000 / 60);
|
||||
workingDay.setPauseTimeInMinutes(pause_.toTotalMilliseconds() / 1000 / 60);
|
||||
workingDay.setNote(noteTextField.getText());
|
||||
@ -648,8 +648,8 @@ public class MainWindow extends TWindow {
|
||||
wd.setArrivalHour(arrival_.getHour());
|
||||
wd.setArrivalMinute(arrival_.getMinute());
|
||||
|
||||
wd.setOvertimeHour(overtime_.getHour());
|
||||
wd.setOvertimeMinute(overtime_.getMinute());
|
||||
wd.setOvertimeHour(overtime_.getHour() * (overtime_.isNegative() ? (-1) : 1));
|
||||
wd.setOvertimeMinute(overtime_.getMinute() * (overtime_.isNegative() ? (-1) : 1));
|
||||
|
||||
workingDayRepository.update(wd);
|
||||
|
||||
|
@ -169,11 +169,12 @@ public class WorkingDaysWindow extends TWindow {
|
||||
list2.add(E);
|
||||
} else {
|
||||
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.getId());
|
||||
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.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.getPauseTimeInMinutes()).toString().substring(0, 5));
|
||||
list2.add(wdfs.getNote());
|
||||
|
@ -104,7 +104,7 @@ public class TTime implements Comparable<TTime> {
|
||||
}
|
||||
|
||||
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) {
|
||||
@ -148,20 +148,13 @@ public class TTime implements Comparable<TTime> {
|
||||
}
|
||||
|
||||
public TTime add(TTime tTimeToBeAdded) {
|
||||
TTime result = this.cloneInstance();
|
||||
if (result.isNegative()) {
|
||||
result.setNegative(false);
|
||||
result = result.remove(tTimeToBeAdded);
|
||||
result.setNegative(result.toTotalMilliseconds() != 0);
|
||||
return 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;
|
||||
TTime time1 = this;
|
||||
TTime time2 = tTimeToBeAdded;
|
||||
int totalMilliseconds1 = time1.toTotalMilliseconds();
|
||||
int totalMilliseconds2 = time2.toTotalMilliseconds();
|
||||
int result = totalMilliseconds1 + totalMilliseconds2;
|
||||
return TTime.ofMilliseconds(result);
|
||||
|
||||
}
|
||||
|
||||
public static int countDiffInMinutes(TTime startTime, TTime endTime) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user