fix: 연차/반년 최초 적용 타이밍 문제 수정
- setOverride 후 updateRemainingAnnualLeave()를 먼저 호출하고 updateCalendar() 호출 - 연차 계산이 완료된 후 화면 갱신되도록 순서 변경 Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -213,15 +213,6 @@ class MainActivity : AppCompatActivity() {
|
|||||||
binding.tvAnnualLeave.text = "연차: --"
|
binding.tvAnnualLeave.text = "연차: --"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lifecycleScope.launch {
|
|
||||||
val repo = ShiftRepository(this@MainActivity)
|
|
||||||
val annualLeave = repo.getAnnualLeave()
|
|
||||||
annualLeave?.let {
|
|
||||||
binding.tvAnnualLeave.text = "연차: ${String.format("%.1f", it.remainingDays)}"
|
|
||||||
} ?: run {
|
|
||||||
binding.tvAnnualLeave.text = "연차: --"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showMonthYearPicker() {
|
private fun showMonthYearPicker() {
|
||||||
@@ -337,12 +328,6 @@ class MainActivity : AppCompatActivity() {
|
|||||||
binding.todayStatusText.setTextColor(androidx.core.content.ContextCompat.getColor(this@MainActivity, R.color.text_secondary))
|
binding.todayStatusText.setTextColor(androidx.core.content.ContextCompat.getColor(this@MainActivity, R.color.text_secondary))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update Annual Leave display
|
|
||||||
val annualLeave = withContext(Dispatchers.IO) { repo.getAnnualLeave() }
|
|
||||||
annualLeave?.let {
|
|
||||||
binding.tvAnnualLeave.text = "연차: ${String.format("%.1f", it.remainingDays)}"
|
|
||||||
} ?: run {
|
|
||||||
binding.tvAnnualLeave.text = "연차: --"
|
|
||||||
// Update Annual Leave display
|
// Update Annual Leave display
|
||||||
val annualLeave = withContext(Dispatchers.IO) { repo.getAnnualLeave() }
|
val annualLeave = withContext(Dispatchers.IO) { repo.getAnnualLeave() }
|
||||||
annualLeave?.let {
|
annualLeave?.let {
|
||||||
@@ -651,10 +636,11 @@ class MainActivity : AppCompatActivity() {
|
|||||||
else -> {
|
else -> {
|
||||||
// New Types: 월차, 연차, 반월, 반년, 교육 -> Saved as Override with no time
|
// New Types: 월차, 연차, 반월, 반년, 교육 -> Saved as Override with no time
|
||||||
repo.setOverride(date, selected, team, factory)
|
repo.setOverride(date, selected, team, factory)
|
||||||
|
// 연차 계산을 먼저 수행하고 달력 업데이트
|
||||||
|
repo.updateRemainingAnnualLeave()
|
||||||
updateCalendar()
|
updateCalendar()
|
||||||
syncAllAlarms(this)
|
syncAllAlarms(this)
|
||||||
android.widget.Toast.makeText(this, "${selected}(으)로 기록되었습니다. 알람이 해제됩니다.", android.widget.Toast.LENGTH_SHORT).show()
|
android.widget.Toast.makeText(this, "${selected}(으)로 기록되었습니다. 알람이 해제됩니다.", android.widget.Toast.LENGTH_SHORT).show()
|
||||||
repo.updateRemainingAnnualLeave()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user