@selfcommunity/react-ui 0.10.2-courses.133 → 0.10.2-courses.135

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -47,11 +47,14 @@ function getUrlNextLesson(course) {
47
47
  slug: course.slug
48
48
  };
49
49
  course.sections.some((section) => {
50
- Object.assign(data, {
51
- section_id: section.id,
52
- lesson_id: section.lessons[section.num_lessons_completed].id
53
- });
54
- return section.num_lessons_completed < section.num_lessons;
50
+ const isNextLessonInThisSection = section.num_lessons_completed < section.num_lessons;
51
+ if (isNextLessonInThisSection) {
52
+ Object.assign(data, {
53
+ section_id: section.id,
54
+ lesson_id: section.lessons[section.num_lessons_completed].id
55
+ });
56
+ }
57
+ return isNextLessonInThisSection;
55
58
  });
56
59
  return data;
57
60
  }
@@ -45,11 +45,14 @@ function getUrlNextLesson(course) {
45
45
  slug: course.slug
46
46
  };
47
47
  course.sections.some((section) => {
48
- Object.assign(data, {
49
- section_id: section.id,
50
- lesson_id: section.lessons[section.num_lessons_completed].id
51
- });
52
- return section.num_lessons_completed < section.num_lessons;
48
+ const isNextLessonInThisSection = section.num_lessons_completed < section.num_lessons;
49
+ if (isNextLessonInThisSection) {
50
+ Object.assign(data, {
51
+ section_id: section.id,
52
+ lesson_id: section.lessons[section.num_lessons_completed].id
53
+ });
54
+ }
55
+ return isNextLessonInThisSection;
53
56
  });
54
57
  return data;
55
58
  }