Skip to content

Commit 87fcf21

Browse files
fix: remove course during downloading
1 parent 794efab commit 87fcf21

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

downloads/src/main/java/org/openedx/downloads/presentation/download/DownloadsViewModel.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,10 +226,11 @@ class DownloadsViewModel(
226226
fun removeDownloads(fragmentManager: FragmentManager, courseId: String) {
227227
logEvent(DownloadsAnalyticsEvent.REMOVE_DOWNLOAD_CLICKED)
228228
viewModelScope.launch {
229-
val downloadModels = interactor.getDownloadModels().first().filter {
229+
val downloadModels = interactor.getDownloadModels().first()
230+
val downloadedModels = downloadModels.filter {
230231
it.courseId == courseId && it.downloadedState == DownloadedState.DOWNLOADED
231232
}
232-
val totalSize = downloadModels.sumOf { it.size }
233+
val totalSize = downloadedModels.sumOf { it.size }
233234
val title = getCoursePreview(courseId)?.name.orEmpty()
234235
val downloadDialogItem = DownloadDialogItem(
235236
title = title,

0 commit comments

Comments
 (0)