From 604e866943fa1124469edc0154f65a16c8966c43 Mon Sep 17 00:00:00 2001
From: Dani Palou 
Date: Thu, 24 Mar 2022 15:11:13 +0100
Subject: [PATCH 1/8] MOBILE-3833 data: Fix unable to change group for new
 entries
---
 src/addons/mod/bigbluebuttonbn/components/index/index.html  | 4 ++--
 src/addons/mod/data/pages/edit/edit.html                    | 4 ++--
 src/addons/mod/data/pages/edit/edit.ts                      | 6 ++++--
 .../feedback/components/index/addon-mod-feedback-index.html | 4 ++--
 4 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/src/addons/mod/bigbluebuttonbn/components/index/index.html b/src/addons/mod/bigbluebuttonbn/components/index/index.html
index 8003d0166..98308626b 100644
--- a/src/addons/mod/bigbluebuttonbn/components/index/index.html
+++ b/src/addons/mod/bigbluebuttonbn/components/index/index.html
@@ -23,8 +23,8 @@
 
         
             
-                {{'core.groupsseparate' | translate }}
-                {{'core.groupsvisible' | translate }}
+                {{ 'core.groupsseparate' | translate }}
+                {{ 'core.groupsvisible' | translate }}
             
             
diff --git a/src/addons/mod/data/pages/edit/edit.html b/src/addons/mod/data/pages/edit/edit.html
index 4b04f9b68..875d160f0 100644
--- a/src/addons/mod/data/pages/edit/edit.html
+++ b/src/addons/mod/data/pages/edit/edit.html
@@ -20,8 +20,8 @@
     
         
             
