musora-content-services 2.129.1 → 2.129.2
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/.claude/settings.local.json +9 -0
- package/CHANGELOG.md +7 -0
- package/package.json +1 -1
- package/src/services/content.js +22 -7
- package/src/services/sanity.js +8 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
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.129.2](https://github.com/railroadmedia/musora-content-services/compare/v2.129.1...v2.129.2) (2026-02-02)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **BEH-1486:** hide course collection courses ([#757](https://github.com/railroadmedia/musora-content-services/issues/757)) ([055cc73](https://github.com/railroadmedia/musora-content-services/commit/055cc73bf362dc7616602bbce9ae5f5c7324a1c6))
|
|
11
|
+
|
|
5
12
|
### [2.129.1](https://github.com/railroadmedia/musora-content-services/compare/v2.129.0...v2.129.1) (2026-02-02)
|
|
6
13
|
|
|
7
14
|
## [2.129.0](https://github.com/railroadmedia/musora-content-services/compare/v2.126.0...v2.129.0) (2026-02-02)
|
package/package.json
CHANGED
package/src/services/content.js
CHANGED
|
@@ -126,31 +126,42 @@ export async function getTabResults(brand, pageName, tabName, {
|
|
|
126
126
|
let recommendedContent = await fetchByRailContentIds(allRecommendations, 'tab-data', brand, true)
|
|
127
127
|
recommendedContent.sort((a, b) => allRecommendations.indexOf(a.id) - allRecommendations.indexOf(b.id))
|
|
128
128
|
|
|
129
|
+
recommendedContent = filterCoursesInCourseCollections(recommendedContent)
|
|
130
|
+
|
|
129
131
|
const start = (page - 1) * limit
|
|
130
132
|
const end = start + limit
|
|
133
|
+
const pagesFilledByRec = Math.floor(recommendedContent.length / limit)
|
|
131
134
|
|
|
132
|
-
//
|
|
135
|
+
// use pagination to only fetch new contents
|
|
133
136
|
if (recommendedContent.length < end) {
|
|
134
|
-
const additionalNeeded = end - recommendedContent.length;
|
|
135
137
|
const tabData = await fetchTabData(brand, pageName, {
|
|
136
|
-
page:
|
|
137
|
-
limit
|
|
138
|
+
page: page - pagesFilledByRec,
|
|
139
|
+
limit,
|
|
138
140
|
sort: '-published_on',
|
|
139
141
|
includedFields: mergedIncludedFields,
|
|
140
|
-
progress: progressValue
|
|
142
|
+
progress: progressValue,
|
|
143
|
+
excludeIds: recommendedContent.map(c => c.id)
|
|
141
144
|
})
|
|
142
145
|
|
|
143
146
|
// Filter out duplicates and combine
|
|
144
147
|
const recommendedIds = new Set(recommendedContent.map(c => c.id))
|
|
145
148
|
const additionalContent = tabData.entity.filter(c => !recommendedIds.has(c.id))
|
|
146
149
|
|
|
147
|
-
|
|
150
|
+
const recommendedContentToDisplay = recommendedContent.slice(start, end)
|
|
151
|
+
const additionalContentToDisplay = additionalContent.slice(0, limit - recommendedContentToDisplay.length)
|
|
152
|
+
contentToDisplay = [...recommendedContentToDisplay, ...additionalContentToDisplay]
|
|
148
153
|
} else {
|
|
149
154
|
contentToDisplay = recommendedContent.slice(start, end)
|
|
150
155
|
}
|
|
151
156
|
} else {
|
|
152
157
|
// No recommendations - use normal flow
|
|
153
|
-
const temp = await fetchTabData(brand, pageName, {
|
|
158
|
+
const temp = await fetchTabData(brand, pageName, {
|
|
159
|
+
page,
|
|
160
|
+
limit,
|
|
161
|
+
sort: '-published_on',
|
|
162
|
+
includedFields: mergedIncludedFields,
|
|
163
|
+
progress: progressValue
|
|
164
|
+
})
|
|
154
165
|
contentToDisplay = temp.entity
|
|
155
166
|
}
|
|
156
167
|
|
|
@@ -596,3 +607,7 @@ export async function getOwnedContent(brand, {
|
|
|
596
607
|
addProgressStatus: true,
|
|
597
608
|
});
|
|
598
609
|
}
|
|
610
|
+
|
|
611
|
+
export function filterCoursesInCourseCollections(data) {
|
|
612
|
+
return data.filter(c => !(c.type === 'course' && c.parent_id))
|
|
613
|
+
}
|
package/src/services/sanity.js
CHANGED
|
@@ -1863,6 +1863,7 @@ export async function fetchTabData(
|
|
|
1863
1863
|
progressIds = undefined,
|
|
1864
1864
|
progress = 'all',
|
|
1865
1865
|
showMembershipRestrictedContent = false,
|
|
1866
|
+
excludeIds = [],
|
|
1866
1867
|
} = {}
|
|
1867
1868
|
) {
|
|
1868
1869
|
const start = (page - 1) * limit
|
|
@@ -1898,7 +1899,13 @@ export async function fetchTabData(
|
|
|
1898
1899
|
let entityFieldsString = ''
|
|
1899
1900
|
let filter = ''
|
|
1900
1901
|
|
|
1901
|
-
|
|
1902
|
+
const excludedIdsFilter = excludeIds.length
|
|
1903
|
+
? `&& !(railcontent_id in [${excludeIds.join(',')}])`
|
|
1904
|
+
: ''
|
|
1905
|
+
|
|
1906
|
+
const excludeCoursesInCourseCollectionsFilter = `&& !(_type == 'course' && defined(parent_content_data))`
|
|
1907
|
+
|
|
1908
|
+
filter = `brand == "${brand}" && (defined(railcontent_id)) ${includedFieldsFilter} ${progressFilter} ${excludedIdsFilter} ${excludeCoursesInCourseCollectionsFilter}`
|
|
1902
1909
|
const childrenFilter = await new FilterBuilder(``, {
|
|
1903
1910
|
isChildrenFilter: true,
|
|
1904
1911
|
showMembershipRestrictedContent: true,
|