Skip to content

Commit

Permalink
#141 extend options to 24 hours and optimize code
Browse files Browse the repository at this point in the history
  • Loading branch information
KlausRicharz committed Jun 15, 2022
1 parent 40a2f3a commit ad11325
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/main/java/org/tb/common/DateTimeViewHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
public class DateTimeViewHelper {

private static final Map<Year, List<OptionItem>> calendarWeeksCache = new HashMap<>();
public static final int MAX_TIME_REPORT_HOUR = 24;
public static final int MIN_TIME_REPORT_HOUR = 0;
public static final int MIN_TIME_REPORT_MINUTE = 0;
public static final int MAX_TIME_REPORT_MINUTE = 59;

/*
* builds up a list of string with current and previous year
Expand Down Expand Up @@ -102,15 +106,15 @@ public static List<OptionItem> getBreakHoursOptions() {
* builds up a list of string with duration hours to display (0-23)
*/
public static List<OptionItem> getTimeReportHoursOptions() {
return getOptionItemListOfInts(0, 23);
return getOptionItemListOfInts(MIN_TIME_REPORT_HOUR, MAX_TIME_REPORT_HOUR);
}

/*
* builds up a list of string with minutes to display (05-55)
*/
public static List<OptionItem> getTimeReportMinutesOptions(boolean showAllMinutes) {
if(showAllMinutes) {
return getOptionItemListOfInts(0, 59);
return getOptionItemListOfInts(MIN_TIME_REPORT_MINUTE, MAX_TIME_REPORT_MINUTE);
}
List<OptionItem> result = new ArrayList<>();
for (int i = 0; i < 60; i+=5) {
Expand Down

0 comments on commit ad11325

Please sign in to comment.