public BigDecimal getDaysPerWeek() { return timeTrackingConfiguration.getDaysPerWeek(); }
private String getTimeLoggedString(long timeSpent) { final BigDecimal hoursPerDay = timeTrackingConfiguration.getHoursPerDay(); final BigDecimal daysPerWeek = timeTrackingConfiguration.getDaysPerWeek(); final BigDecimal secondsPerHour = BigDecimal.valueOf(DateUtils.Duration.HOUR.getSeconds()); final long secondsPerDay = hoursPerDay.multiply(secondsPerHour).longValueExact(); final long secondsPerWeek = daysPerWeek.multiply(hoursPerDay).multiply(secondsPerHour).longValueExact(); return DateUtils.getDurationStringSeconds(timeSpent, secondsPerDay, secondsPerWeek); } }
private TimeTrackingConfigurationBean createTimeTrackingConfiguration() { final double hoursPerDay = timeTrackingConfiguration.getHoursPerDay().doubleValue(); final double daysPerWeek = timeTrackingConfiguration.getDaysPerWeek().doubleValue(); final TimeTrackingConfiguration.TimeFormat timeFormat = timeTrackingConfiguration.getTimeFormat(); final TimeTrackingUnit timeTrackingUnit = getTimeTrackingUnit(); return new TimeTrackingConfigurationBean(hoursPerDay, daysPerWeek, timeFormat, timeTrackingUnit); }
private static String getTimeLoggedString(long timeSpent) { final BigDecimal hoursPerDay = getTimeTrackingConfiguration().getHoursPerDay(); final BigDecimal daysPerWeek = getTimeTrackingConfiguration().getDaysPerWeek(); final BigDecimal secondsPerHour = BigDecimal.valueOf(DateUtils.Duration.HOUR.getSeconds()); final long secondsPerDay = hoursPerDay.multiply(secondsPerHour).longValueExact(); final long secondsPerWeek = daysPerWeek.multiply(hoursPerDay).multiply(secondsPerHour).longValueExact(); return DateUtils.getDurationStringSeconds(timeSpent, secondsPerDay, secondsPerWeek); }
/** * Turn a duration string into the number of seconds that it represents, taking into account JIRA's configuration * (i.e. how many hours are in a day, how many days are in a week, etc) * * @param duration string in JIRA's duration format (i.e. "20h") * @param locale Locale to use when interpreting the duration string * @return number of seconds in the duration string * @throws InvalidDurationException when the duration cannot be parsed */ public Long parseDuration(final String duration, Locale locale) throws InvalidDurationException { //Retrieve the number of hours per day and number of days per week final BigDecimal hoursPerDay = timeTrackingConfiguration.getHoursPerDay(); final BigDecimal daysPerWeek = timeTrackingConfiguration.getDaysPerWeek(); final BigDecimal secondsPerHour = BigDecimal.valueOf(DateUtils.Duration.HOUR.getSeconds()); final long secondsPerDay = hoursPerDay.multiply(secondsPerHour).longValueExact(); final long secondsPerWeek = daysPerWeek.multiply(hoursPerDay).multiply(secondsPerHour).longValueExact(); return DurationUtils.getDurationSeconds(duration, secondsPerDay, secondsPerWeek, timeTrackingConfiguration.getDefaultUnit(), locale, TOKEN_MAP); }
velocityParams.put("daysPerWeek", getTimeTrackingConfiguration().getDaysPerWeek()); velocityParams.put("hoursPerDay", getTimeTrackingConfiguration().getHoursPerDay());