mirror of
https://github.com/wulkanowy/wulkanowy.git
synced 2025-01-31 15:28:20 +01:00
Fix excuse button showing up despite no lessons available to excuse (#1607)
This was happening when there was an unexcused lesson that you excused until the teacher sent a response (accepted or denied it)
This commit is contained in:
parent
de11644e9b
commit
1d910f8d66
@ -46,7 +46,7 @@ class AttendanceAdapter @Inject constructor() :
|
|||||||
onExcuseCheckboxSelect(item, checked)
|
onExcuseCheckboxSelect(item, checked)
|
||||||
}
|
}
|
||||||
|
|
||||||
when (if (item.excuseStatus != null) SentExcuseStatus.valueOf(item.excuseStatus) else null) {
|
when (item.excuseStatus?.let { SentExcuseStatus.valueOf(it)}) {
|
||||||
SentExcuseStatus.WAITING -> {
|
SentExcuseStatus.WAITING -> {
|
||||||
attendanceItemExcuseInfo.setImageResource(R.drawable.ic_excuse_waiting)
|
attendanceItemExcuseInfo.setImageResource(R.drawable.ic_excuse_waiting)
|
||||||
attendanceItemExcuseInfo.visibility = View.VISIBLE
|
attendanceItemExcuseInfo.visibility = View.VISIBLE
|
||||||
|
@ -259,9 +259,8 @@ class AttendancePresenter @Inject constructor(
|
|||||||
showEmpty(filteredAttendance.isEmpty())
|
showEmpty(filteredAttendance.isEmpty())
|
||||||
showErrorView(false)
|
showErrorView(false)
|
||||||
showContent(filteredAttendance.isNotEmpty())
|
showContent(filteredAttendance.isNotEmpty())
|
||||||
showExcuseButton(filteredAttendance.any { item ->
|
val anyExcusables = filteredAttendance.any { it.isExcusableOrNotExcused }
|
||||||
(!isParent && isVulcanExcusedFunctionEnabled) || (isParent && item.isExcusableOrNotExcused)
|
showExcuseButton(anyExcusables && (isParent || isVulcanExcusedFunctionEnabled))
|
||||||
})
|
|
||||||
}
|
}
|
||||||
analytics.logEvent(
|
analytics.logEvent(
|
||||||
"load_data",
|
"load_data",
|
||||||
|
@ -17,7 +17,7 @@ private inline val AttendanceSummary.allAbsences: Double
|
|||||||
get() = absence.toDouble() + absenceExcused
|
get() = absence.toDouble() + absenceExcused
|
||||||
|
|
||||||
inline val Attendance.isExcusableOrNotExcused: Boolean
|
inline val Attendance.isExcusableOrNotExcused: Boolean
|
||||||
get() = excusable || ((absence || lateness) && !excused)
|
get() = (excusable || ((absence || lateness) && !excused)) && excuseStatus == null
|
||||||
|
|
||||||
fun AttendanceSummary.calculatePercentage() = calculatePercentage(allPresences, allAbsences)
|
fun AttendanceSummary.calculatePercentage() = calculatePercentage(allPresences, allAbsences)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user