Skip to content

Commit

Permalink
Fix 149826 cbse ncert issue prod (#372)
Browse files Browse the repository at this point in the history
* change for dropdown CBSE to CBSE/NCERT

# Conflicts:
#	src/app/client/src/app/modules/content-search/components/search-filter/search-filter.component.ts
#	src/app/client/src/app/modules/core/components/content-type/content-type.component.ts
#	src/app/client/src/app/modules/core/services/search/search.service.ts
#	src/app/client/src/app/modules/explore-page/components/explore-page/explore-page.component.ts
#	src/app/client/src/app/modules/player-helper/components/content-actions/content-actions.component.ts
#	src/app/client/src/app/modules/public/module/course/components/explore-course/explore-course.component.ts
#	src/app/client/src/app/modules/public/module/explore/components/explore-content/explore-content.component.ts

* 149826 cbse ncert changes in popup

# Conflicts:
#	src/app/client/src/app/modules/content-search/components/search-filter/search-filter.component.ts
#	src/app/client/src/app/modules/explore-page/components/explore-page/explore-page.component.html
#	src/app/client/src/app/modules/public/module/guest-profile/components/guest-profile/guest-profile.component.html
#	src/app/client/src/app/modules/shared-feature/components/profile-framework-popup/profile-framework-popup.component.html
  • Loading branch information
Shailrocks123 authored Jul 26, 2024
1 parent 36729d2 commit 842ab2d
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ export class SearchFilterComponent implements OnInit, OnDestroy {
switchMap(queryParams => {
this.filterChange.emit({ status: 'FETCHING' });
let boardName = _.get(queryParams, 'board[0]') || _.get(this.boards, '[0]');
//117337 - removed hardcoded cbse/ncert
console.log(boardName,'boardname')
boardName = boardName === 'CBSE/NCERT' ? 'CBSE' : boardName;
return zip(this.getFramework({ boardName }), this.getAudienceTypeFormConfig())
.pipe(map(([filters, audienceTypeFilter]: [object, object]) => ({ ...filters, audience: audienceTypeFilter })));
Expand Down Expand Up @@ -235,7 +237,9 @@ export class SearchFilterComponent implements OnInit, OnDestroy {
const selectedOption = _.find(this.boards, { name: _.get(this.queryFilters, 'board[0]') }) ||
_.find(this.boards, { name: _.get(this.defaultFilters, 'board[0]') }) || this.boards[0];
this.selectedBoard = { label: this.optionLabel.Board, value: 'board', selectedOption: _.get(selectedOption, 'name') };
//117337 - removed hardcoded cbse/ncert
this.selectedBoard.selectedOption = this.selectedBoard.selectedOption === 'CBSE' ? 'CBSE/NCERT' : this.selectedBoard.selectedOption;
// this.selectedBoard.selectedOption = this.selectedBoard.selectedOption;
this.selectedOption = this.selectedBoard;
}
}
Expand Down Expand Up @@ -269,6 +273,7 @@ export class SearchFilterComponent implements OnInit, OnDestroy {
this.selectedNgModels = {};
this.allValues = {};
_.forEach(filters, (filterValues: { name: any }[], filterKey: string) => {
//117337 - removed hardcode cbse/ncert
if (filterKey === 'board') {
const boardName = filterValues.find((board) => board.name === 'CBSE');
boardName && (boardName.name = 'CBSE/NCERT');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,15 @@ export class ContentTypeComponent implements OnInit, OnDestroy {
let pathname = this.userService._slug;
if( pathname && pathname==="dikshacustodian" && this.userService._userProfile.framework.board){
let board = this.userService._userProfile.framework.board[0];
//117337 - removed hardcoded cbse/ncert
if(board==="CBSE/NCERT"){
board="CBSE";
}
pathname = Object.keys(frameworkList).find(key => frameworkList[key].name === board);
}
else if( !pathname && userPreference.framework.board){
let board = userPreference.framework.board[0];
//117337 - removed hardcoded cbse/ncert
if(board==="CBSE/NCERT"){
board="CBSE";
}
Expand Down Expand Up @@ -139,6 +141,11 @@ export class ContentTypeComponent implements OnInit, OnDestroy {
!data.isLoginMandatory ?
this.router.navigate([this.exploreNcert ? '/exploren/1' : data.anonumousUserRoute.route],
{ queryParams: { ...params,board: 'CBSE/NCERT',selectedTab: data.anonumousUserRoute.queryParam } }) : window.location.href = this.exploreNcert ? '/exploren' : data.loggedInUserRoute.route;

// !data.isLoginMandatory ?
// this.router.navigate([this.exploreNcert ? '/exploren/1' : data.anonumousUserRoute.route],
// { queryParams: { ...params,board: 'CBSE',selectedTab: data.anonumousUserRoute.queryParam } }) : window.location.href = this.exploreNcert ? '/exploren' : data.loggedInUserRoute.route;

} else if(((params.board && params.board[0] && params.board[0] != undefined) && params.board[0] == 'ncert')){
!data.isLoginMandatory ?
this.router.navigate([this.exploreNcert ? '/exploren/1' : data.anonumousUserRoute.route],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,9 @@ export class SearchService {
facet['placeholder'] = this.resourceService.frmelmnts.lbl.selectBoard;
// Replacing cbse value with cbse/ncert
_.map(facet['values'], val => {
if (_.toLower(val.name) === 'cbse') { val.name = 'CBSE/NCERT'; }
//117337 - removed hardcoded cbse/ncert
if (_.toLower(val.name) === 'cbse') { val.name = 'CBSE/NCERT'; }
if (_.toLower(val.name) === 'cbse') { val.name = 'CBSE'; }
});
break;
case 'se_mediums':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ <h4 class="sb-categories-title text-left mt-16" *ngIf="apiContentList.length">
<span *ngIf="userPreference?.framework?.board?.length">{{resourceService?.frmelmnts?.lbl?.boards | transposeTerms: 'frmelmnts.lbl.boards': resourceService?.selectedLang}}:
</span>
<span *ngIf="userPreference?.framework?.board?.length"
class="font-weight-bold">{{convertToString(userPreference?.framework?.board) | interpolate }}</span>
class="font-weight-bold">{{convertToString(userPreference?.framework?.board) | interpolate: 'CBSE': 'CBSE/NCERT'}}</span>
</span>

<span class="mr-24">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ export class ExplorePageComponent implements OnInit, OnDestroy, AfterViewInit {
if (this.isUserLoggedIn()) {
this.prepareVisits([]);
}
//117337 - removed hardcoded cbse/ncert
if (_.get(params, 'board') && params.board[0] === 'CBSE') {
params.board[0] = 'CBSE/NCERT';
}
Expand All @@ -218,6 +219,7 @@ async ngOnInit() {
if (tenant) {
//117337 - removed hardcoded cbse/ncert
const queryParams: Params = { board: tenant['name'] == 'CBSE' ? 'CBSE/NCERT' : tenant['name'],id:tenant['identifier'],selectedTab:selectedTab};
// const queryParams: Params = { board: tenant['name'],id:tenant['identifier'],selectedTab:selectedTab};
this.router.navigate(
[],
{
Expand All @@ -244,7 +246,9 @@ async ngOnInit() {
// guestUserDetails.framework.id = 'ncert_k-12';
// localStorage.setItem('guestUserDetails', JSON.stringify(guestUserDetails));
} else {
//117337 - removed hardcoded cbse/ncert
this.router.navigateByUrl('/explore?board=CBSE/NCERT&gradeLevel=Class 1&gradeLevel=Class 2&&id=ncert_k-12&selectedTab=home');
// this.router.navigateByUrl('/explore?board=CBSE&gradeLevel=Class 1&gradeLevel=Class 2&&id=ncert_k-12&selectedTab=home');

}
}
Expand Down Expand Up @@ -421,6 +425,7 @@ async ngOnInit() {
//this.cacheService.set('searchFilters', filters, { expires: Date.now() + _cacheTimeout });
this.showLoader = true;
this.selectedFilters = pick(filters, _.get(currentPageData , 'metaData.filters'));
//117337 - removed hardcoded cbse/ncert
if (this.selectedFilters && this.selectedFilters['board'] && this.selectedFilters['board'][0] === 'CBSE/NCERT') {
this.selectedFilters['board'][0] = 'CBSE';
}
Expand Down Expand Up @@ -509,6 +514,7 @@ async ngOnInit() {
if (((_.get(currentPageData, 'metaData.filters').indexOf(filterValue) !== -1))) {
let param = {};
param[filterValue] = (typeof (params[filterValue]) === "string") ? params[filterValue].split(',') : params[filterValue];
//117337 - removed hardcoded cbse/ncert
if (param[filterValue].length === 1 && param[filterValue][0] === 'CBSE/NCERT') {
param[filterValue][0] = "CBSE";
}
Expand Down Expand Up @@ -1175,6 +1181,7 @@ async ngOnInit() {
});

const paramValuesInLowerCase = _.mapValues(updatedCategoriesMapping, value => {
//117337 - removed hardcoded cbse/ncert
if (_.toLower(value) === 'cbse') { return 'CBSE/NCERT'; }
return Array.isArray(value) ? _.map(value, _.toLower) : _.toLower(value);
});
Expand Down Expand Up @@ -1397,6 +1404,7 @@ async ngOnInit() {
let pathSegment;
if( this.userPreference.framework.board){
let board = this.userPreference.framework.board[0];
//117337 - removed hardcoded cbse/ncert
if(board==="CBSE/NCERT"){
board="CBSE";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ export class ContentActionsComponent implements OnInit, OnChanges, OnDestroy {
this.isDesktopApp = this.utilService.isDesktopApp;
// Replacing cbse/ncert value with cbse
if (_.toLower(_.get(this.contentData, 'board')) === 'cbse') {
//117337 - removed hardcoded cbse/ncert
this.contentData.board = 'CBSE/NCERT';
// this.contentData.board = 'CBSE';
}
const isVideoMimetype = _.includes(['video/mp4', 'video/webm'], _.get(this.contentData, 'mimeType'));
this.activatedRoute.params.subscribe((params) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ export class ExploreCourseComponent implements OnInit, OnDestroy, AfterViewInit
filters.mimeType = _.get(mimeType, 'values');

// Replacing cbse/ncert value with cbse
//117337 - removed hardcoded cbse/ncert
if (_.toLower(_.get(filters, 'board[0]')) === 'cbse/ncert' || _.toLower(_.get(filters, 'board')) === 'cbse/ncert') {
filters.board = ['cbse'];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,11 +288,16 @@ export class ExploreContentComponent implements OnInit, OnDestroy, AfterViewInit
option.params.framework = this.frameworkId;
}
// Replacing cbse/ncert value with cbse
//117337 - removed hardcoded cbse/ncert
if (_.toLower(_.get(filters, 'board[0]')) === 'cbse/ncert' || _.toLower(_.get(filters, 'board')) === 'cbse/ncert') {
filters.board = ['cbse'];
}
const cbseNcertExists = [_.get(filters, 'board[0]'), _.get(filters, 'board'), _.get(filters, 'se_boards[0]'), _.get(filters, 'se_boards')].some(board => _.toLower(board) === 'cbse/ncert');
if (cbseNcertExists) {
// if (_.toLower(_.get(filters, 'board[0]')) === 'cbse' || _.toLower(_.get(filters, 'board')) === 'cbse') {
// filters.board = ['cbse'];
// }
// const cbseNcertExists = [_.get(filters, 'board[0]'), _.get(filters, 'board'), _.get(filters, 'se_boards[0]'), _.get(filters, 'se_boards')].some(board => _.toLower(board) === 'cbse');
if (cbseNcertExists) {
option.filters.se_boards = ['CBSE'];
} else {
if(pathname != 'explore' && this.queryParams.selectedTab ==="all"){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,10 @@ <h3 class="content-header-info font-weight-bold mb-16 d-flex flex-jc-center">
<div class="max-w-400 computer only">
<div class="mb-15 d-flex flex-jc-center">
<span class="fmedium white-space-nowrap">{{resourceService?.frmelmnts?.lbl?.boards | transposeTerms: 'frmelmnts.lbl.boards' : resourceService?.selectedLang}} :</span>
<span class="fmedium font-w-bold pl-4">{{convertToString(guestUser?.framework?.board) | interpolate: 'CBSE':
<!-- 117337 - removed unused cbse/ncert -->
<span class="fmedium font-w-bold pl-4">{{convertToString(guestUser?.framework?.board) | interpolate: 'CBSE':
'CBSE/NCERT'}}</span>
<!-- <span class="fmedium font-w-bold pl-4">{{convertToString(guestUser?.framework?.board)}}</span> -->
</div>
<div class="mb-15 d-flex flex-jc-center">
<span class="fmedium white-space-nowrap">{{resourceService?.frmelmnts?.lbl?.medium | transposeTerms: 'frmelmnts.lbl.medium' : resourceService?.selectedLang}} :</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<mat-select name={{field.code}} role="listbox" aria-label="field?.label"
class="selection" [(ngModel)]="selectedOption[field.code]" (selectionChange)="handleFieldChange($event, field)">
<mat-option class="mat-dropdown__options" role="option" *ngFor="let option of field.range | sortBy:'name':'asc'" [value]="option?.name | interpolate: 'CBSE': 'CBSE/NCERT'"
attr.aria-label="{{option?.name | interpolate: 'CBSE': 'CBSE/NCERT'}}">{{option?.name}}</mat-option>
attr.aria-label="{{option?.name | interpolate: 'CBSE': 'CBSE/NCERT'}}">{{option?.name | interpolate: 'CBSE': 'CBSE/NCERT'}}</mat-option>
</mat-select>
</mat-form-field>
</div>
Expand Down

0 comments on commit 842ab2d

Please sign in to comment.