Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/app/home/user-home/user-home.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,8 @@ export class UserHomePage implements OnInit, OnDestroy, OnTabViewWillEnter {
return contentSearchCriteria;
}, from: refresher ? CachedItemRequestSourceFrom.SERVER : CachedItemRequestSourceFrom.CACHE
};
const rootOrgId = this.onboardingConfigurationService.getAppConfig().overriddenDefaultChannelId
let displayItems = await this.contentAggregatorHandler.newAggregate(request, AggregatorPageType.HOME, rootOrgId);
const rootOrgId = this.onboardingConfigurationService.getAppConfig().overriddenDefaultChannelId;
let displayItems = await this.contentAggregatorHandler.newAggregate(request, AggregatorPageType.HOME, rootOrgId, this.profile.syllabus[0]);
await this.getOtherMLCategories();
displayItems = this.mapContentFacteTheme(displayItems);
this.checkHomeData(displayItems);
Expand Down
10 changes: 7 additions & 3 deletions src/services/content/content-aggregator-handler.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Inject, Injectable } from '@angular/core';
import { FormConstants } from '../../app/form.constants';
import {
ContentAggregatorResponse, ContentService, CourseService,
FormService, ProfileService
FormService, ProfileService, SharedPreferences
} from '@project-sunbird/sunbird-sdk';
import { DataSourceType } from '@project-sunbird/sunbird-sdk/content/handlers/content-aggregator';
import { AppGlobalService } from '../app-global-service.service';
Expand All @@ -26,6 +26,7 @@ export class ContentAggregatorHandler {
@Inject('FORM_SERVICE') private formService: FormService,
@Inject('PROFILE_SERVICE') private profileService: ProfileService,
@Inject('CONTENT_SERVICE') private contentService: ContentService,
@Inject('SHARED_PREFERENCES') private preferences: SharedPreferences,
public commonUtilService: CommonUtilService,
private appGlobalService: AppGlobalService,
) { }
Expand Down Expand Up @@ -68,16 +69,19 @@ export class ContentAggregatorHandler {
}


async newAggregate(request, pageName: AggregatorPageType, rootOrgId?: string): Promise<any> {
async newAggregate(request, pageName: AggregatorPageType, rootOrgId?: string, frameworkId?: string): Promise<any> {
let dataSrc: DataSourceType[] = ['TRACKABLE_COLLECTIONS'];

if (this.appGlobalService.isUserLoggedIn()) {
dataSrc = [];
}
if (!rootOrgId) {
rootOrgId = await this.preferences.getString('defaultRootOrgId').toPromise();
}

try {
this.aggregatorResponse = await this.aggregateContent(request, dataSrc,
{...FormConstants.CONTENT_AGGREGATOR, subType: pageName, rootOrgId: rootOrgId || '*'});
{...FormConstants.CONTENT_AGGREGATOR, subType: pageName, framework: frameworkId || '*', rootOrgId: rootOrgId || '*'});
return this.aggregatorResponse.result;
} catch (e) {
console.error(e);
Expand Down