musora-content-services 1.0.194 → 1.0.195
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,8 @@
|
|
|
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.195](https://github.com/railroadmedia/musora-content-services/compare/v1.0.194...v1.0.195) (2024-11-29)
|
|
6
|
+
|
|
5
7
|
### [1.0.194](https://github.com/railroadmedia/musora-content-services/compare/v1.0.193...v1.0.194) (2024-11-29)
|
|
6
8
|
|
|
7
9
|
### [1.0.193](https://github.com/railroadmedia/musora-content-services/compare/v1.0.192...v1.0.193) (2024-11-28)
|
package/package.json
CHANGED
|
@@ -21,6 +21,7 @@ const excludeFromGeneratedIndex = [
|
|
|
21
21
|
'fetchUserPermissionsData'
|
|
22
22
|
];
|
|
23
23
|
|
|
24
|
+
let challengeIndexMetaDataPromise = null;
|
|
24
25
|
|
|
25
26
|
/**
|
|
26
27
|
* Fetches the completion status of a specific lesson for the current user.
|
|
@@ -396,11 +397,24 @@ export async function fetchUserAward(contentId) {
|
|
|
396
397
|
* @returns {Promise<any|null>}
|
|
397
398
|
*/
|
|
398
399
|
export async function fetchChallengeIndexMetadata(contentIds) {
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
400
|
+
if (!challengeIndexMetaDataPromise) {
|
|
401
|
+
challengeIndexMetaDataPromise = getChallengeIndexMetadataPromise();
|
|
402
|
+
}
|
|
403
|
+
let results = await challengeIndexMetaDataPromise;
|
|
404
|
+
results = results.filter(function(challenge){
|
|
405
|
+
return contentIds.includes(challenge.content_id);
|
|
406
|
+
});
|
|
407
|
+
return results;
|
|
402
408
|
}
|
|
403
409
|
|
|
410
|
+
async function getChallengeIndexMetadataPromise() {
|
|
411
|
+
let url = `/challenges/user_progress_for_index_page/get`;
|
|
412
|
+
const result = await fetchHandler(url, 'get');
|
|
413
|
+
challengeIndexMetaDataPromise = null;
|
|
414
|
+
return result;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
|
|
404
418
|
/**
|
|
405
419
|
* Get active brand challenges for the authorized user
|
|
406
420
|
*
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {initializeTestService} from "../initializeTests";
|
|
2
|
+
import {fetchChallengeIndexMetadata} from "../../src";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
describe('railcontentLive', function () {
|
|
6
|
+
beforeEach(async () => {
|
|
7
|
+
await initializeTestService(true);
|
|
8
|
+
}, 1000000);
|
|
9
|
+
|
|
10
|
+
test('challengeIndexMetadata', async () => {
|
|
11
|
+
let contentId = 281709;
|
|
12
|
+
let results = await fetchChallengeIndexMetadata([contentId]);
|
|
13
|
+
expect(Array.isArray(results)).toBe(true);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
});
|