From 254719f22f5564e0455570d27c82bbde390bcbc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Borcz?= Date: Tue, 26 Mar 2024 19:02:35 +0100 Subject: [PATCH 1/4] Remove classId from semester query when eduOne (#2509) --- app/build.gradle | 2 +- .../wulkanowy/data/db/dao/SemesterDao.kt | 12 +++++++ .../data/repositories/SemesterRepository.kt | 6 ++-- .../data/repositories/StudentRepository.kt | 4 +-- .../repositories/SemesterRepositoryTest.kt | 33 +++++++------------ 5 files changed, 30 insertions(+), 27 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 92633dd3e..1a74e198e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -195,7 +195,7 @@ ext { } dependencies { - implementation 'io.github.wulkanowy:sdk:2.5.4' + implementation 'io.github.wulkanowy:sdk:2.5.5-SNAPSHOT' coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.4' diff --git a/app/src/main/java/io/github/wulkanowy/data/db/dao/SemesterDao.kt b/app/src/main/java/io/github/wulkanowy/data/db/dao/SemesterDao.kt index 4d171907c..f50d95593 100644 --- a/app/src/main/java/io/github/wulkanowy/data/db/dao/SemesterDao.kt +++ b/app/src/main/java/io/github/wulkanowy/data/db/dao/SemesterDao.kt @@ -5,6 +5,7 @@ import androidx.room.Insert import androidx.room.OnConflictStrategy import androidx.room.Query import io.github.wulkanowy.data.db.entities.Semester +import io.github.wulkanowy.data.db.entities.Student import javax.inject.Singleton @Singleton @@ -16,4 +17,15 @@ interface SemesterDao : BaseDao { @Query("SELECT * FROM Semesters WHERE student_id = :studentId AND class_id = :classId") suspend fun loadAll(studentId: Int, classId: Int): List + + @Query("SELECT * FROM Semesters WHERE student_id = :studentId") + suspend fun loadAll(studentId: Int): List + + suspend fun loadAll(student: Student): List { + return if (student.isEduOne == true) { + loadAll(student.studentId) + } else { + loadAll(student.studentId, student.classId) + } + } } diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/SemesterRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/SemesterRepository.kt index da21f59ac..e15f93099 100644 --- a/app/src/main/java/io/github/wulkanowy/data/repositories/SemesterRepository.kt +++ b/app/src/main/java/io/github/wulkanowy/data/repositories/SemesterRepository.kt @@ -27,11 +27,11 @@ class SemesterRepository @Inject constructor( forceRefresh: Boolean = false, refreshOnNoCurrent: Boolean = false ) = withContext(dispatchers.io) { - val semesters = semesterDb.loadAll(student.studentId, student.classId) + val semesters = semesterDb.loadAll(student) if (isShouldFetch(student, semesters, forceRefresh, refreshOnNoCurrent)) { refreshSemesters(student) - semesterDb.loadAll(student.studentId, student.classId) + semesterDb.loadAll(student) } else semesters } @@ -66,7 +66,7 @@ class SemesterRepository @Inject constructor( if (new.isEmpty()) return Timber.i("Empty semester list!") - val old = semesterDb.loadAll(student.studentId, student.classId) + val old = semesterDb.loadAll(student) semesterDb.removeOldAndSaveNew( oldItems = old uniqueSubtract new, newItems = new uniqueSubtract old, diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/StudentRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/StudentRepository.kt index df47d7a63..4fedcae96 100644 --- a/app/src/main/java/io/github/wulkanowy/data/repositories/StudentRepository.kt +++ b/app/src/main/java/io/github/wulkanowy/data/repositories/StudentRepository.kt @@ -123,7 +123,7 @@ class StudentRepository @Inject constructor( return } - val currentStudentSemesters = semesterDb.loadAll(student.studentId, student.classId) + val currentStudentSemesters = semesterDb.loadAll(student) if (currentStudentSemesters.isEmpty()) { Timber.d("Check isAuthorized: apply empty semesters workaround") semesterDb.insertSemesters( @@ -209,7 +209,7 @@ class StudentRepository @Inject constructor( studentDb.update(studentName) semesterDb.removeOldAndSaveNew( - oldItems = semesterDb.loadAll(student.studentId, semester.classId), + oldItems = semesterDb.loadAll(student), newItems = newCurrentApiStudent.semesters.mapToEntities(newCurrentApiStudent.studentId) ) } diff --git a/app/src/test/java/io/github/wulkanowy/data/repositories/SemesterRepositoryTest.kt b/app/src/test/java/io/github/wulkanowy/data/repositories/SemesterRepositoryTest.kt index 3a18ac48a..57ace3e1d 100644 --- a/app/src/test/java/io/github/wulkanowy/data/repositories/SemesterRepositoryTest.kt +++ b/app/src/test/java/io/github/wulkanowy/data/repositories/SemesterRepositoryTest.kt @@ -3,6 +3,7 @@ package io.github.wulkanowy.data.repositories import io.github.wulkanowy.TestDispatchersProvider import io.github.wulkanowy.createWulkanowySdkFactoryMock import io.github.wulkanowy.data.db.dao.SemesterDao +import io.github.wulkanowy.data.db.entities.Student import io.github.wulkanowy.data.mappers.mapToEntities import io.github.wulkanowy.getSemesterEntity import io.github.wulkanowy.getSemesterPojo @@ -50,7 +51,7 @@ class SemesterRepositoryTest { getSemesterPojo(1, 2, now().minusMonths(3), now()) ) - coEvery { semesterDb.loadAll(student.studentId, student.classId) } returns emptyList() + coEvery { semesterDb.loadAll(student) } returns emptyList() coEvery { sdk.getSemesters() } returns semesters coEvery { semesterDb.removeOldAndSaveNew(any(), any()) } just Runs @@ -76,12 +77,7 @@ class SemesterRepositoryTest { getSemesterPojo(123, 2, now().minusMonths(3), now()) ) - coEvery { - semesterDb.loadAll( - student.studentId, - student.classId - ) - } returns badSemesters.mapToEntities(student.studentId) + coEvery { semesterDb.loadAll(student) } returns badSemesters.mapToEntities(student.studentId) coEvery { sdk.getSemesters() } returns goodSemesters coEvery { semesterDb.removeOldAndSaveNew(any(), any()) } just Runs @@ -103,7 +99,7 @@ class SemesterRepositoryTest { getSemesterPojo(2, 3, now(), now().plusMonths(6)), ) - coEvery { semesterDb.loadAll(student.studentId, student.classId) } returnsMany listOf( + coEvery { semesterDb.loadAll(any()) } returnsMany listOf( badSemesters.mapToEntities(student.studentId), badSemesters.mapToEntities(student.studentId), goodSemesters.mapToEntities(student.studentId) @@ -125,7 +121,7 @@ class SemesterRepositoryTest { getSemesterEntity(1, 2, now().minusMonths(6), now().minusMonths(1)) ) - coEvery { semesterDb.loadAll(student.studentId, student.classId) } returns semesters + coEvery { semesterDb.loadAll(student) } returns semesters val items = runBlocking { semesterRepository.getSemesters(student) } assertEquals(2, items.size) @@ -138,7 +134,7 @@ class SemesterRepositoryTest { getSemesterEntity(1, 2, now().minusMonths(3), now()) ) - coEvery { semesterDb.loadAll(student.studentId, student.classId) } returns semesters + coEvery { semesterDb.loadAll(student) } returns semesters val items = runBlocking { semesterRepository.getSemesters(student) } assertEquals(2, items.size) @@ -151,7 +147,7 @@ class SemesterRepositoryTest { getSemesterEntity(1, 2, now(), now()) ) - coEvery { semesterDb.loadAll(student.studentId, student.classId) } returns semesters + coEvery { semesterDb.loadAll(student) } returns semesters val items = runBlocking { semesterRepository.getSemesters(student) } assertEquals(2, items.size) @@ -164,7 +160,7 @@ class SemesterRepositoryTest { getSemesterPojo(1, 2, now().minusMonths(3), now()) ) - coEvery { semesterDb.loadAll(student.studentId, student.classId) } returns emptyList() + coEvery { semesterDb.loadAll(student) } returns emptyList() coEvery { sdk.getSemesters() } returns semesters coEvery { semesterDb.removeOldAndSaveNew(any(), any()) } just Runs @@ -193,12 +189,7 @@ class SemesterRepositoryTest { getSemesterPojo(2, 2, now().plusMonths(5), now().plusMonths(11)), ) - coEvery { - semesterDb.loadAll( - student.studentId, - student.classId - ) - } returns semestersWithNoCurrent + coEvery { semesterDb.loadAll(student) } returns semestersWithNoCurrent coEvery { sdk.getSemesters() } returns newSemesters coEvery { semesterDb.removeOldAndSaveNew(any(), any()) } just Runs @@ -214,7 +205,7 @@ class SemesterRepositoryTest { getSemesterEntity(1, 2, now().minusMonths(1), now().plusMonths(1)) ) - coEvery { semesterDb.loadAll(student.studentId, student.classId) } returns semesters + coEvery { semesterDb.loadAll(student) } returns semesters val items = semesterRepository.getSemesters(student, refreshOnNoCurrent = true) assertEquals(2, items.size) @@ -227,14 +218,14 @@ class SemesterRepositoryTest { getSemesterEntity(1, 1, now(), now()) ) - coEvery { semesterDb.loadAll(student.studentId, student.classId) } returns semesters + coEvery { semesterDb.loadAll(student) } returns semesters runBlocking { semesterRepository.getCurrentSemester(student) } } @Test(expected = RuntimeException::class) fun getCurrentSemester_emptyList() { - coEvery { semesterDb.loadAll(student.studentId, student.classId) } returns emptyList() + coEvery { semesterDb.loadAll(student) } returns emptyList() coEvery { sdk.getSemesters() } returns emptyList() runBlocking { semesterRepository.getCurrentSemester(student) } From d799ec7ac9ac5f42b495faacfe592614e4b321db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Borcz?= Date: Tue, 26 Mar 2024 19:19:44 +0100 Subject: [PATCH 2/4] Add skipping migration when previous attempt failed (#2508) --- .../wulkanowy/data/WulkanowySdkFactory.kt | 18 +++++++++++++++--- .../data/repositories/SemesterRepository.kt | 5 ++++- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/io/github/wulkanowy/data/WulkanowySdkFactory.kt b/app/src/main/java/io/github/wulkanowy/data/WulkanowySdkFactory.kt index a4911f95a..cede6f920 100644 --- a/app/src/main/java/io/github/wulkanowy/data/WulkanowySdkFactory.kt +++ b/app/src/main/java/io/github/wulkanowy/data/WulkanowySdkFactory.kt @@ -23,6 +23,7 @@ class WulkanowySdkFactory @Inject constructor( ) { private val eduOneMutex = Mutex() + private val migrationFailedStudentIds = mutableSetOf() private val sdk = Sdk().apply { androidVersion = android.os.Build.VERSION.RELEASE @@ -78,14 +79,24 @@ class WulkanowySdkFactory @Inject constructor( private suspend fun checkEduOneAndMigrateIfNecessary(student: Student): Boolean { if (student.isEduOne != null) return student.isEduOne + if (student.id in migrationFailedStudentIds) { + Timber.i("Migration eduOne: skipping because of previous failure") + return false + } + eduOneMutex.withLock { + if (student.id in migrationFailedStudentIds) { + Timber.i("Migration eduOne: skipping because of previous failure") + return false + } + val studentFromDatabase = studentDb.loadById(student.id) if (studentFromDatabase?.isEduOne != null) { - Timber.d("Migration eduOne: already done") + Timber.i("Migration eduOne: already done") return studentFromDatabase.isEduOne } - Timber.d("Migration eduOne: flag missing. Running migration...") + Timber.i("Migration eduOne: flag missing. Running migration...") val initializedSdk = buildSdk( student = student, semester = null, @@ -96,7 +107,8 @@ class WulkanowySdkFactory @Inject constructor( .getOrNull() if (newCurrentStudent == null) { - Timber.d("Migration eduOne: failed, so skipping") + Timber.i("Migration eduOne: failed, so skipping") + migrationFailedStudentIds.add(student.id) return false } diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/SemesterRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/SemesterRepository.kt index e15f93099..ef7ae5950 100644 --- a/app/src/main/java/io/github/wulkanowy/data/repositories/SemesterRepository.kt +++ b/app/src/main/java/io/github/wulkanowy/data/repositories/SemesterRepository.kt @@ -64,7 +64,10 @@ class SemesterRepository @Inject constructor( .getSemesters() .mapToEntities(student.studentId) - if (new.isEmpty()) return Timber.i("Empty semester list!") + if (new.isEmpty()) { + Timber.i("Empty semester list from SDK!") + return + } val old = semesterDb.loadAll(student) semesterDb.removeOldAndSaveNew( From 7463cf6253cec6ab8bb88ee382627957db53c43b Mon Sep 17 00:00:00 2001 From: Faierbel Date: Tue, 26 Mar 2024 20:29:35 +0100 Subject: [PATCH 3/4] Replace function in DAO to 'OR' in SQL query --- .../wulkanowy/data/WulkanowySdkFactory.kt | 2 +- .../wulkanowy/data/db/dao/SemesterDao.kt | 14 +------- .../wulkanowy/data/db/dao/StudentDao.kt | 4 +-- .../data/repositories/SemesterRepository.kt | 6 ++-- .../data/repositories/StudentRepository.kt | 4 +-- .../repositories/SemesterRepositoryTest.kt | 33 ++++++++++++------- 6 files changed, 30 insertions(+), 33 deletions(-) diff --git a/app/src/main/java/io/github/wulkanowy/data/WulkanowySdkFactory.kt b/app/src/main/java/io/github/wulkanowy/data/WulkanowySdkFactory.kt index cede6f920..83268a0e5 100644 --- a/app/src/main/java/io/github/wulkanowy/data/WulkanowySdkFactory.kt +++ b/app/src/main/java/io/github/wulkanowy/data/WulkanowySdkFactory.kt @@ -112,7 +112,7 @@ class WulkanowySdkFactory @Inject constructor( return false } - Timber.d("Migration eduOne: success. New isEduOne flag: ${newCurrentStudent.isEduOne}") + Timber.i("Migration eduOne: success. New isEduOne flag: ${newCurrentStudent.isEduOne}") val studentIsEduOne = StudentIsEduOne( id = student.id, diff --git a/app/src/main/java/io/github/wulkanowy/data/db/dao/SemesterDao.kt b/app/src/main/java/io/github/wulkanowy/data/db/dao/SemesterDao.kt index f50d95593..bf9a34d05 100644 --- a/app/src/main/java/io/github/wulkanowy/data/db/dao/SemesterDao.kt +++ b/app/src/main/java/io/github/wulkanowy/data/db/dao/SemesterDao.kt @@ -5,7 +5,6 @@ import androidx.room.Insert import androidx.room.OnConflictStrategy import androidx.room.Query import io.github.wulkanowy.data.db.entities.Semester -import io.github.wulkanowy.data.db.entities.Student import javax.inject.Singleton @Singleton @@ -15,17 +14,6 @@ interface SemesterDao : BaseDao { @Insert(onConflict = OnConflictStrategy.IGNORE) suspend fun insertSemesters(items: List): List - @Query("SELECT * FROM Semesters WHERE student_id = :studentId AND class_id = :classId") + @Query("SELECT * FROM Semesters WHERE (student_id = :studentId AND class_id = :classId) OR (student_id = :studentId AND class_id = 0)") suspend fun loadAll(studentId: Int, classId: Int): List - - @Query("SELECT * FROM Semesters WHERE student_id = :studentId") - suspend fun loadAll(studentId: Int): List - - suspend fun loadAll(student: Student): List { - return if (student.isEduOne == true) { - loadAll(student.studentId) - } else { - loadAll(student.studentId, student.classId) - } - } } diff --git a/app/src/main/java/io/github/wulkanowy/data/db/dao/StudentDao.kt b/app/src/main/java/io/github/wulkanowy/data/db/dao/StudentDao.kt index bfaecef64..5302b320c 100644 --- a/app/src/main/java/io/github/wulkanowy/data/db/dao/StudentDao.kt +++ b/app/src/main/java/io/github/wulkanowy/data/db/dao/StudentDao.kt @@ -47,11 +47,11 @@ abstract class StudentDao { abstract suspend fun loadAll(): List @Transaction - @Query("SELECT * FROM Students JOIN Semesters ON Students.student_id = Semesters.student_id AND Students.class_id = Semesters.class_id") + @Query("SELECT * FROM Students JOIN Semesters ON (Students.student_id = Semesters.student_id AND Students.class_id = Semesters.class_id) OR (Students.student_id = Semesters.student_id AND Semesters.class_id = 0)") abstract suspend fun loadStudentsWithSemesters(): Map> @Transaction - @Query("SELECT * FROM Students JOIN Semesters ON Students.student_id = Semesters.student_id AND Students.class_id = Semesters.class_id WHERE Students.id = :id") + @Query("SELECT * FROM Students JOIN Semesters ON (Students.student_id = Semesters.student_id AND Students.class_id = Semesters.class_id) OR (Students.student_id = Semesters.student_id AND Semesters.class_id = 0) WHERE Students.id = :id") abstract suspend fun loadStudentWithSemestersById(id: Long): Map> @Query("UPDATE Students SET is_current = 1 WHERE id = :id") diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/SemesterRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/SemesterRepository.kt index ef7ae5950..92d44650f 100644 --- a/app/src/main/java/io/github/wulkanowy/data/repositories/SemesterRepository.kt +++ b/app/src/main/java/io/github/wulkanowy/data/repositories/SemesterRepository.kt @@ -27,11 +27,11 @@ class SemesterRepository @Inject constructor( forceRefresh: Boolean = false, refreshOnNoCurrent: Boolean = false ) = withContext(dispatchers.io) { - val semesters = semesterDb.loadAll(student) + val semesters = semesterDb.loadAll(student.studentId, student.classId) if (isShouldFetch(student, semesters, forceRefresh, refreshOnNoCurrent)) { refreshSemesters(student) - semesterDb.loadAll(student) + semesterDb.loadAll(student.studentId, student.classId) } else semesters } @@ -69,7 +69,7 @@ class SemesterRepository @Inject constructor( return } - val old = semesterDb.loadAll(student) + val old = semesterDb.loadAll(student.studentId, student.classId) semesterDb.removeOldAndSaveNew( oldItems = old uniqueSubtract new, newItems = new uniqueSubtract old, diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/StudentRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/StudentRepository.kt index 4fedcae96..df47d7a63 100644 --- a/app/src/main/java/io/github/wulkanowy/data/repositories/StudentRepository.kt +++ b/app/src/main/java/io/github/wulkanowy/data/repositories/StudentRepository.kt @@ -123,7 +123,7 @@ class StudentRepository @Inject constructor( return } - val currentStudentSemesters = semesterDb.loadAll(student) + val currentStudentSemesters = semesterDb.loadAll(student.studentId, student.classId) if (currentStudentSemesters.isEmpty()) { Timber.d("Check isAuthorized: apply empty semesters workaround") semesterDb.insertSemesters( @@ -209,7 +209,7 @@ class StudentRepository @Inject constructor( studentDb.update(studentName) semesterDb.removeOldAndSaveNew( - oldItems = semesterDb.loadAll(student), + oldItems = semesterDb.loadAll(student.studentId, semester.classId), newItems = newCurrentApiStudent.semesters.mapToEntities(newCurrentApiStudent.studentId) ) } diff --git a/app/src/test/java/io/github/wulkanowy/data/repositories/SemesterRepositoryTest.kt b/app/src/test/java/io/github/wulkanowy/data/repositories/SemesterRepositoryTest.kt index 57ace3e1d..3a18ac48a 100644 --- a/app/src/test/java/io/github/wulkanowy/data/repositories/SemesterRepositoryTest.kt +++ b/app/src/test/java/io/github/wulkanowy/data/repositories/SemesterRepositoryTest.kt @@ -3,7 +3,6 @@ package io.github.wulkanowy.data.repositories import io.github.wulkanowy.TestDispatchersProvider import io.github.wulkanowy.createWulkanowySdkFactoryMock import io.github.wulkanowy.data.db.dao.SemesterDao -import io.github.wulkanowy.data.db.entities.Student import io.github.wulkanowy.data.mappers.mapToEntities import io.github.wulkanowy.getSemesterEntity import io.github.wulkanowy.getSemesterPojo @@ -51,7 +50,7 @@ class SemesterRepositoryTest { getSemesterPojo(1, 2, now().minusMonths(3), now()) ) - coEvery { semesterDb.loadAll(student) } returns emptyList() + coEvery { semesterDb.loadAll(student.studentId, student.classId) } returns emptyList() coEvery { sdk.getSemesters() } returns semesters coEvery { semesterDb.removeOldAndSaveNew(any(), any()) } just Runs @@ -77,7 +76,12 @@ class SemesterRepositoryTest { getSemesterPojo(123, 2, now().minusMonths(3), now()) ) - coEvery { semesterDb.loadAll(student) } returns badSemesters.mapToEntities(student.studentId) + coEvery { + semesterDb.loadAll( + student.studentId, + student.classId + ) + } returns badSemesters.mapToEntities(student.studentId) coEvery { sdk.getSemesters() } returns goodSemesters coEvery { semesterDb.removeOldAndSaveNew(any(), any()) } just Runs @@ -99,7 +103,7 @@ class SemesterRepositoryTest { getSemesterPojo(2, 3, now(), now().plusMonths(6)), ) - coEvery { semesterDb.loadAll(any()) } returnsMany listOf( + coEvery { semesterDb.loadAll(student.studentId, student.classId) } returnsMany listOf( badSemesters.mapToEntities(student.studentId), badSemesters.mapToEntities(student.studentId), goodSemesters.mapToEntities(student.studentId) @@ -121,7 +125,7 @@ class SemesterRepositoryTest { getSemesterEntity(1, 2, now().minusMonths(6), now().minusMonths(1)) ) - coEvery { semesterDb.loadAll(student) } returns semesters + coEvery { semesterDb.loadAll(student.studentId, student.classId) } returns semesters val items = runBlocking { semesterRepository.getSemesters(student) } assertEquals(2, items.size) @@ -134,7 +138,7 @@ class SemesterRepositoryTest { getSemesterEntity(1, 2, now().minusMonths(3), now()) ) - coEvery { semesterDb.loadAll(student) } returns semesters + coEvery { semesterDb.loadAll(student.studentId, student.classId) } returns semesters val items = runBlocking { semesterRepository.getSemesters(student) } assertEquals(2, items.size) @@ -147,7 +151,7 @@ class SemesterRepositoryTest { getSemesterEntity(1, 2, now(), now()) ) - coEvery { semesterDb.loadAll(student) } returns semesters + coEvery { semesterDb.loadAll(student.studentId, student.classId) } returns semesters val items = runBlocking { semesterRepository.getSemesters(student) } assertEquals(2, items.size) @@ -160,7 +164,7 @@ class SemesterRepositoryTest { getSemesterPojo(1, 2, now().minusMonths(3), now()) ) - coEvery { semesterDb.loadAll(student) } returns emptyList() + coEvery { semesterDb.loadAll(student.studentId, student.classId) } returns emptyList() coEvery { sdk.getSemesters() } returns semesters coEvery { semesterDb.removeOldAndSaveNew(any(), any()) } just Runs @@ -189,7 +193,12 @@ class SemesterRepositoryTest { getSemesterPojo(2, 2, now().plusMonths(5), now().plusMonths(11)), ) - coEvery { semesterDb.loadAll(student) } returns semestersWithNoCurrent + coEvery { + semesterDb.loadAll( + student.studentId, + student.classId + ) + } returns semestersWithNoCurrent coEvery { sdk.getSemesters() } returns newSemesters coEvery { semesterDb.removeOldAndSaveNew(any(), any()) } just Runs @@ -205,7 +214,7 @@ class SemesterRepositoryTest { getSemesterEntity(1, 2, now().minusMonths(1), now().plusMonths(1)) ) - coEvery { semesterDb.loadAll(student) } returns semesters + coEvery { semesterDb.loadAll(student.studentId, student.classId) } returns semesters val items = semesterRepository.getSemesters(student, refreshOnNoCurrent = true) assertEquals(2, items.size) @@ -218,14 +227,14 @@ class SemesterRepositoryTest { getSemesterEntity(1, 1, now(), now()) ) - coEvery { semesterDb.loadAll(student) } returns semesters + coEvery { semesterDb.loadAll(student.studentId, student.classId) } returns semesters runBlocking { semesterRepository.getCurrentSemester(student) } } @Test(expected = RuntimeException::class) fun getCurrentSemester_emptyList() { - coEvery { semesterDb.loadAll(student) } returns emptyList() + coEvery { semesterDb.loadAll(student.studentId, student.classId) } returns emptyList() coEvery { sdk.getSemesters() } returns emptyList() runBlocking { semesterRepository.getCurrentSemester(student) } From 4dc5fc65ac60d08d4d93cc7bbfd53123c534e5ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Pich?= Date: Tue, 26 Mar 2024 20:37:51 +0100 Subject: [PATCH 4/4] Version 2.5.5 --- app/build.gradle | 6 +++--- app/src/main/play/release-notes/pl-PL/default.txt | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 1a74e198e..01f4c3b16 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -27,8 +27,8 @@ android { testApplicationId "io.github.tests.wulkanowy" minSdkVersion 21 targetSdkVersion 34 - versionCode 153 - versionName "2.5.4" + versionCode 154 + versionName "2.5.5" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" resValue "string", "app_name", "Wulkanowy" @@ -195,7 +195,7 @@ ext { } dependencies { - implementation 'io.github.wulkanowy:sdk:2.5.5-SNAPSHOT' + implementation 'io.github.wulkanowy:sdk:2.5.5' coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.4' diff --git a/app/src/main/play/release-notes/pl-PL/default.txt b/app/src/main/play/release-notes/pl-PL/default.txt index d848d01c9..9d72cb076 100644 --- a/app/src/main/play/release-notes/pl-PL/default.txt +++ b/app/src/main/play/release-notes/pl-PL/default.txt @@ -1,5 +1,6 @@ -Wersja 2.5.4 +Wersja 2.5.5 -— naprawiliśmy kolejnych kilka błędów związanych z obsługą dziennika eduOne (tak, nie umiemy za jednym razem) +— naprawiliśmy migrację informacji o tym, czy szkoła ucznia używa eduOne +— naprawiliśmy w końcu (teraz naprawdę mamy taką nadzieję) ten komunikat o braku uprawnień Pełna lista zmian: https://github.com/wulkanowy/wulkanowy/releases