feat: 토요일 연장근무 계산 기능 추가
- ShiftRepository에 getSaturdayOvertimeHours() 메소드 추가 - FragmentSettingsLab에 토요일 연장근무 시간 표시 카드 추가 - 토요일 수 * 2시간 계산 로직 구현 Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -31,6 +31,7 @@ class FragmentSettingsLab : Fragment() {
|
||||
|
||||
setupSpinner()
|
||||
loadAnnualLeave()
|
||||
loadSaturdayOvertime()
|
||||
}
|
||||
|
||||
private fun setupSpinner() {
|
||||
@@ -106,6 +107,14 @@ class FragmentSettingsLab : Fragment() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun loadSaturdayOvertime() {
|
||||
lifecycleScope.launch {
|
||||
val repo = ShiftRepository(requireContext())
|
||||
val overtimeHours = repo.getSaturdayOvertimeHours()
|
||||
binding.tvSaturdayOvertime.text = "$overtimeHours"
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
_binding = null
|
||||
|
||||
@@ -108,4 +108,19 @@ class ShiftRepository(private val context: Context) {
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun getSaturdayOvertimeHours(): Int = withContext(Dispatchers.IO) {
|
||||
val currentYear = LocalDate.now().year
|
||||
val allOverrides = dao.getAllOverrides()
|
||||
|
||||
val saturdayWorkDays = allOverrides.filter { override ->
|
||||
val date = LocalDate.parse(override.date)
|
||||
date.year == currentYear &&
|
||||
date.dayOfWeek == java.time.DayOfWeek.SATURDAY &&
|
||||
override.shift != "휴무" &&
|
||||
override.shift != "휴가"
|
||||
}
|
||||
|
||||
saturdayWorkDays.size * 2
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,14 +123,64 @@
|
||||
android:layout_marginBottom="8dp"
|
||||
android:gravity="center"/>
|
||||
|
||||
<!-- 기능추가중 Notice -->
|
||||
<!-- Saturday Overtime Display -->
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="16dp"
|
||||
app:cardCornerRadius="12dp"
|
||||
app:cardElevation="2dp"
|
||||
app:cardBackgroundColor="@color/surface">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:padding="16dp"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="토요일 연장근무"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/text_secondary"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="bottom">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvSaturdayOvertime"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="0"
|
||||
android:textSize="28sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/shift_red"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="시간"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/text_tertiary"
|
||||
android:layout_marginStart="4dp"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<!-- Calculation Info -->
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="기능추가중"
|
||||
android:textSize="11sp"
|
||||
android:textColor="@color/primary"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:text="※ 토요일 근무: 1일당 2시간 연장근무 계산"
|
||||
android:textSize="12sp"
|
||||
android:textColor="@color/text_tertiary"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:gravity="center"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
Reference in New Issue
Block a user