-                {{ 'core.groupsvisible' | translate }}
-                {{ 'core.groupsseparate' | translate }}
+                {{ 'core.groupsseparate' | translate }}
+                {{ 'core.groupsvisible' | translate }}
             
             
diff --git a/src/addons/mod/data/pages/edit/edit.ts b/src/addons/mod/data/pages/edit/edit.ts
index 53a73c691..208d9de72 100644
--- a/src/addons/mod/data/pages/edit/edit.ts
+++ b/src/addons/mod/data/pages/edit/edit.ts
@@ -163,8 +163,10 @@ export class AddonModDataEditPage implements OnInit {
             const entry = await AddonModDataHelper.fetchEntry(this.database, this.fieldsArray, this.entryId || 0);
             this.entry = entry.entry;
 
-            // Load correct group.
-            this.selectedGroup = this.entry.groupid;
+            if (this.entryId) {
+                // Load correct group.
+                this.selectedGroup = this.entry.groupid;
+            }
 
             // Check permissions when adding a new entry or offline entry.
             if (!this.isEditing) {
diff --git a/src/addons/mod/feedback/components/index/addon-mod-feedback-index.html b/src/addons/mod/feedback/components/index/addon-mod-feedback-index.html
index 8a72abe19..eb378ee03 100644
--- a/src/addons/mod/feedback/components/index/addon-mod-feedback-index.html
+++ b/src/addons/mod/feedback/components/index/addon-mod-feedback-index.html
@@ -61,8 +61,8 @@
     
         
             
-                {{'core.groupsseparate' | translate }}
-                {{'core.groupsvisible' | translate }}
+                {{ 'core.groupsseparate' | translate }}
+                {{ 'core.groupsvisible' | translate }}
             
             
From 9c2116c33b2d9a5f0b004482ce32c9437f9f37dd Mon Sep 17 00:00:00 2001
From: Dani Palou 
Date: Thu, 24 Mar 2022 16:08:16 +0100
Subject: [PATCH 2/8] MOBILE-3833 data: Hide All participants with visible
 groups
---
 src/addons/mod/data/components/index/index.ts | 6 ++++++
 src/addons/mod/data/pages/edit/edit.ts        | 6 ++++++
 src/addons/mod/data/pages/entry/entry.ts      | 6 ++++++
 3 files changed, 18 insertions(+)
diff --git a/src/addons/mod/data/components/index/index.ts b/src/addons/mod/data/components/index/index.ts
index 4708f24c7..bb4b1b8dc 100644
--- a/src/addons/mod/data/components/index/index.ts
+++ b/src/addons/mod/data/components/index/index.ts
@@ -218,6 +218,12 @@ export class AddonModDataIndexComponent extends CoreCourseModuleMainActivityComp
         }
 
         this.groupInfo = await CoreGroups.getActivityGroupInfo(this.database.coursemodule);
+        if (this.groupInfo.visibleGroups && this.groupInfo.groups?.length) {
+            // There is a bug in Moodle with All participants and visible groups (MOBILE-3597). Remove it.
+            this.groupInfo.groups = this.groupInfo.groups.filter(group => group.id !== 0);
+            this.groupInfo.defaultGroupId = this.groupInfo.groups[0].id;
+        }
+
         this.selectedGroup = CoreGroups.validateGroupId(this.selectedGroup, this.groupInfo);
 
         this.access = await AddonModData.getDatabaseAccessInformation(this.database.id, {
diff --git a/src/addons/mod/data/pages/edit/edit.ts b/src/addons/mod/data/pages/edit/edit.ts
index 208d9de72..52abfab1e 100644
--- a/src/addons/mod/data/pages/edit/edit.ts
+++ b/src/addons/mod/data/pages/edit/edit.ts
@@ -174,6 +174,12 @@ export class AddonModDataEditPage implements OnInit {
 
                 if (refresh) {
                     this.groupInfo = await CoreGroups.getActivityGroupInfo(this.database.coursemodule);
+                    if (this.groupInfo.visibleGroups && this.groupInfo.groups?.length) {
+                        // There is a bug in Moodle with All participants and visible groups (MOBILE-3597). Remove it.
+                        this.groupInfo.groups = this.groupInfo.groups.filter(group => group.id !== 0);
+                        this.groupInfo.defaultGroupId = this.groupInfo.groups[0].id;
+                    }
+
                     this.selectedGroup = CoreGroups.validateGroupId(this.selectedGroup, this.groupInfo);
                     this.initialSelectedGroup = this.selectedGroup;
                 }
diff --git a/src/addons/mod/data/pages/entry/entry.ts b/src/addons/mod/data/pages/entry/entry.ts
index 648726a62..6bc442857 100644
--- a/src/addons/mod/data/pages/entry/entry.ts
+++ b/src/addons/mod/data/pages/entry/entry.ts
@@ -174,6 +174,12 @@ export class AddonModDataEntryPage implements OnInit, OnDestroy {
             this.access = await AddonModData.getDatabaseAccessInformation(this.database.id, { cmId: this.moduleId });
 
             this.groupInfo = await CoreGroups.getActivityGroupInfo(this.database.coursemodule);
+            if (this.groupInfo.visibleGroups && this.groupInfo.groups?.length) {
+                // There is a bug in Moodle with All participants and visible groups (MOBILE-3597). Remove it.
+                this.groupInfo.groups = this.groupInfo.groups.filter(group => group.id !== 0);
+                this.groupInfo.defaultGroupId = this.groupInfo.groups[0].id;
+            }
+
             this.selectedGroup = CoreGroups.validateGroupId(this.selectedGroup, this.groupInfo);
 
             const actions = AddonModDataHelper.getActions(this.database, this.access, this.entry!);
From 1a0733139679f16421a1f64ae9b3898077db52ed Mon Sep 17 00:00:00 2001
From: Dani Palou 
Date: Thu, 24 Mar 2022 17:29:58 +0100
Subject: [PATCH 3/8] MOBILE-3833 course: Display data ASAP in course downloads
---
 scripts/langindex.json                        |  3 +-
 .../pages/course-storage/course-storage.html  | 31 ++++++++-----
 .../pages/course-storage/course-storage.ts    | 43 +++++++++++--------
 src/core/lang.json                            |  1 +
 4 files changed, 49 insertions(+), 29 deletions(-)
diff --git a/scripts/langindex.json b/scripts/langindex.json
index ec7f4e8eb..8221281fa 100644
--- a/scripts/langindex.json
+++ b/scripts/langindex.json
@@ -1453,6 +1453,7 @@
   "core.block.tour_navigation_dashboard_content": "tool_usertours",
   "core.block.tour_navigation_dashboard_title": "tool_usertours",
   "core.browser": "local_moodlemobileapp",
+  "core.calculating": "local_moodlemobileapp",
   "core.cancel": "moodle",
   "core.cannotconnect": "local_moodlemobileapp",
   "core.cannotconnecttrouble": "local_moodlemobileapp",
@@ -1673,6 +1674,7 @@
   "core.editor.underline": "atto_underline/pluginname",
   "core.editor.unorderedlist": "atto_unorderedlist/pluginname",
   "core.emptysplit": "local_moodlemobileapp",
+  "core.endonesteptour": "tool_usertours",
   "core.error": "moodle",
   "core.errorchangecompletion": "local_moodlemobileapp",
   "core.errordeletefile": "local_moodlemobileapp",
@@ -2342,7 +2344,6 @@
   "core.usernotfullysetup": "error",
   "core.users": "moodle",
   "core.usersuspended": "tool_reportbuilder",
-  "core.endonesteptour": "tool_usertours",
   "core.view": "moodle",
   "core.viewcode": "local_moodlemobileapp",
   "core.vieweditor": "local_moodlemobileapp",
diff --git a/src/addons/storagemanager/pages/course-storage/course-storage.html b/src/addons/storagemanager/pages/course-storage/course-storage.html
index b6353dd6c..b36d1e85d 100644
--- a/src/addons/storagemanager/pages/course-storage/course-storage.html
+++ b/src/addons/storagemanager/pages/course-storage/course-storage.html
@@ -24,15 +24,18 @@
                     
                         {{ 'addon.storagemanager.totaldownloads' | translate }}
                     
-                    {{ totalSize | coreBytesToSize }}
+                    
+                        {{ totalSize | coreBytesToSize }}
+                        {{ 'core.calculating' | translate }}
                     
                 
-                
+                
                     
                     
                     {{ prefetchCourseData.statusTranslatable | translate }}
                 
-                 0" (click)="deleteForCourse()" expand="block" color="danger"
+                 0" (click)="deleteForCourse()" expand="block" color="danger"
                     class="ion-no-margin ion-margin-top">
                     
@@ -52,18 +55,21 @@
                                 
                             
                              0">
+                                *ngIf="section.sizeLoaded && section.totalSize > 0">
                                 
                                 {{ section.totalSize | coreBytesToSize }}
                             
+                            
+                                {{ 'core.calculating' | translate }}
+                            
                             
                             
                                 
                                 
                             
                         
-