removed clutter

This commit is contained in:
2025-07-28 09:27:07 +02:00
parent dc99ca2ee4
commit 4581cec622

View File

@@ -28,24 +28,16 @@ public class DrinkingBar {
System.out.print("Ankunftszeit: ");
var startTime = LocalTime.parse(br.readLine(), TIME_FORMATTER).truncatedTo(ChronoUnit.MINUTES);
long totalMinutes = 8 * MINS_PER_HOUR + MINS_PER_HALF_HOUR;
long passedMinutes = startTime.until(LocalTime.now().truncatedTo(ChronoUnit.MINUTES), ChronoUnit.MINUTES);
// long passedMinutes = 0; // DEBUG
boolean firstPrint = true;
double prevPrintedLitres = 0.0;
while (passedMinutes < totalMinutes) {
if (passedMinutes <= MINUTES_BEFORE_PAUSE || passedMinutes > MINUTES_WITH_PAUSE) {
double currentLitres = 2.0 / totalMinutes * passedMinutes;
double printedLitres = currentLitres - (currentLitres % 0.25) + 0.25;
String cursorReset = firstPrint ? "" : "\r";
if (firstPrint || printedLitres - prevPrintedLitres == 0.25) {
System.out.print(cursorReset + "Aktuelles Volumen: " + LITER_FORMAT.format(printedLitres) + "L");
}
double printedLitres = currentLitres - (currentLitres % 0.25);
System.out.print("\rAktuelles Volumen: " + LITER_FORMAT.format(printedLitres) + "L");
prevPrintedLitres = printedLitres;
if (firstPrint) {
firstPrint = false;
}
}
try {
var now = LocalTime.now();