mirror of
https://github.com/wulkanowy/wulkanowy.git
synced 2025-01-31 15:28:20 +01:00
Ignore empty semesters on refresh (#955)
This commit is contained in:
parent
ec761f6329
commit
6e56d3ff06
@ -8,6 +8,7 @@ import io.github.wulkanowy.utils.getCurrentOrLast
|
|||||||
import io.github.wulkanowy.utils.isCurrent
|
import io.github.wulkanowy.utils.isCurrent
|
||||||
import io.github.wulkanowy.utils.uniqueSubtract
|
import io.github.wulkanowy.utils.uniqueSubtract
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
|
import timber.log.Timber
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
import javax.inject.Singleton
|
||||||
|
|
||||||
@ -41,7 +42,7 @@ class SemesterRepository @Inject constructor(
|
|||||||
|
|
||||||
private suspend fun refreshSemesters(student: Student) {
|
private suspend fun refreshSemesters(student: Student) {
|
||||||
val new = remote.getSemesters(student)
|
val new = remote.getSemesters(student)
|
||||||
if (new.isEmpty()) throw IllegalArgumentException("Empty semester list!")
|
if (new.isEmpty()) return Timber.i("Empty semester list!")
|
||||||
|
|
||||||
val old = local.getSemesters(student)
|
val old = local.getSemesters(student)
|
||||||
local.deleteSemesters(old.uniqueSubtract(new))
|
local.deleteSemesters(old.uniqueSubtract(new))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user