Skip to content

Commit

Permalink
Merge pull request #83 from Sohith-code/cbrelease-4.8.19
Browse files Browse the repository at this point in the history
Check for old and new api according to v5 and v6 competency key
  • Loading branch information
vishnubansaltarento authored Nov 12, 2024
2 parents f2d8a36 + 5a7f27f commit 55c1418
Show file tree
Hide file tree
Showing 24 changed files with 76 additions and 63 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ speed-measure-plugin.json
*.launch
.settings/
*.sublime-workspace
.angular

# IDE - VSCode
.vscode/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ describe('DemoVideoPopupComponent', () => {
it('should create a instance of component', () => {
expect(component).toBeTruthy()
})
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ describe('SolutionSurveyUploadComponent', () => {
it('should create a instance of component', () => {
expect(component).toBeTruthy()
})
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import { AboutComponent } from './about.component'
describe('AboutComponent', () => {
let component: AboutComponent



beforeAll(() => {
component = new AboutComponent(

Expand All @@ -20,4 +18,4 @@ describe('AboutComponent', () => {
it('should create a instance of component', () => {
expect(component).toBeTruthy()
})
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ describe('AcbpReportsComponent', () => {
it('should create a instance of component', () => {
expect(component).toBeTruthy()
})
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ describe('AddThumbnailComponent', () => {
it('should create a instance of component', () => {
expect(component).toBeTruthy()
})
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ describe('EmailDomainsComponent', () => {
getDomainsList: jest.fn().mockReturnValue(of({
result: {
count: 'sampleCount',
data: 'sampledata'
}
data: 'sampledata',
},
})),
}

Expand All @@ -51,8 +51,6 @@ describe('EmailDomainsComponent', () => {
expect(component).toBeTruthy()
})



it('should call getPendingList if no data in activatedRoute on ngOnInit', () => {
component.getPendingList = jest.fn()
component.ngOnInit()
Expand Down Expand Up @@ -97,10 +95,10 @@ describe('EmailDomainsComponent', () => {
component.getApprovedList = jest.fn()
component.getRejectedList = jest.fn()

//act
// act
component.onPaginateChange(pageEvent)

//assert
// assert
expect(component.pageIndex).toBe(1)
expect(component.limit).toBe(10)
expect(component.currentOffset).toBe(1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export class CreateEventComponent implements OnInit {
private router: Router, private configSvc: ConfigurationsService, private changeDetectorRefs: ChangeDetectorRef,
// tslint:disable-next-line:align
private activeRoute: ActivatedRoute, private events: EventService, private profileUtilSvc: ProfileV2UtillService,
private pipePublic: PipePublicURL
private pipePublic: PipePublicURL
) {

if (this.configSvc.userProfile) {
Expand Down Expand Up @@ -602,7 +602,7 @@ export class CreateEventComponent implements OnInit {
this.dialogRef.afterClosed().subscribe(() => {
setTimeout(() => {
this.router.navigate([`/app/home/events`])
}, 700)
}, 700)
})
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ export class EditEventComponent implements OnInit {
this.displayLoader = false
this.openSnackbar('Event details are successfuly updated.')
this.router.navigate([`/app/home/events`])
}, 5000)
}, 5000)
}
},
(err: any) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ describe('EventThumbnailComponent', () => {
it('should create a instance of component', () => {
expect(component).toBeTruthy()
})
})
})
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@


import { MatDialog } from '@angular/material/dialog'
import { ActivatedRoute, Router } from '@angular/router'
import { ConfigurationsService, EventService } from '@sunbird-cb/utils'
Expand All @@ -21,7 +20,7 @@ describe('EventsListComponent', () => {
userProfile: {
userId: 'sampleId',
rootOrgId: 'rootId',
departmentName: 'department'
departmentName: 'department',
},
},
},
Expand Down Expand Up @@ -56,4 +55,4 @@ describe('EventsListComponent', () => {
it('should create a instance of component', () => {
expect(component).toBeTruthy()
})
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ describe('ParticipantsComponent', () => {
it('should create a instance of component', () => {
expect(component).toBeTruthy()
})
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ describe('SuccessComponent', () => {
it('should create a instance of component', () => {
expect(component).toBeTruthy()
})
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ describe('ImageCropComponent', () => {
it('should create a instance of component', () => {
expect(component).toBeTruthy()
})
})
})
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@


import { ActivatedRoute } from '@angular/router'
import { MatDialog } from '@angular/material/dialog'
import { KCMMappingComponent } from './kcm-mapping.component'


describe('KCMMappingComponent', () => {
let component: KCMMappingComponent

Expand All @@ -26,4 +24,4 @@ describe('KCMMappingComponent', () => {
it('should create a instance of component', () => {
expect(component).toBeTruthy()
})
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ describe('ConfigureMarketplaceProvidersComponent', () => {
it('should create a instance of component', () => {
expect(component).toBeTruthy()
})
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ describe('ContentUploadComponent', () => {
it('should create a instance of component', () => {
expect(component).toBeTruthy()
})
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ describe('CoursesPreviewComponent', () => {

const marketPlaceSvc: Partial<MarketplaceService> = {}
const router: Partial<Router> = {
navigate: jest.fn()
navigate: jest.fn(),
}

beforeAll(() => {
Expand All @@ -25,4 +25,4 @@ describe('CoursesPreviewComponent', () => {
it('should create a instance of component', () => {
expect(component).toBeTruthy()
})
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import { CoursesTableComponent } from './courses-table.component'
describe('CoursesTableComponent', () => {
let component: CoursesTableComponent



beforeAll(() => {
component = new CoursesTableComponent(

Expand All @@ -19,4 +17,4 @@ describe('CoursesTableComponent', () => {
it('should create a instance of component', () => {
expect(component).toBeTruthy()
})
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import { HelpCenterGuideComponent } from './help-center-guide.component'
describe('HelpCenterGuideComponent', () => {
let component: HelpCenterGuideComponent



beforeAll(() => {
component = new HelpCenterGuideComponent(

Expand All @@ -19,4 +17,4 @@ describe('HelpCenterGuideComponent', () => {
it('should create a instance of component', () => {
expect(component).toBeTruthy()
})
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ describe('MarketPlaceDashboardComponent', () => {
it('should create a instance of component', () => {
expect(component).toBeTruthy()
})
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import { ProvidersComponent } from './providers.component'
describe('ProvidersComponent', () => {
let component: ProvidersComponent



beforeAll(() => {
component = new ProvidersComponent(

Expand All @@ -20,4 +18,4 @@ describe('ProvidersComponent', () => {
it('should create a instance of component', () => {
expect(component).toBeTruthy()
})
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,12 @@
</button>
</div>
<div>
<span class="display-inline-block complabels mat-caption cursor-pointer"
[ngClass]="{active: (seletedCompetencyTheme && option.identifier === seletedCompetencyTheme.identifier)}"
<span class="display-inline-block complabels mat-caption cursor-pointer" [ngClass]="{active: (seletedCompetencyTheme &&
(option?.identifier && option?.identifier === seletedCompetencyTheme?.identifier ||
option?.name && option?.name === seletedCompetencyTheme?.name))}"
(click)="compThemeSelected(option)"
*ngFor="let option of filteredallCompetencyTheme">{{option?.additionalProperties?.displayName}}</span>
*ngFor="let option of filteredallCompetencyTheme">{{option?.additionalProperties?.displayName ||
option?.name}}</span>
</div>
</div>

Expand All @@ -152,10 +154,12 @@
</button>
</div>
<div>
<span class="display-inline-block complabels mat-caption cursor-pointer"
[ngClass]="{active: (seletedCompetencySubTheme && option.identifier === seletedCompetencySubTheme.identifier)}"
<span class="display-inline-block complabels mat-caption cursor-pointer" [ngClass]="{active: (seletedCompetencySubTheme &&
(option?.identifier && option?.identifier === seletedCompetencySubTheme?.identifier ||
option?.name && option?.name === seletedCompetencySubTheme?.name))}"
(click)="compSubThemeSelected(option)"
*ngFor="let option of filteredallCompetencySubtheme">{{option?.additionalProperties?.displayName}}</span>
*ngFor="let option of filteredallCompetencySubtheme">{{option?.additionalProperties?.displayName ||
option?.name}}</span>
</div>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,11 @@ export class RequestCopyDetailsComponent implements OnInit {
this.competencyTheme = new FormControl('')
this.competencySubtheme = new FormControl('')

// this.getFilterEntity()
this.getFilterEntityV2()
if (this.compentencyKey.vKey === 'competencies_v5') {
this.getFilterEntity()
} else {
this.getFilterEntityV2()
}

this.activatedRouter.queryParams.subscribe((params: any) => {
if (params['id']) {
Expand Down Expand Up @@ -432,7 +435,7 @@ export class RequestCopyDetailsComponent implements OnInit {
this.allCompetencies.forEach((val: any) => {
if (option.name === val.name) {
this.seletedCompetencyArea = val
this.allCompetencyTheme = val.themes
this.allCompetencyTheme = val.themes || val.children
this.filteredallCompetencyTheme = this.allCompetencyTheme

}
Expand All @@ -442,9 +445,9 @@ export class RequestCopyDetailsComponent implements OnInit {
compThemeSelected(option: any) {
this.enableCompetencyAdd = false
this.allCompetencyTheme.forEach((val: any) => {
if (option.identifier === val.identifier) {
if ((option.identifier && option.identifier === val.identifier) || (option.name && option.name === val.name)) {
this.seletedCompetencyTheme = val
this.allCompetencySubtheme = val.associations
this.allCompetencySubtheme = val.associations || val.children
this.filteredallCompetencySubtheme = this.allCompetencySubtheme
}
})
Expand All @@ -453,7 +456,7 @@ export class RequestCopyDetailsComponent implements OnInit {
compSubThemeSelected(option: any) {
this.enableCompetencyAdd = true
this.allCompetencySubtheme.forEach((val: any) => {
if (option.identifier === val.identifier) {
if ((option.identifier && option.identifier === val.identifier) || (option.name && option.name === val.name)) {
this.seletedCompetencySubTheme = val
}
})
Expand Down Expand Up @@ -489,17 +492,35 @@ export class RequestCopyDetailsComponent implements OnInit {

addCompetency() {
if (this.seletedCompetencyArea && this.seletedCompetencyTheme && this.seletedCompetencySubTheme) {
const obj = {
competencyArea: this.seletedCompetencyArea.name,
competencyAreaId: this.seletedCompetencyArea.identifier,
competencyAreaDescription: this.seletedCompetencyArea.description,
competencyTheme: this.seletedCompetencyTheme.additionalProperties.displayName,
competencyThemeId: this.seletedCompetencyTheme.identifier,
competecnyThemeDescription: this.seletedCompetencyTheme.description,
competencyThemeType: this.seletedCompetencyTheme.refType,
competencySubTheme: this.seletedCompetencySubTheme.additionalProperties.displayName,
competencySubThemeId: this.seletedCompetencySubTheme.identifier,
competecnySubThemeDescription: this.seletedCompetencySubTheme.description,
let obj: any
if (this.compentencyKey.vKey === 'competencies_v5') {
obj = {
competencyArea: this.seletedCompetencyArea.name,
competencyAreaId: this.seletedCompetencyArea.id,
competencyAreaDescription: this.seletedCompetencyArea.description,
competencyTheme: this.seletedCompetencyTheme.name,
competencyThemeId: this.seletedCompetencyTheme.id,
competecnyThemeDescription: this.seletedCompetencyTheme.description,
competencyThemeType: this.seletedCompetencyTheme.additionalProperties.themeType,
competencySubTheme: this.seletedCompetencySubTheme.name,
competencySubThemeId: this.seletedCompetencySubTheme.id,
competecnySubThemeDescription: this.seletedCompetencySubTheme.description,
}

} else {

obj = {
competencyArea: this.seletedCompetencyArea.name,
competencyAreaId: this.seletedCompetencyArea.identifier,
competencyAreaDescription: this.seletedCompetencyArea.description,
competencyTheme: this.seletedCompetencyTheme.additionalProperties.displayName,
competencyThemeId: this.seletedCompetencyTheme.identifier,
competecnyThemeDescription: this.seletedCompetencyTheme.description,
competencyThemeType: this.seletedCompetencyTheme.refType,
competencySubTheme: this.seletedCompetencySubTheme.additionalProperties.displayName,
competencySubThemeId: this.seletedCompetencySubTheme.identifier,
competecnySubThemeDescription: this.seletedCompetencySubTheme.description,
}
}

const value = this.requestForm.controls[this.compentencyKey.vKey].value || []
Expand Down

0 comments on commit 55c1418

Please sign in to comment.