diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/DataNotifications.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/DataNotifications.kt index 4cfb8a25..84a209b8 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/DataNotifications.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/DataNotifications.kt @@ -11,12 +11,8 @@ import pl.szczodrzynski.edziennik.MainActivity.Companion.DRAWER_ITEM_MESSAGES import pl.szczodrzynski.edziennik.MainActivity.Companion.DRAWER_ITEM_TIMETABLE import pl.szczodrzynski.edziennik.R import pl.szczodrzynski.edziennik.data.api.models.Data -import pl.szczodrzynski.edziennik.data.db.entity.Attendance -import pl.szczodrzynski.edziennik.data.db.entity.Event +import pl.szczodrzynski.edziennik.data.db.entity.* import pl.szczodrzynski.edziennik.data.db.entity.Grade.* -import pl.szczodrzynski.edziennik.data.db.entity.Message -import pl.szczodrzynski.edziennik.data.db.entity.Notice -import pl.szczodrzynski.edziennik.data.db.entity.Notification import pl.szczodrzynski.edziennik.data.db.entity.Notification.Companion.TYPE_LUCKY_NUMBER import pl.szczodrzynski.edziennik.data.db.entity.Notification.Companion.TYPE_NEW_ANNOUNCEMENT import pl.szczodrzynski.edziennik.data.db.entity.Notification.Companion.TYPE_NEW_ATTENDANCE @@ -128,13 +124,14 @@ class DataNotifications(val data: Data) { } for (attendance in app.db.attendanceDao().getNotNotifiedNow(profileId)) { - var attendanceTypeStr = app.getString(R.string.notification_type_attendance) - when (attendance.type) { - Attendance.TYPE_ABSENT -> attendanceTypeStr = app.getString(R.string.notification_absence) - Attendance.TYPE_ABSENT_EXCUSED -> attendanceTypeStr = app.getString(R.string.notification_absence_excused) - Attendance.TYPE_BELATED -> attendanceTypeStr = app.getString(R.string.notification_belated) - Attendance.TYPE_BELATED_EXCUSED -> attendanceTypeStr = app.getString(R.string.notification_belated_excused) - Attendance.TYPE_RELEASED -> attendanceTypeStr = app.getString(R.string.notification_release) + val attendanceTypeStr = when (attendance.type) { + Attendance.TYPE_ABSENT -> app.getString(R.string.notification_absence) + Attendance.TYPE_ABSENT_EXCUSED -> app.getString(R.string.notification_absence_excused) + Attendance.TYPE_BELATED -> app.getString(R.string.notification_belated) + Attendance.TYPE_BELATED_EXCUSED -> app.getString(R.string.notification_belated_excused) + Attendance.TYPE_RELEASED -> app.getString(R.string.notification_release) + Attendance.TYPE_DAY_FREE -> app.getString(R.string.notification_day_free) + else -> app.getString(R.string.notification_type_attendance) } val text = app.getString( if (attendance.subjectLongName.isNullOrEmpty()) diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/web/EdudziennikWebAttendance.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/web/EdudziennikWebAttendance.kt index 7a67b7ec..822a9483 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/web/EdudziennikWebAttendance.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/web/EdudziennikWebAttendance.kt @@ -11,9 +11,9 @@ import pl.szczodrzynski.edziennik.data.api.Regexes.EDUDZIENNIK_ATTENDANCE_TYPES import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.DataEdudziennik import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.ENDPOINT_EDUDZIENNIK_WEB_ATTENDANCE import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.data.EdudziennikWeb -import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS import pl.szczodrzynski.edziennik.data.db.entity.Attendance import pl.szczodrzynski.edziennik.data.db.entity.Metadata +import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS import pl.szczodrzynski.edziennik.get import pl.szczodrzynski.edziennik.singleOrNull import pl.szczodrzynski.edziennik.utils.models.Date @@ -77,14 +77,16 @@ class EdudziennikWebAttendance(override val data: DataEdudziennik, ) data.attendanceList.add(attendanceObject) - data.metadataList.add(Metadata( - profileId, - Metadata.TYPE_ATTENDANCE, - id, - profile.empty, - profile.empty, - System.currentTimeMillis() - )) + if(type != Attendance.TYPE_PRESENT) { + data.metadataList.add(Metadata( + profileId, + Metadata.TYPE_ATTENDANCE, + id, + profile.empty, + profile.empty, + System.currentTimeMillis() + )) + } } data.setSyncNext(ENDPOINT_EDUDZIENNIK_WEB_ATTENDANCE, SYNC_ALWAYS) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 20ef085d..e7c8eb56 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1158,4 +1158,5 @@ Usuwam udostępnione wydarzenie... Usuwam wydarzenie... Synchronizuj + Dzień wolny