From 2bd231c8f5158d868540d18e6d427452ad0adb17 Mon Sep 17 00:00:00 2001 From: Volodymyr Chekyrta Date: Wed, 26 Apr 2023 18:06:17 +0300 Subject: [PATCH] Fix downloading CourseSequential blocks --- .../Presentation/Container/CourseContainerViewModel.swift | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Course/Course/Presentation/Container/CourseContainerViewModel.swift b/Course/Course/Presentation/Container/CourseContainerViewModel.swift index ca3150bdb..ac682d449 100644 --- a/Course/Course/Presentation/Container/CourseContainerViewModel.swift +++ b/Course/Course/Presentation/Container/CourseContainerViewModel.swift @@ -115,11 +115,9 @@ public class CourseContainerViewModel: BaseCourseViewModel { func onDownloadViewTap(chapter: CourseChapter, blockId: String, state: DownloadViewState) { let blocks = chapter.childs - .filter { $0.isDownloadable } + .first(where: { $0.id == blockId })?.childs .flatMap { $0.childs } - .filter { $0.isDownloadable } - .flatMap { $0.childs } - .filter { $0.isDownloadable } + .filter { $0.isDownloadable } ?? [] do { switch state {