feat: 연장근무를 해당월 토요일 횟수 기본값으로 표시

- 기존: 실제 근무한 토요일만 계산

- 변경: 해당 월의 토요일 개수 × 2시간으로 기본 표시

- 예: 4개 토요일 → 8시간, 5개 토요일 → 10시간

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
2026-03-13 06:48:50 +09:00
parent 9819af3111
commit e62f21c86a

View File

@@ -110,17 +110,21 @@ class ShiftRepository(private val context: Context) {
}
suspend fun getSaturdayOvertimeHours(): Int = withContext(Dispatchers.IO) {
val currentYear = LocalDate.now().year
val allOverrides = dao.getAllOverrides()
val today = LocalDate.now()
val yearMonth = java.time.YearMonth.of(today.year, today.monthValue)
val saturdayWorkDays = allOverrides.filter { override ->
val date = LocalDate.parse(override.date)
date.year == currentYear &&
date.dayOfWeek == java.time.DayOfWeek.SATURDAY &&
override.shift != "휴무" &&
override.shift != "휴가"
// 해당 월의 토요일 개수 계산
var saturdayCount = 0
var date = yearMonth.atDay(1)
val lastDay = yearMonth.atEndOfMonth()
while (!date.isAfter(lastDay)) {
if (date.dayOfWeek == java.time.DayOfWeek.SATURDAY) {
saturdayCount++
}
date = date.plusDays(1)
}
saturdayWorkDays.size * 2
saturdayCount * 2
}
}