Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mobile 4660 #4193

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Mobile 4660 #4193

wants to merge 4 commits into from

Conversation

crazyserver
Copy link
Member

No description provided.

Copy link
Contributor

@dpalou dpalou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Taking into account all the problems we're facing here, maybe it would have been better to take a different approach: when we receive the data from WS, we could modify the data to replace all the mod_subection activities with their section, and remove the subsection from the list of sections. That way in section contents we would have modules and sections, and all the app would receive this new structure (there would be no need to filter the list of sections in the page, or calculate module.subsection and so on). For the app, mod_subsection wouldn't exist, only the function converting the WS data would know that there is an activity called mod_subsection.

I guess it's too late now to try this approach, and maybe it causes other problems, so for now I guess it's better to keep your approach.

/**
* Confirm and prefetch a section. If the section is "all sections", prefetch all the sections.
*
* @param section Section to download.
*/
async prefecthSection(section: AddonStorageManagerCourseSection): Promise<void> {
async prefetchSection(section: AddonStorageManagerCourseSection): Promise<void> {
section.isCalculating = true;
this.changeDetectorRef.markForCheck();
try {
await CoreCourseHelper.confirmDownloadSizeSection(this.courseId, section, this.sections);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While testing this I noticed that this function calls CoreCourseModulePrefetchDelegate.getDownloadSize passing section.modules, and section.modules can include a mod_subsection. But subsection don't have a download size, they return -1 (cannot calculate), so for those sections it will always say that the size couldn't be calculated.

@crazyserver crazyserver force-pushed the MOBILE-4660 branch 2 times, most recently from 3af7299 to a5598e4 Compare October 3, 2024 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants