diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryFragment.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryFragment.kt index fc360184..8e30ea8b 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryFragment.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryFragment.kt @@ -36,6 +36,8 @@ class AttendanceSummaryFragment : BaseFragment(), AttendanceSummaryView, MainVie fun newInstance() = AttendanceSummaryFragment() } + override val totalString get() = getString(R.string.attendance_summary_total) + override val titleStringId get() = R.string.attendance_title override val isViewEmpty get() = attendanceSummaryAdapter.isEmpty diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryPresenter.kt index 3ce85d81..bb46e0c4 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryPresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryPresenter.kt @@ -144,8 +144,22 @@ class AttendanceSummaryPresenter @Inject constructor( ) } + private fun createAttendanceSummaryTotalItem(attendanceSummary: List): AttendanceSummaryItem { + return AttendanceSummaryItem( + month = view?.totalString.orEmpty(), + percentage = formatPercentage(attendanceSummary.calculatePercentage()), + present = attendanceSummary.sumBy { it.presence }.toString(), + absence = attendanceSummary.sumBy { it.absence }.toString(), + excusedAbsence = attendanceSummary.sumBy { it.absenceExcused }.toString(), + schoolAbsence = attendanceSummary.sumBy { it.absenceForSchoolReasons }.toString(), + exemption = attendanceSummary.sumBy { it.exemption }.toString(), + lateness = attendanceSummary.sumBy { it.lateness }.toString(), + excusedLateness = attendanceSummary.sumBy { it.latenessExcused }.toString() + ) + } + private fun createAttendanceSummaryItems(attendanceSummary: List): List { - return attendanceSummary.sortedByDescending { it.id }.map { + return listOf(createAttendanceSummaryTotalItem(attendanceSummary)) + attendanceSummary.sortedByDescending { it.id }.map { AttendanceSummaryItem( month = it.month.getFormattedName(), percentage = formatPercentage(it.calculatePercentage()), diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryView.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryView.kt index b86f6590..8bd5332d 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryView.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryView.kt @@ -4,6 +4,8 @@ import io.github.wulkanowy.ui.base.BaseView interface AttendanceSummaryView : BaseView { + val totalString: String + val isViewEmpty: Boolean fun initView() diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 5a1ac470..9ebaf831 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -151,6 +151,7 @@ Frekwencja + Razem diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 5698b35a..736d5fd6 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -146,6 +146,7 @@ Посещаемость + вместе diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 3fa133c9..2c896624 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -145,6 +145,7 @@ Attendance + Total