1
0
mirror of https://github.com/wulkanowy/wulkanowy.git synced 2024-09-20 03:49:09 -05:00

Display lesson number in attendance notification if subject is blank (#1965)

This commit is contained in:
Mikołaj Pich 2022-09-02 21:30:30 +02:00 committed by GitHub
parent 157becb017
commit 86f8763e69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,7 +8,6 @@ import io.github.wulkanowy.data.db.entities.Student
import io.github.wulkanowy.data.pojos.GroupNotificationData
import io.github.wulkanowy.data.pojos.NotificationData
import io.github.wulkanowy.ui.modules.Destination
import io.github.wulkanowy.ui.modules.splash.SplashActivity
import io.github.wulkanowy.utils.descriptionRes
import io.github.wulkanowy.utils.getPlural
import io.github.wulkanowy.utils.toFormattedString
@ -22,8 +21,9 @@ class NewAttendanceNotification @Inject constructor(
suspend fun notify(items: List<Attendance>, student: Student) {
val lines = items.filterNot { it.presence || it.name == "UNKNOWN" }
.map {
val lesson = it.subject.ifBlank { "Lekcja ${it.number}" }
val description = context.getString(it.descriptionRes)
"${it.date.toFormattedString("dd.MM")} - ${it.subject}: $description"
"${it.date.toFormattedString("dd.MM")} - $lesson: $description"
}
.ifEmpty { return }