updated min lunch duration calculation
This commit is contained in:
		@@ -96,8 +96,8 @@ public interface WorkdayLoadingBar {
 | 
			
		||||
      if (endTimeOffset >= 0) {
 | 
			
		||||
         return MIN_LUNCH_DURATION;
 | 
			
		||||
      }
 | 
			
		||||
      long totalDuration = MAX_NUMBER_WORK_MINS + endTimeOffset;
 | 
			
		||||
      return getMinLunchDuration(totalDuration);
 | 
			
		||||
      long workDurationWithoutLunch = MAX_NUMBER_WORK_MINS + endTimeOffset;
 | 
			
		||||
      return getMinLunchDuration(workDurationWithoutLunch);
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -105,17 +105,20 @@ public interface WorkdayLoadingBar {
 | 
			
		||||
      if (manualEndTime == null) {
 | 
			
		||||
         return MIN_LUNCH_DURATION;
 | 
			
		||||
      }
 | 
			
		||||
      long totalDuration = getStartTime().until(manualEndTime, ChronoUnit.MINUTES);
 | 
			
		||||
      return getMinLunchDuration(totalDuration);
 | 
			
		||||
      long workDurationWithoutLunch = getStartTime().until(manualEndTime, ChronoUnit.MINUTES);
 | 
			
		||||
      return getMinLunchDuration(workDurationWithoutLunch);
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
   private long getMinLunchDuration(long precalculatedTotalDuration) {
 | 
			
		||||
      long effectiveLunchDuration = precalculatedTotalDuration - MAX_NUMBER_WORK_MINS_WITHOUT_LUNCH;
 | 
			
		||||
      if (effectiveLunchDuration < 0) {
 | 
			
		||||
   private long getMinLunchDuration(long workDurationWithoutLunch) {
 | 
			
		||||
      long effectiveLunchDuration = workDurationWithoutLunch - MAX_NUMBER_WORK_MINS_WITHOUT_LUNCH;
 | 
			
		||||
      /* if (effectiveLunchDuration < 0) {
 | 
			
		||||
            effectiveLunchDuration = 0;
 | 
			
		||||
         }
 | 
			
		||||
      return Math.min(effectiveLunchDuration, MIN_LUNCH_DURATION);
 | 
			
		||||
         // pro Minute ab 360 min (6 std.) 1 min Pause pro minute drüber bis 390 min Arbeitszeit + 30 min Pause
 | 
			
		||||
         return Math.min(effectiveLunchDuration, MIN_LUNCH_DURATION); */
 | 
			
		||||
      // ab 360 min (6 std.) 30 Pause bis 360 min Arbeitszeit + 30 min Pause, danach weiter Arbeitszeit
 | 
			
		||||
      return effectiveLunchDuration <= 0 ? 0 : MIN_LUNCH_DURATION;
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user