musora-content-services 2.73.0 → 2.74.1
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.
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [2.74.1](https://github.com/railroadmedia/musora-content-services/compare/v2.74.0...v2.74.1) (2025-11-07)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* fetch learning path lessons ([69ac2e1](https://github.com/railroadmedia/musora-content-services/commit/69ac2e1e0982289b26e7148cc17d19f1ba389484))
|
|
11
|
+
|
|
12
|
+
## [2.74.0](https://github.com/railroadmedia/musora-content-services/compare/v2.73.0...v2.74.0) (2025-11-07)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* update fetch learning path lessons ([#551](https://github.com/railroadmedia/musora-content-services/issues/551)) ([a434076](https://github.com/railroadmedia/musora-content-services/commit/a434076a8281af61043c1ec3e09798e7981ff8f3))
|
|
18
|
+
|
|
5
19
|
## [2.73.0](https://github.com/railroadmedia/musora-content-services/compare/v2.72.1...v2.73.0) (2025-11-06)
|
|
6
20
|
|
|
7
21
|
|
package/package.json
CHANGED
|
@@ -66,11 +66,12 @@ export async function updateActivePath(brand: string) {
|
|
|
66
66
|
* @returns {string} result.thumbnail - Optional thumbnail URL for the learning path.
|
|
67
67
|
* @returns {string} result.title - The title of the learning path.
|
|
68
68
|
* @returns {boolean} result.is_active_learning_path - Whether the learning path is currently active.
|
|
69
|
-
* @returns {Array} result.
|
|
69
|
+
* @returns {Array} result.children - Array of all lessons.
|
|
70
70
|
* @returns {Array} result.upcoming_lessons - Array of upcoming/additional lessons.
|
|
71
71
|
* @returns {Array} result.todays_lessons - Array of today's lessons (max 3).
|
|
72
72
|
* @returns {Array} result.next_learning_path_lessons - Array of next lessons to be taken.
|
|
73
73
|
* @returns {Array} result.completed_lessons - Array of completed lessons.
|
|
74
|
+
* @returns {Array} result.previous_learning_path_todays - Array of completed lessons.
|
|
74
75
|
*/
|
|
75
76
|
export async function fetchLearningPathLessons(
|
|
76
77
|
learningPathId: number,
|
|
@@ -86,21 +87,31 @@ export async function fetchLearningPathLessons(
|
|
|
86
87
|
addProgressStatus: true,
|
|
87
88
|
addProgressPercentage: true,
|
|
88
89
|
}
|
|
90
|
+
|
|
89
91
|
const lessons = await addContextToContent(() => learningPath.children, addContextParameters)
|
|
90
92
|
const isActiveLearningPath = (dailySession?.active_learning_path_id || 0) == learningPathId
|
|
93
|
+
const manipulatedLessons = lessons.map((lesson: any) => {
|
|
94
|
+
return { ...lesson, type: 'learning-path-lesson-v2', parent_id: learningPathId }
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
if (!isActiveLearningPath) {
|
|
98
|
+
return {
|
|
99
|
+
...learningPath,
|
|
100
|
+
is_active_learning_path: isActiveLearningPath,
|
|
101
|
+
children: manipulatedLessons,
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
91
105
|
const todayContentIds = dailySession.daily_session[0]?.content_ids || []
|
|
92
106
|
const nextContentIds = dailySession.daily_session[1]?.content_ids || []
|
|
93
107
|
const completedLessons = []
|
|
94
108
|
let todaysLessons = []
|
|
95
109
|
let nextLPLessons = []
|
|
96
110
|
const upcomingLessons = []
|
|
97
|
-
const lessonIds = lessons.map((lesson: any) => lesson.id).filter(Boolean)
|
|
98
111
|
|
|
99
|
-
|
|
112
|
+
manipulatedLessons.forEach((lesson: any) => {
|
|
100
113
|
if (todayContentIds.includes(lesson.id)) {
|
|
101
114
|
todaysLessons.push(lesson)
|
|
102
|
-
} else if (nextContentIds.includes(lesson.id)) {
|
|
103
|
-
nextLPLessons.push(lesson)
|
|
104
115
|
} else if (lesson.progressStatus === 'completed') {
|
|
105
116
|
completedLessons.push(lesson)
|
|
106
117
|
} else {
|
|
@@ -108,15 +119,20 @@ export async function fetchLearningPathLessons(
|
|
|
108
119
|
}
|
|
109
120
|
})
|
|
110
121
|
|
|
111
|
-
|
|
122
|
+
let previousLearnigPathTodays = []
|
|
123
|
+
if (todaysLessons.length == 0) {
|
|
112
124
|
// Daily sessions first lessons are not part of the active learning path, but next lessons are
|
|
113
125
|
// load todays lessons from previous learning path
|
|
114
|
-
|
|
126
|
+
previousLearnigPathTodays = await addContextToContent(
|
|
115
127
|
fetchByRailContentIds,
|
|
116
128
|
todayContentIds,
|
|
117
129
|
addContextParameters
|
|
118
130
|
)
|
|
119
|
-
} else if (
|
|
131
|
+
} else if (
|
|
132
|
+
nextContentIds.length > 0 &&
|
|
133
|
+
todaysLessons.length < 3 &&
|
|
134
|
+
upcomingLessons.length === 0
|
|
135
|
+
) {
|
|
120
136
|
// Daily sessions first lessons are the active learning path and the next lessons are not
|
|
121
137
|
// load next lessons from next learning path
|
|
122
138
|
nextLPLessons = await addContextToContent(
|
|
@@ -129,10 +145,11 @@ export async function fetchLearningPathLessons(
|
|
|
129
145
|
return {
|
|
130
146
|
...learningPath,
|
|
131
147
|
is_active_learning_path: isActiveLearningPath,
|
|
132
|
-
children:
|
|
148
|
+
children: manipulatedLessons,
|
|
133
149
|
upcoming_lessons: upcomingLessons,
|
|
134
150
|
todays_lessons: todaysLessons,
|
|
135
151
|
next_learning_path_lessons: nextLPLessons,
|
|
136
152
|
completed_lessons: completedLessons,
|
|
153
|
+
previous_learning_path_todays: previousLearnigPathTodays,
|
|
137
154
|
}
|
|
138
155
|
}
|