File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed
main/java/org/openedx/downloads/presentation/download
test/java/org/openedx/downloads Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -227,9 +227,12 @@ class DownloadsViewModel(
227227 logEvent(DownloadsAnalyticsEvent .REMOVE_DOWNLOAD_CLICKED )
228228 viewModelScope.launch {
229229 val downloadModels = interactor.getDownloadModels().first().filter {
230- it.courseId == courseId && it.downloadedState == DownloadedState . DOWNLOADED
230+ it.courseId == courseId
231231 }
232- val totalSize = downloadModels.sumOf { it.size }
232+ val downloadedModels = downloadModels.filter {
233+ it.downloadedState == DownloadedState .DOWNLOADED
234+ }
235+ val totalSize = downloadedModels.sumOf { it.size }
233236 val title = getCoursePreview(courseId)?.name.orEmpty()
234237 val downloadDialogItem = DownloadDialogItem (
235238 title = title,
Original file line number Diff line number Diff line change @@ -235,7 +235,7 @@ class DownloadsViewModelTest {
235235 }
236236
237237 @Test
238- fun `downloadCourse should update courseDownloadState and show download dialog` () = runTest {
238+ fun `downloadCourse should show download dialog` () = runTest {
239239 val viewModel = DownloadsViewModel (
240240 downloadsRouter,
241241 networkConnection,
You can’t perform that action at this time.
0 commit comments