@sunbird-cb/cbp-ai 0.1.33 → 0.1.35

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.
@@ -196,7 +196,8 @@ const API_END_POINTS$1 = {
196
196
  REJECT_ITEM_APPROVAL_REQUEST: 'apis/proxies/v8/ai/cbp/v1/mdo/approval-requests/items/reject',
197
197
  MDO_DESIGNATION_SEARCH: 'apis/proxies/v8/ai/cbp/v1/designation/search',
198
198
  MDO_ADD_USER_COURSE: 'apis/proxies/v8/ai/cbp/v1/mdo/approval-requests/course/add',
199
- MDO_SUGGESTED_COURSE_LIST: 'apis/proxies/v8/ai/cbp/v1/course/suggestions'
199
+ MDO_SUGGESTED_COURSE_LIST: 'apis/proxies/v8/ai/cbp/v1/course/suggestions',
200
+ MDO_ROLE_MAPPING_UPDATE: 'apis/proxies/v8/ai/cbp/v1/mdo/approval-requests/items/update'
200
201
  };
201
202
  // @Directive()
202
203
  class SharedService {
@@ -499,11 +500,20 @@ class SharedService {
499
500
  }
500
501
  }
501
502
  updateRoleMapping(role_mapping_id, reqBody) {
502
- const headers = this.headers;
503
- return this.http.put(`${this.baseUrl}${API_END_POINTS$1.UPDATE_ROLE_MAPPING}/${role_mapping_id}`, reqBody, { headers })
504
- .pipe(map((response) => {
505
- return response;
506
- }));
503
+ if (this.fromMdoPortal) {
504
+ let mdoBaseUrl = 'http://localhost:3000';
505
+ return this.http.put(`${this.mdoBaseUrl}/${API_END_POINTS$1.MDO_ROLE_MAPPING_UPDATE}`, reqBody)
506
+ .pipe(map((response) => {
507
+ return response;
508
+ }));
509
+ }
510
+ else {
511
+ const headers = this.headers;
512
+ return this.http.put(`${this.baseUrl}${API_END_POINTS$1.UPDATE_ROLE_MAPPING}/${role_mapping_id}`, reqBody, { headers })
513
+ .pipe(map((response) => {
514
+ return response;
515
+ }));
516
+ }
507
517
  }
508
518
  deleteRoleMapping(role_mapping_id) {
509
519
  const headers = this.headers;
@@ -911,7 +921,6 @@ class SharedService {
911
921
  plan.selected_courses.length > 0) || [];
912
922
  }
913
923
  getAdditionalParameterforSuggestedCourses(identifiers) {
914
- const headers = this.headers;
915
924
  let reqBody = {
916
925
  "request": {
917
926
  "filters": {
@@ -932,12 +941,13 @@ class SharedService {
932
941
  }
933
942
  };
934
943
  if (this.fromMdoPortal) {
935
- return this.http.post(`${this.mdoBaseUrl}/${API_END_POINTS$1.MDO_SUGGESTED_COURSE_LIST}`, reqBody, { headers })
944
+ return this.http.post(`${this.mdoBaseUrl}/${API_END_POINTS$1.MDO_SUGGESTED_COURSE_LIST}`, reqBody)
936
945
  .pipe(map((response) => {
937
946
  return response;
938
947
  }));
939
948
  }
940
949
  else {
950
+ const headers = this.headers;
941
951
  return this.http.post(`${this.baseUrl}${API_END_POINTS$1.SUGGESTED_COURSE_LIST}`, reqBody, { headers })
942
952
  .pipe(map((response) => {
943
953
  return response;
@@ -5270,37 +5280,40 @@ class ViewCourseRecommendationComponent {
5270
5280
  if (this.sharedService.fromMdoPortal) {
5271
5281
  const requestId = this.route.snapshot.paramMap.get('request_id');
5272
5282
  let res;
5273
- res = this.planData?.cbp_plan_data;
5274
- this.recommended_course_id = res.id;
5275
- let allCourses = [];
5276
- if (res && res.selected_courses && res.selected_courses.length) {
5277
- res.selected_courses.forEach((item) => {
5278
- // if(item?.relevancy >= 85) {
5279
- allCourses.push(item);
5280
- // }
5283
+ if (this.planData?.cbp_plan_data && this.planData?.cbp_plan_data.length) {
5284
+ res = this.planData?.cbp_plan_data[0];
5285
+ this.recommended_course_id = res.id;
5286
+ let allCourses = [];
5287
+ if (res && res.selected_courses && res.selected_courses.length) {
5288
+ res.selected_courses.forEach((item) => {
5289
+ // if(item?.relevancy >= 85) {
5290
+ allCourses.push(item);
5291
+ // }
5292
+ });
5293
+ }
5294
+ this.filterdCourses = allCourses;
5295
+ let identifiersArr = [];
5296
+ console.log('this.filterdCourses', this.filterdCourses);
5297
+ this.filterdCourses.map((item) => {
5298
+ identifiersArr.push(item?.identifier);
5281
5299
  });
5282
- }
5283
- this.filterdCourses = allCourses;
5284
- let identifiersArr = [];
5285
- console.log('this.filterdCourses', this.filterdCourses);
5286
- this.filterdCourses.map((item) => {
5287
- identifiersArr.push(item?.identifier);
5288
- });
5289
- this.sharedService.getAdditionalParameterforSuggestedCourses(identifiersArr).subscribe((response) => {
5290
- if (response && response.result && response.result.content && response.result.content.length) {
5291
- for (let i = 0; i < response.result.content.length; i++) {
5292
- for (let j = 0; j < this.filterdCourses.length; j++) {
5293
- if (this.filterdCourses[j]['identifier'] === response.result.content[i]['identifier']) {
5294
- this.filterdCourses[j]['language'] = response.result.content[i]['language'];
5295
- this.filterdCourses[j]['avgRating'] = response.result.content[i]['avgRating'];
5296
- this.filterdCourses[j]['course'] = response.result.content[i]['name'];
5297
- break;
5300
+ this.loading = false;
5301
+ this.sharedService.getAdditionalParameterforSuggestedCourses(identifiersArr).subscribe((response) => {
5302
+ if (response && response.result && response.result.content && response.result.content.length) {
5303
+ for (let i = 0; i < response.result.content.length; i++) {
5304
+ for (let j = 0; j < this.filterdCourses.length; j++) {
5305
+ if (this.filterdCourses[j]['identifier'] === response.result.content[i]['identifier']) {
5306
+ this.filterdCourses[j]['language'] = response.result.content[i]['language'];
5307
+ this.filterdCourses[j]['avgRating'] = response.result.content[i]['avgRating'];
5308
+ this.filterdCourses[j]['course'] = response.result.content[i]['name'];
5309
+ break;
5310
+ }
5298
5311
  }
5299
5312
  }
5300
5313
  }
5301
- }
5302
- });
5303
- this.updateCompetencyCounts();
5314
+ });
5315
+ this.updateCompetencyCounts();
5316
+ }
5304
5317
  }
5305
5318
  else {
5306
5319
  this.sharedService.getUserRecommendationCourse(this.planData.id).subscribe({