#1099: AITimeSavings.kt
projectforge-business/src/main/kotlin/org/projectforge/business/timesheet/AITimeSavings.kt Calculation Utility / Timesheet AI, projectforge-business/src/main/kotlin/org/projectforge/business/timesheet/AITimeSavings.kt 181 lines · 87 code · 78 comments · 16 blank
Central utility object for calculating and formatting AI time savings. Converts between two savings unit modes: HOURS (absolute value in hours to milliseconds) and PERCENTAGE (percentage of duration, formula: pct * duration / (100 - pct), capped at 99%). Provides getTimeSavedByAIMillis() and getTimeSavedByAIMillisOrNull(). Formatting: getFormattedTimeSavedByAI() produces "d:hh, pct" strings (e.g. "0:30h, 5,7 %"). getFormattedPercentage() with scale=1 for <10%, scale=0 otherwise. getPercentage() uses NumberHelper.getPercent with total= duration + savings. getFraction() returns savings fraction. Inner Stats class accumulates across timesheet collections. Feature gated by timeSavingsByAIEnabled flag set by TimesheetDao.
Git History
868d6abb7 2025 -> 2026
3c439391c Timesheet: recent entries (display of kost2, project and customer) fixed. Timesheet: ai unit is preset by recent entry. Timesheet-Excel-Export: AI-savings added.
c21d9772b VacationDao: NPE fix. AITimeSavings.getFraction(...) added (by adding NumberHelper.getFraction(...).
978ca42e3 Forecast improved, html package extended.
7d02643e2 AITimeSavings: calculation fixed.
ee53d43df AI savings: calculation of percent modified, TimesheetDO @Enumerated in database for unit. TimePeriod.getDurationFields rounds now seconds and minutes (half up).
47d42a5bb AI savings: mass update of time-sheets, editing in classic page added, further improvements. Mass-update: Excel sheet with modifications is now stored in the user's personal DataTransfer box.
2ec065b52 WIP: time savings by AI: TimesheetListPage, MonthlyEmployeeReport