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

Ignore empty semesters on refresh (#955)

This commit is contained in:
Mikołaj Pich 2020-09-09 13:28:44 +02:00 committed by GitHub
parent ec761f6329
commit 6e56d3ff06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,6 +8,7 @@ import io.github.wulkanowy.utils.getCurrentOrLast
import io.github.wulkanowy.utils.isCurrent
import io.github.wulkanowy.utils.uniqueSubtract
import kotlinx.coroutines.withContext
import timber.log.Timber
import javax.inject.Inject
import javax.inject.Singleton
@ -41,7 +42,7 @@ class SemesterRepository @Inject constructor(
private suspend fun refreshSemesters(student: 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)
local.deleteSemesters(old.uniqueSubtract(new))