From fd62653d790f8658682ba298aee108a15f057426 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20Szczodrzy=C5=84ski?= Date: Tue, 19 Oct 2021 17:06:10 +0200 Subject: [PATCH] [Hotfix] Fix merge problems and migration 96 crashing. --- .../data/api/edziennik/vulcan/data/hebe/VulcanHebeTeachers.kt | 4 ++-- .../szczodrzynski/edziennik/data/db/migration/Migration96.kt | 2 +- .../edziennik/ui/teachers/TeachersListFragment.kt | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/hebe/VulcanHebeTeachers.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/hebe/VulcanHebeTeachers.kt index f2fdfe40..e9f209a3 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/hebe/VulcanHebeTeachers.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/hebe/VulcanHebeTeachers.kt @@ -4,12 +4,12 @@ package pl.szczodrzynski.edziennik.data.api.edziennik.vulcan.data.hebe -import pl.szczodrzynski.edziennik.DAY import pl.szczodrzynski.edziennik.data.api.VULCAN_HEBE_ENDPOINT_TEACHERS import pl.szczodrzynski.edziennik.data.api.edziennik.vulcan.DataVulcan import pl.szczodrzynski.edziennik.data.api.edziennik.vulcan.ENDPOINT_VULCAN_HEBE_TEACHERS import pl.szczodrzynski.edziennik.data.api.edziennik.vulcan.data.VulcanHebe -import pl.szczodrzynski.edziennik.getString +import pl.szczodrzynski.edziennik.ext.DAY +import pl.szczodrzynski.edziennik.ext.getString class VulcanHebeTeachers( override val data: DataVulcan, diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/db/migration/Migration96.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/db/migration/Migration96.kt index 52f77256..e8315aa3 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/db/migration/Migration96.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/db/migration/Migration96.kt @@ -10,6 +10,6 @@ import androidx.sqlite.db.SupportSQLiteDatabase class Migration96 : Migration(95, 96) { override fun migrate(database: SupportSQLiteDatabase) { // teachers - associated subjects list - database.execSQL("ALTER TABLE teachers ADD COLUMN teacherSubjects TEXT NOT NULL;") + database.execSQL("ALTER TABLE teachers ADD COLUMN teacherSubjects TEXT NOT NULL DEFAULT '[]';") } } diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/teachers/TeachersListFragment.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/teachers/TeachersListFragment.kt index 8c24e111..09d79e08 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/teachers/TeachersListFragment.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/teachers/TeachersListFragment.kt @@ -48,7 +48,7 @@ class TeachersListFragment : Fragment(), CoroutineScope { val adapter = TeachersAdapter(activity) - app.db.teacherDao().getAllTeachers(App.profileId).observe(this@TeachersListFragment, Observer { items -> + app.db.teacherDao().getAllTeachers(App.profileId).observe(viewLifecycleOwner, Observer { items -> if (!isAdded) return@Observer // load & configure the adapter