musora-content-services 2.131.9 → 2.131.11

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,15 @@
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.131.11](https://github.com/railroadmedia/musora-content-services/compare/v2.131.10...v2.131.11) (2026-02-07)
6
+
7
+ ### [2.131.10](https://github.com/railroadmedia/musora-content-services/compare/v2.131.9...v2.131.10) (2026-02-06)
8
+
9
+
10
+ ### Bug Fixes
11
+
12
+ * safety for assignment hierarchy if ids are null (dataset inconsistencies) ([#781](https://github.com/railroadmedia/musora-content-services/issues/781)) ([6b89370](https://github.com/railroadmedia/musora-content-services/commit/6b893701a33dd0b205da969ae9fbfa444dcdf701))
13
+
5
14
  ### [2.131.9](https://github.com/railroadmedia/musora-content-services/compare/v2.131.8...v2.131.9) (2026-02-06)
6
15
 
7
16
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "musora-content-services",
3
- "version": "2.131.9",
3
+ "version": "2.131.11",
4
4
  "description": "A package for Musoras content services ",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -2,7 +2,7 @@
2
2
  * @module LearningPaths
3
3
  */
4
4
 
5
- import { GET, POST } from '../../infrastructure/http/HttpClient.ts'
5
+ import { GET, POST } from '../../infrastructure/http/HttpClient'
6
6
  import {
7
7
  fetchByRailContentId,
8
8
  fetchByRailContentIds,
@@ -21,7 +21,7 @@ import {
21
21
  import { COLLECTION_TYPE, STATE } from '../sync/models/ContentProgress'
22
22
  import { SyncWriteDTO } from '../sync'
23
23
  import { ContentProgress } from '../sync/models'
24
- import { CollectionParameter } from '../sync/repositories/content-progress'
24
+ import { CollectionParameter } from '../sync/models/ContentProgress'
25
25
  import dayjs from 'dayjs'
26
26
  import { LEARNING_PATH_LESSON } from "../../contentTypeConfig";
27
27
 
@@ -640,7 +640,7 @@ async function resetStatus(contentId, collection = null, {skipPush = false} = {}
640
640
  const isLP = collection?.type === COLLECTION_TYPE.LEARNING_PATH
641
641
 
642
642
  const progress = 0
643
- const response = await db.contentProgress.eraseProgress(contentId, collection, {skipPush: true})
643
+ const response = await db.contentProgress.eraseProgress(Number(contentId), collection, {skipPush: true})
644
644
 
645
645
  const hierarchy = await getHierarchy(contentId, collection)
646
646
 
@@ -79,34 +79,37 @@ export async function rankCategories(brand, categories) {
79
79
  if (categories.length === 0) {
80
80
  return []
81
81
  }
82
- const data = {
83
- brand: brand,
84
- user_id: globalConfig.sessionConfig.userId,
85
- playlists: categories,
86
- }
87
- const url = `/rank_each_list/`
88
- try {
89
- const response = await recommenderClient.post(url, data)
90
- const rankedCategories = []
91
-
92
- for (const rankedPlaylist of response['ranked_playlists']) {
93
- rankedCategories.push({
94
- slug: rankedPlaylist.playlist_id,
95
- items: rankedPlaylist.ranked_items,
96
- })
82
+ if (brand !== 'playbass') {
83
+ const data = {
84
+ brand: brand,
85
+ user_id: globalConfig.sessionConfig.userId,
86
+ playlists: categories,
97
87
  }
98
- return rankedCategories
99
- } catch (error) {
100
- console.error('RankCategories fetch error:', error)
101
- const defaultSorting = []
102
- for (const slug in categories) {
103
- defaultSorting.push({
104
- slug: slug,
105
- items: categories[slug],
106
- })
88
+ const url = `/rank_each_list/`
89
+ try {
90
+ const response = await recommenderClient.post(url, data)
91
+ const rankedCategories = []
92
+
93
+ for (const rankedPlaylist of response['ranked_playlists']) {
94
+ rankedCategories.push({
95
+ slug: rankedPlaylist.playlist_id,
96
+ items: rankedPlaylist.ranked_items,
97
+ })
98
+ }
99
+ return rankedCategories
100
+ } catch (error) {
101
+ console.error('RankCategories fetch error:', error)
107
102
  }
108
- return defaultSorting
109
103
  }
104
+
105
+ const defaultSorting = []
106
+ for (const slug in categories) {
107
+ defaultSorting.push({
108
+ slug: slug,
109
+ items: categories[slug],
110
+ })
111
+ }
112
+ return defaultSorting
110
113
  }
111
114
 
112
115
  /**
@@ -124,6 +127,9 @@ export async function rankItems(brand, content_ids) {
124
127
  if (content_ids.length === 0) {
125
128
  return []
126
129
  }
130
+ if (brand === 'playbass') {
131
+ return content_ids
132
+ }
127
133
  const data = {
128
134
  brand: brand,
129
135
  user_id: globalConfig.sessionConfig.userId,
@@ -1379,10 +1379,10 @@ function populateHierarchyLookups(currentLevel, data, parentId) {
1379
1379
 
1380
1380
  let assignments = currentLevel['assignments']
1381
1381
  if (assignments) {
1382
- let assignmentIds = assignments.map((assignment) => assignment[railcontentIdField])
1382
+ let assignmentIds = assignments.map((assignment) => assignment[railcontentIdField]).filter(Boolean)
1383
1383
  data.children[contentId] = (data.children[contentId] ?? []).concat(assignmentIds)
1384
1384
  assignmentIds.forEach((assignmentId) => {
1385
- data.parents[assignmentId] = contentId
1385
+ if (assignmentId) data.parents[assignmentId] = contentId
1386
1386
  })
1387
1387
  }
1388
1388
  }