Repository: learningequality/kolibri

Issue:
Home page - The 'Continue learning on your own' section is not displayed
## Observed behavior
The 'Continue learning on your own' section is not displayed at the Home page even though I have completed all assigned class resources and have some non-class resources in progress.

## Expected behavior
The 'Continue learning on your own' section should be displayed as specified in [Notion](https://www.notion.so/Home-Page-QA-8ffb1011fa034e21bc1f52a2aad585ac).

## Steps to reproduce the issue
1. Install the following [build.](https://github.com/learningequality/kolibri/releases/tag/v0.15.0-beta2)
2. As a Coach create a new Learner user, enroll that user to a Class and assign a lesson with resources.
3. Sign in with the Learner user and complete the assigned resources.
4. Start looking at some non-classes resources so that those will get marked as being in progress.
5. Go back to the Home page and look for the 'Continue learning on your own' section

## Additional information

![2021-11-18_17-03-21](https://user-images.githubusercontent.com/79847249/142441864-88064d81-f972-49ee-8e13-5c33a6d5140e.png)

## Usage Details
 - OS: Windows 10
 - Browser: Chrome


Discussion:
@radinamatic 

Resolving patch:
diff --git a/kolibri/plugins/learn/viewsets.py b/kolibri/plugins/learn/viewsets.py
--- a/kolibri/plugins/learn/viewsets.py
+++ b/kolibri/plugins/learn/viewsets.py
@@ -85,12 +85,20 @@ def consolidate(self, items, queryset):
                 resource["contentnode_id"] for resource in lesson["resources"]
             }
 
-        contentnode_progress = contentnode_progress_viewset.serialize_list(
-            self.request, {"ids": lesson_contentnode_ids}
+        contentnode_progress = (
+            contentnode_progress_viewset.serialize_list(
+                self.request, {"ids": lesson_contentnode_ids}
+            )
+            if lesson_contentnode_ids
+            else []
         )
 
-        contentnodes = contentnode_viewset.serialize_list(
-            self.request, {"ids": lesson_contentnode_ids}
+        contentnodes = (
+            contentnode_viewset.serialize_list(
+                self.request, {"ids": lesson_contentnode_ids}
+            )
+            if lesson_contentnode_ids
+            else []
         )
 
         progress_map = {l["content_id"]: l["progress"] for l in contentnode_progress}
@@ -206,7 +214,7 @@ def _resumable_resources(classrooms):
     for classroom in classrooms:
         for lesson in classroom["assignments"]["lessons"]:
             for resource in lesson["resources"]:
-                yield resource["progress"] > 0
+                yield 0 < resource["progress"] < 1
 
 
 class LearnHomePageHydrationView(APIView):


Test patch:
diff --git a/kolibri/plugins/learn/assets/src/views/HomePage/__tests__/HomePage.spec.js b/kolibri/plugins/learn/assets/src/views/HomePage/__tests__/HomePage.spec.js
--- a/kolibri/plugins/learn/assets/src/views/HomePage/__tests__/HomePage.spec.js
+++ b/kolibri/plugins/learn/assets/src/views/HomePage/__tests__/HomePage.spec.js
@@ -85,12 +85,24 @@ describe(`HomePage`, () => {
       expect(getClassesSection(wrapper).exists()).toBe(false);
     });
 
-    it(`the section is not displayed for a signed in user with no classes`, () => {
+    it(`the section is not displayed for a signed in user who has no classes and can access unassigned content`, () => {
+      useDeviceSettings.mockImplementation(() =>
+        useDeviceSettingsMock({ canAccessUnassignedContent: true })
+      );
       useUser.mockImplementation(() => useUserMock({ isUserLoggedIn: true }));
       const wrapper = makeWrapper();
       expect(getClassesSection(wrapper).exists()).toBe(false);
     });
 
+    it(`the section is displayed for a signed in user with no classes who cannot access unassigned content`, () => {
+      useDeviceSettings.mockImplementation(() =>
+        useDeviceSettingsMock({ canAccessUnassignedContent: false })
+      );
+      useUser.mockImplementation(() => useUserMock({ isUserLoggedIn: true }));
+      const wrapper = makeWrapper();
+      expect(getClassesSection(wrapper).exists()).toBe(true);
+    });
+
     it(`classes are displayed for a signed in user who is enrolled in some classes`, () => {
       useUser.mockImplementation(() => useUserMock({ isUserLoggedIn: true }));
       useLearnerResources.mockImplementation(() =>