musora-content-services 1.0.218 → 1.0.220

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.220](https://github.com/railroadmedia/musora-content-services/compare/v1.0.219...v1.0.220) (2024-12-06)
6
+
7
+ ### [1.0.219](https://github.com/railroadmedia/musora-content-services/compare/v1.0.218...v1.0.219) (2024-12-05)
8
+
5
9
  ### [1.0.218](https://github.com/railroadmedia/musora-content-services/compare/v1.0.209...v1.0.218) (2024-12-05)
6
10
 
7
11
  ### [1.0.217](https://github.com/railroadmedia/musora-content-services/compare/v1.0.216...v1.0.217) (2024-12-05)
File without changes
package/docs/index.html CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/link_mcs.sh CHANGED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "musora-content-services",
3
- "version": "1.0.218",
3
+ "version": "1.0.220",
4
4
  "description": "A package for Musoras content services ",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -207,6 +207,27 @@ const commonMetadata ={
207
207
  },
208
208
  'coach-lessons':{
209
209
  allowableFilters: ['difficulty', 'genre', 'essential','theory','lifestyle','type'],
210
+ },
211
+ 'lesson-history': {
212
+ name: 'Lesson History',
213
+ shortname: 'Lesson History',
214
+ icon: 'bookmark',
215
+ allowableFilters: ['difficulty', 'type'],
216
+ sortBy: '-published_on',
217
+ tabs: [
218
+ {
219
+ name: 'In Progress',
220
+ short_name: 'IN PROGRESS',
221
+ is_group_by: false,
222
+ value: 'inProgress',
223
+ },
224
+ {
225
+ name: 'Completed',
226
+ short_name: 'COMPLETED',
227
+ is_group_by: false,
228
+ value: 'completed',
229
+ },
230
+ ]
210
231
  }
211
232
  }
212
233
  const contentMetadata = {
@@ -219,7 +240,7 @@ const contentMetadata = {
219
240
  sortBy: '-published_on',
220
241
  },
221
242
  'song': {
222
- sortBy: 'slug',
243
+ sortBy: '-published_on',
223
244
  },
224
245
  'student-review' : null,
225
246
  'student-focus': {
@@ -748,7 +769,7 @@ const contentMetadata = {
748
769
  shortname: 'songs',
749
770
  amountOfFutureLessonsToShow: 3,
750
771
  showFutureLessonAtTopOrBottom: 'bottom',
751
- sortBy: 'slug',
772
+ sortBy: '-published_on',
752
773
  },
753
774
  'course': {
754
775
  thumbnailUrl: 'https://dpwjbsxqtam5n.cloudfront.net/shows/pianote/courses.jpg',
File without changes
package/src/index.d.ts CHANGED
File without changes
@@ -135,8 +135,11 @@ function saveContentProgress(localContext, contentId, progress, currentSeconds,
135
135
  }
136
136
 
137
137
  let data = localContext.data[contentId] ?? {};
138
- data[DATA_KEY_PROGRESS] = progress;
139
- data[DATA_KEY_STATUS] = STATE_STARTED;
138
+ const currentProgress = data[DATA_KEY_STATUS];
139
+ if (!currentProgress || currentProgress !== STATE_COMPLETED) {
140
+ data[DATA_KEY_PROGRESS] = progress;
141
+ data[DATA_KEY_STATUS] = STATE_STARTED;
142
+ }
140
143
  data[DATA_KEY_RESUME_TIME] = currentSeconds;
141
144
  data[DATA_KEY_LAST_UPDATED_TIME] = Math.round(new Date().getTime() / 1000);
142
145
  localContext.data[contentId] = data;
File without changes
@@ -1082,7 +1082,11 @@ export async function fetchNextPreviousLesson(railcontentId) {
1082
1082
  let sortBy = processedData?.sortBy ?? 'published_on';
1083
1083
  const isDesc = sortBy.startsWith('-');
1084
1084
  sortBy = isDesc ? sortBy.substring(1) : sortBy;
1085
- const sortValue = document[sortBy];
1085
+ let sortValue = document[sortBy];
1086
+ if (sortValue == null) {
1087
+ sortBy = 'railcontent_id';
1088
+ sortValue = document['railcontent_id'];
1089
+ }
1086
1090
  const isNumeric = !isNaN(sortValue);
1087
1091
  let prevComparison = isNumeric ? `${sortBy} <= ${sortValue}` : `${sortBy} <= "${sortValue}"`;
1088
1092
  let nextComparison = isNumeric ? `${sortBy} >= ${sortValue}` : `${sortBy} >= "${sortValue}"`;
@@ -131,6 +131,16 @@ describe('contentProgressDataContext', function () {
131
131
 
132
132
  });
133
133
 
134
+ // test('completedProgressNotOverwritten', async () => {
135
+ // const contentId = 241262;
136
+ // let progress = await getProgressPercentage(241250); //force load context
137
+ // await contentStatusCompleted(contentId);
138
+ // await recordWatchSession(contentId, "video", "vimeo", 100, 50, 50);
139
+ // progress = await getProgressPercentage(contentId);
140
+ // expect(progress).toBe(100);
141
+ // });
142
+
143
+
134
144
  test('assignmentCompleteBubbling', async () => {
135
145
  let assignmentId = 286048;
136
146
  let contentId = 286047;
File without changes
File without changes
@@ -633,6 +633,19 @@ describe('Sanity Queries', function () {
633
633
  expect(documentPublishedOn.getTime()).toBeLessThan(nextDocumentPublishedOn.getTime());
634
634
  });
635
635
 
636
+ test('fetchNextPreviousLesson-Song', async () => {
637
+ const id = 414041;
638
+ const response = await fetchNextPreviousLesson(id);
639
+ const document = await fetchByRailContentId(id, 'song');
640
+ const documentPublishedOn = new Date(document.published_on);
641
+ const prevDocumentPublishedOn = new Date(response.prevLesson.published_on);
642
+ const nextDocumentPublishedOn = new Date(response.nextLesson.published_on);
643
+ expect(response.prevLesson).toBeDefined();
644
+ expect(prevDocumentPublishedOn.getTime()).toBeLessThanOrEqual(documentPublishedOn.getTime());
645
+ expect(response.nextLesson).toBeDefined();
646
+ expect(documentPublishedOn.getTime()).toBeLessThanOrEqual(nextDocumentPublishedOn.getTime());
647
+ });
648
+
636
649
  test('fetchTopLevelParentId', async () => {
637
650
  let contentId = await fetchTopLevelParentId(241250);
638
651
  expect(contentId).toBe(241247);