central evaluation of passed minutes
This commit is contained in:
@@ -64,6 +64,16 @@ public abstract class AbstractLoadingBar {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected long getPassedMinutes() {
|
||||||
|
return getPassedMinutes(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected long getPassedMinutes(boolean passedMinutesZero) {
|
||||||
|
return passedMinutesZero ? 0 : startTime.until(LocalTime.now().truncatedTo(ChronoUnit.MINUTES), ChronoUnit.MINUTES);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
protected void showLoadingBar() {
|
protected void showLoadingBar() {
|
||||||
showLoadingBar(false, false, 0);
|
showLoadingBar(false, false, 0);
|
||||||
}
|
}
|
||||||
@@ -90,10 +100,7 @@ public abstract class AbstractLoadingBar {
|
|||||||
|
|
||||||
|
|
||||||
private void showLoadingBar(boolean debug, boolean passedMinutesZero, long millisWaiting) {
|
private void showLoadingBar(boolean debug, boolean passedMinutesZero, long millisWaiting) {
|
||||||
long passedMinutes = startTime.until(LocalTime.now().truncatedTo(ChronoUnit.MINUTES), ChronoUnit.MINUTES);
|
long passedMinutes = getPassedMinutes(debug && passedMinutesZero);
|
||||||
if (debug && passedMinutesZero) {
|
|
||||||
passedMinutes = 0;
|
|
||||||
}
|
|
||||||
if (passedMinutes > totalMinutes) {
|
if (passedMinutes > totalMinutes) {
|
||||||
passedMinutes = totalMinutes;
|
passedMinutes = totalMinutes;
|
||||||
} else if (passedMinutes < 0) {
|
} else if (passedMinutes < 0) {
|
||||||
|
@@ -302,7 +302,12 @@ public class LoadingBar extends AbstractProgressBar {
|
|||||||
|
|
||||||
|
|
||||||
protected boolean hasMittagspauseArrived() {
|
protected boolean hasMittagspauseArrived() {
|
||||||
return getStartTime().until(LocalTime.now(), ChronoUnit.MINUTES) < DEFAULT_NUMBER_WORK_MINS_BEFORE_LUNCH;
|
return hasMittagspauseArrived(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected boolean hasMittagspauseArrived(boolean debugWithPassedMinutesZero) {
|
||||||
|
return getPassedMinutes(debugWithPassedMinutesZero) < DEFAULT_NUMBER_WORK_MINS_BEFORE_LUNCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user