Skip to content

Commit

Permalink
149826 - change for dropdown CBSE to CBSE/NCERT (#352) (#364)
Browse files Browse the repository at this point in the history
Co-authored-by: Sagar-trigyn <127492932+Sagar-trigyn@users.noreply.github.com>
  • Loading branch information
TejaswiniGiram19 and Sagar-trigyn authored Jul 24, 2024
1 parent 37d0217 commit 1819fc8
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,11 @@ export class ContentTypeComponent implements OnInit, OnDestroy {
window.open('/'+pathname,'_self');
} else {
if(((params.board && params.board[0] && params.board[0] != undefined) && params.board[0] == 'CBSE')){
//117337 - removed hardcoded cbse/ncert
!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;
} else if(((params.board && params.board[0] && params.board[0] != undefined) && params.board[0] == 'ncert')){
} 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],
{ queryParams: { ...params,board: 'NCERT',selectedTab: data.anonumousUserRoute.queryParam } }) : window.location.href = this.exploreNcert ? '/exploren' : data.loggedInUserRoute.route;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,41 +215,44 @@ async ngOnInit() {
if(pathname != 'explore') {
const selectedTab = urlQuery.get("selectedTab") != undefined || urlQuery.get("selectedTab") != null ? urlQuery.get("selectedTab") : 'home';
const tenant = frameworkList[pathname] ?? frameworkList[urlQuery.get("board")];
if (tenant) {
const queryParams: Params = { board: tenant['name'] == 'CBSE' ? 'CBSE/NCERT' : tenant['name'],id:tenant['identifier'],selectedTab:selectedTab};
this.router.navigate(
[],
{
relativeTo: this.activatedRoute,
queryParams,
queryParamsHandling: 'merge', // remove to replace all query params by provided
skipLocationChange: false
}
);
let guestUserDetails = JSON.parse(localStorage.getItem('guestUserDetails')) ?? {};
if(guestUserDetails && Object.keys(guestUserDetails).length){
console.log('inside')
if(!guestUserDetails.framework){
guestUserDetails.framework = {}
if (tenant) {
//117337 - removed hardcoded cbse/ncert
const queryParams: Params = { board: tenant['name'] == 'CBSE' ? 'CBSE/NCERT' : tenant['name'],id:tenant['identifier'],selectedTab:selectedTab};
this.router.navigate(
[],
{
relativeTo: this.activatedRoute,
queryParams,
queryParamsHandling: 'merge', // remove to replace all query params by provided
skipLocationChange: false
}
);
let guestUserDetails = JSON.parse(localStorage.getItem('guestUserDetails')) ?? {};
if(guestUserDetails && Object.keys(guestUserDetails).length){
if(!guestUserDetails.framework){
guestUserDetails.framework = {}
}
guestUserDetails.framework.board = [queryParams.board];
guestUserDetails.framework.id = queryParams.id;
localStorage.setItem('guestUserDetails', JSON.stringify(guestUserDetails));
}
guestUserDetails.framework.board = [queryParams.board];
guestUserDetails.framework.id = queryParams.id;
localStorage.setItem('guestUserDetails', JSON.stringify(guestUserDetails));
}
}
} else {
let guestUserDetails = JSON.parse(localStorage.getItem('guestUserDetails')) ?? {};
if(guestUserDetails && Object.keys(guestUserDetails).length){
// guestUserDetails.framework.board = ['CBSE'];
// guestUserDetails.framework.id = 'ncert_k-12';
// localStorage.setItem('guestUserDetails', JSON.stringify(guestUserDetails));
} else {
this.router.navigateByUrl('/explore?board=CBSE/NCERT&gradeLevel=Class 1&gradeLevel=Class 2&&id=ncert_k-12&selectedTab=home');
let guestUserDetails = JSON.parse(localStorage.getItem('guestUserDetails')) ?? {};
if(guestUserDetails && Object.keys(guestUserDetails).length){
// guestUserDetails.framework.board = ['CBSE'];
// guestUserDetails.framework.id = 'ncert_k-12';
// localStorage.setItem('guestUserDetails', JSON.stringify(guestUserDetails));
} else {
this.router.navigateByUrl('/explore?board=CBSE/NCERT&gradeLevel=Class 1&gradeLevel=Class 2&&id=ncert_k-12&selectedTab=home');

}
}
}
const delay = ms => new Promise(res => setTimeout(res, ms));
await delay(100);

const delay = ms => new Promise(res => setTimeout(res, ms));
await delay(100);



this.isDesktopApp = this.utilService.isDesktopApp;
this.setUserPreferences();
this.subscription$ = this.activatedRoute.queryParams.subscribe(queryParams => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,11 @@ export class ExploreContentComponent implements OnInit, OnDestroy, AfterViewInit
option.params.framework = this.frameworkId;
}
// Replacing cbse/ncert value with cbse
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 (cbseNcertExists) {
option.filters.se_boards = ['CBSE'];
} else {
if(pathname != 'explore' && this.queryParams.selectedTab ==="all"){
Expand Down

0 comments on commit 1819fc8

Please sign in to comment.