musora-content-services 1.0.233 → 1.0.235

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,10 @@
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
+ ### [1.0.235](https://github.com/railroadmedia/musora-content-services/compare/v1.0.234...v1.0.235) (2024-12-13)
6
+
7
+ ### [1.0.234](https://github.com/railroadmedia/musora-content-services/compare/v1.0.233...v1.0.234) (2024-12-13)
8
+
5
9
  ### [1.0.233](https://github.com/railroadmedia/musora-content-services/compare/v1.0.218...v1.0.233) (2024-12-12)
6
10
 
7
11
  ### [1.0.232](https://github.com/railroadmedia/musora-content-services/compare/v1.0.231...v1.0.232) (2024-12-11)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "musora-content-services",
3
- "version": "1.0.233",
3
+ "version": "1.0.235",
4
4
  "description": "A package for Musoras content services ",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -230,7 +230,7 @@ export async function recordWatchSession(contentId, mediaType, mediaCategory, me
230
230
  if (mediaLengthSeconds <= 0) {
231
231
  return;
232
232
  }
233
- let progress = Math.min(99, Math.round(currentSeconds ?? 0 / Math.max(1, mediaLengthSeconds ?? 0) * 100));
233
+ let progress = Math.min(99, Math.round((currentSeconds ?? 0) / Math.max(1, mediaLengthSeconds ?? 0) * 100));
234
234
  let hierarchy = await fetchHierarchy(contentId);
235
235
  saveContentProgress(localContext, contentId, progress, currentSeconds, hierarchy);
236
236
  }
@@ -609,7 +609,7 @@ export async function fetchAll(brand, type, {
609
609
  start: start,
610
610
  end: end,
611
611
  });
612
-
612
+
613
613
  return fetchSanity(query, true);
614
614
  }
615
615
 
@@ -838,8 +838,8 @@ export async function fetchAllFilterOptions(
838
838
  const includeStatusFilter = !isAdmin && !['instructor','artist','genre'].includes(contentType);
839
839
 
840
840
  return coachId
841
- ? `brand == '${brand}' && status == "published" && references(*[_type=='instructor' && railcontent_id == ${coachId}]._id) ${filterWithoutOption || ''}`
842
- : `_type == '${contentType}' && brand == "${brand}"${includeStatusFilter ? statusFilter : ''}${style && excludeFilter !== "style" ? ` && '${style}' in genre[]->name` : ''}${artist && excludeFilter !== "artist" ? ` && artist->name == '${artist}'` : ''} ${progressFilter} ${filterWithoutOption || ''}`;
841
+ ? `brand == '${brand}' && status == "published" && references(*[_type=='instructor' && railcontent_id == ${coachId}]._id) ${filterWithoutOption || ''} ${term ? ` && (title match "${term}" || album match "${term}" || artist->name match "${term}" || genre[]->name match "${term}")` : ''}`
842
+ : `_type == '${contentType}' && brand == "${brand}"${includeStatusFilter ? statusFilter : ''}${style && excludeFilter !== "style" ? ` && '${style}' in genre[]->name` : ''}${artist && excludeFilter !== "artist" ? ` && artist->name == '${artist}'` : ''} ${progressFilter} ${filterWithoutOption || ''} ${term ? ` && (title match "${term}" || album match "${term}" || artist->name match "${term}" || genre[]->name match "${term}")` : ''}`;
843
843
  };
844
844
 
845
845
  const metaData = processMetadata(brand, contentType, true);
@@ -155,6 +155,16 @@ describe('contentProgressDataContext', function () {
155
155
  expect(state).toBe("started");
156
156
  });
157
157
 
158
+
159
+ test('recordWatchSession', async () => {
160
+ const contentId = 241250;
161
+ let progress = await getProgressPercentage(contentId); //force load context
162
+
163
+ await recordWatchSession(contentId, 'video', 'vimeo', 1673, 554, 5);
164
+ progress = await getProgressPercentage(241250);
165
+
166
+ expect(progress).toBe(33);
167
+ });
158
168
  // test('assignmentCompleteBubblingToCompleted', async () => {
159
169
  // let assignmentId = 241685;
160
170
  // let contentId = 241257;
File without changes