Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Issue #SB-0000 fix: Updated codesmells issues #3196

Merged
merged 2 commits into from
Oct 18, 2022
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
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Component, Input, OnInit } from '@angular/core';
import { Component, Input} from '@angular/core';
import { ModalController } from '@ionic/angular';
import { TelemetryGeneratorService } from '@app/services';
import { AppVersion } from '@ionic-native/app-version/ngx';

@Component({
Expand Down
4 changes: 1 addition & 3 deletions src/app/content-details/content-details.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,6 @@ export class ContentDetailsPage implements OnInit, OnDestroy {
config: any;
nextContentToBePlayed: any;
isPlayerPlaying = false;
// displayTranscripts = false;
// transcriptList = [];

constructor(
@Inject('PROFILE_SERVICE') private profileService: ProfileService,
Expand Down Expand Up @@ -1649,7 +1647,7 @@ export class ContentDetailsPage implements OnInit, OnDestroy {
}
try {
const batchDetails = await this.courseService.getBatchDetails({ batchId }).toPromise();
for (var key in batchDetails.cert_templates) {
for (let key in batchDetails.cert_templates) {
return (batchDetails && batchDetails.cert_templates[key] &&
batchDetails.cert_templates[key].description) || '';
}
Expand Down
1 change: 0 additions & 1 deletion src/app/courses/courses.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,6 @@ export class CoursesPage implements OnInit, OnDestroy {
async getAggregatorResult(resetFilter?: boolean) {
this.spinner(true);
this.profile = await this.profileService.getActiveSessionProfile({ requiredFields: ProfileConstants.REQUIRED_FIELDS }).toPromise();
const audience: string[] = await this.profileHandler.getAudience(this.profile.profileType);
const request: ContentAggregatorRequest = {
applyFirstAvailableCombination: {},
userPreferences: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,6 @@ export class ChapterDetailsPage implements OnInit, OnDestroy, ConsentPopoverActi
}

async getAllBatches() {
// const loader = await this.commonUtilService.getLoader();
this.courseBatchesRequest = {
filters: {
courseId: this.courseContentData.identifier,
Expand Down Expand Up @@ -615,11 +614,6 @@ export class ChapterDetailsPage implements OnInit, OnDestroy, ConsentPopoverActi
return;
}

// if (!this.batches || !this.batches.length) {
// this.commonUtilService.showToast('NO_BATCHES_AVAILABLE');
// await loader.dismiss();
// return;
// }

if (!this.localCourseService.isEnrollable(this.batches, this.courseContentData)) {
return;
Expand Down Expand Up @@ -670,7 +664,6 @@ export class ChapterDetailsPage implements OnInit, OnDestroy, ConsentPopoverActi

this.localCourseService.enrollIntoBatch(enrollCourse, this, this.courseContent).toPromise()
.then(async (data: boolean) => {
// await this.loader.dismiss();
this.courseContent.batchId = item.id;
this.commonUtilService.showToast(this.categoryKeyTranslator.transform('FRMELEMNTS_MSG_COURSE_ENROLLED', this.courseContent));
this.events.publish(EventTopics.ENROL_COURSE_SUCCESS, {
Expand Down
3 changes: 1 addition & 2 deletions src/app/district-mapping/district-mapping.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ export class DistrictMappingPage implements OnDestroy {
this.getEnvironment(), '', '', '', undefined,
featureIdMap.location.LOCATION_CAPTURE);
this.headerService.hideHeader();
// await this.checkLocationAvailability();
const correlationList: Array<CorrelationData> = [];
this.telemetryGeneratorService.generatePageLoadedTelemetry(
PageId.LOCATION,
Expand Down Expand Up @@ -226,7 +225,7 @@ export class DistrictMappingPage implements OnDestroy {
const req = {
userId: this.appGlobalService.getCurrentUser().uid || this.profile.uid,
profileLocation: locationCodes,
...((name ? { firstName: name } : {})),
...(name ? { firstName: name } : {}),
lastName: '',
profileUserTypes: userTypes
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import { Component } from '@angular/core';
})
export class NoDownloadsComponent {

constructor() { }
constructor() {
console.log('no-downloads-component');
}


}
2 changes: 1 addition & 1 deletion src/app/faq-help/faq-help.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ export class FaqHelpPage implements OnInit {
return;
}
this.value = event.data;
window.parent.postMessage(this.value, '*');
window.parent.postMessage(this.value, window.parent.origin);
}

async navigateToReportIssue() {
Expand Down
4 changes: 2 additions & 2 deletions src/app/faq-report-issue/faq-report-issue.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ export class FaqReportIssuePage implements OnInit, OnDestroy {
}

private generateLogTelemetry(){

}

takeAction(action?: string) {
Expand Down Expand Up @@ -473,7 +473,7 @@ export class FaqReportIssuePage implements OnInit, OnDestroy {
} else if (this.formValues.children && this.formValues.children.category && this.formValues.children.category) {
this.value.initiateEmailBody = this.formValues.children.category.details;
}
window.parent.postMessage(this.value, '*');
window.parent.postMessage(this.value, window.parent.origin);
}
setTimeout(() => {
this.location.back();
Expand Down
1 change: 0 additions & 1 deletion src/app/home/admin-home/admin-home.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,6 @@ export class AdminHomePage implements OnInit, OnDestroy, OnTabViewWillEnter {
event.data = event.data.content ? event.data.content : event.data;
const item = event.data;
const index = event.index;
const identifier = item.contentId || item.identifier;
const values = {};
values['sectionName'] = sectionName;
values['positionClicked'] = index;
Expand Down
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 @@ -837,8 +837,8 @@ export class UserHomePage implements OnInit, OnDestroy, OnTabViewWillEnter {
this.events.publish('onPreferenceChange:showReport', false);
}
} catch (error) {
this.otherCategories = [],
this.events.publish('onPreferenceChange:showReport', false);
this.otherCategories = [];
this.events.publish('onPreferenceChange:showReport', false);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,6 @@ export class DomainEcmLsitingComponent {

async openAction(assessment, evidenceIndex) {
this.utils.setCurrentimageFolderName(this.entityEvidences[evidenceIndex].externalId, assessment._id);
const options = {
_id: assessment._id,
name: assessment.name,
selectedEvidence: evidenceIndex,
entityDetails: this.entityData,
};
return 'view'
}

Expand All @@ -191,7 +185,6 @@ export class DomainEcmLsitingComponent {
this.checkForEvidenceCompletion();
} else {
const entity = { _id: this.submissionId, name: this.entityName };
let action = this.submissionId ? await this.openAction(entity, evidenceIndex) : null;
this.selectedEvidenceIndex = evidenceIndex;
this.currentEvidence = this.entityData['assessment']['evidences'][this.selectedEvidenceIndex];
this.evidenceSections = this.currentEvidence['sections'];
Expand Down Expand Up @@ -234,12 +227,6 @@ export class DomainEcmLsitingComponent {
}

async goToQuestioner(selectedSection) {
const params = {
_id: this.submissionId,
name: this.entityName,
selectedEvidence: this.selectedEvidenceIndex,
selectedSection: selectedSection,
};
if (!this.evidenceSections[selectedSection].progressStatus && this.submissionId) {
this.evidenceSections[selectedSection].progressStatus = this.currentEvidence.startTime ? 'inProgress' : '';
this.localStorage.setLocalStorage(this.utils.getAssessmentLocalStorageKey(this.submissionId), this.entityData);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ export class ImageListingComponent implements OnInit {
}

cloudImageUpload() {
var options: FileUploadOptions = {
const options: FileUploadOptions = {
fileKey: this.imageList[this.uploadIndex].file,
fileName: this.imageList[this.uploadIndex].file,
chunkedMode: false,
Expand Down Expand Up @@ -279,10 +279,6 @@ export class ImageListingComponent implements OnInit {
}
this.schoolData['assessment']['evidences'][this.selectedEvidenceIndex].isSubmitted = true;
this.localStorage.setLocalStorage(this.utils.getAssessmentLocalStorageKey(this.submissionId), this.schoolData);
const options = {
_id: this.submissionId,
name: this.schoolName,
};
this.loader.stopLoader();
history.go(-2);
},
Expand Down Expand Up @@ -404,7 +400,6 @@ export class ImageListingComponent implements OnInit {

constructMatrixObject(question) {
const value = [];
const currentEvidence = this.currentEvidence;

for (const instance of question.value) {
let eachInstance = {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,12 +332,6 @@ export class ObservationSubmissionComponent implements OnInit {
aseessmemtData.assessment.evidences[evidenceIndex].externalId,
assessment._id
);
const options = {
_id: assessment._id,
name: assessment.name,
selectedEvidence: evidenceIndex,
entityDetails: aseessmemtData
};
this.router.navigate([RouterLinks.QUESTIONNAIRE], {
queryParams: {
submisssionId: assessment._id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ export class CreateProjectPage implements OnInit {
if (res.field != 'categories') {
if (res.validation) {
if (res.validation.required) {
(res.validation.name = 'required'), validationsArray.push(Validators.required);
res.validation.name = 'required';
validationsArray.push(Validators.required);
}
controls[res.field] = new FormControl(this.project ? this.project[res.field] : '', validationsArray);
}
Expand All @@ -162,7 +163,8 @@ export class CreateProjectPage implements OnInit {
res.taskData.forEach((element) => {
if (element.validation) {
if (element.validation.required) {
(element.validation.name = 'required'), validationsArray.push(Validators.required);
element.validation.name = 'required';
validationsArray.push(Validators.required);
}
controls[element.field] = new FormControl('', validationsArray);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@ export class MultipleTypeInputComponent implements OnInit {
hint,
},
});
// await hintModal.onDidDismiss(data => {
// });
hintModal.present();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ export class RadioTypeInputComponent implements OnInit {
hint,
},
});
// await hintModal.onDidDismiss(data => {
// });
hintModal.present();

}
Expand Down
2 changes: 1 addition & 1 deletion src/app/player/player.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export class PlayerPage implements OnInit, OnDestroy, PlayerActionHandlerDelegat
this.pauseSubscription = this.platform.pause.subscribe(() => {
const iframes = window.document.getElementsByTagName('iframe');
if (iframes.length > 0) {
iframes[0].contentWindow.postMessage('pause.youtube', '*');
iframes[0].contentWindow.postMessage('pause.youtube', window.parent.origin);
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,15 +268,13 @@ export class SelfDeclaredTeacherEditPage {
}

private async checkLocationAvailability() {
let stateId;
let availableLocationData;
if (this.profile && this.profile['userLocations'] && this.profile['userLocations'].length) {
for (const ele of this.profile['userLocations']) {
if (ele.type === 'district') {
this.availableLocationDistrict = ele.name;

} else if (ele.type === 'state') {
stateId = ele.id || null;
this.availableLocationState = ele.name;
}
}
Expand Down
1 change: 0 additions & 1 deletion src/services/search-filter/search-filter.service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Injectable } from '@angular/core';
import { FormRequest } from 'sunbird-sdk';
import { FormAndFrameworkUtilService } from '@app/services';
import { FormConstants } from '@app/app/form.constants';
import { OnboardingConfigurationService } from '../onboarding-configuration.service';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ export class SplaschreenDeeplinkActionHandlerDelegate implements SplashscreenAct
this.isOnboardingCompleted =
(await this.preferences.getString(PreferenceKey.IS_ONBOARDING_COMPLETED).toPromise() === 'true') ? true : false;

// const session = await this.authService.getSession().toPromise();

// If onboarding not completed
if (!this.isOnboardingCompleted) { // && !session
Expand Down
4 changes: 3 additions & 1 deletion src/util/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ export type EventHandler = (...args: any[]) => any;
export class Events {
private c = new Map<string, EventHandler[]>();

constructor() {}
constructor() {
console.log('events.ts');
}

subscribe(topic: string, ...handlers: EventHandler[]) {
let topics = this.c.get(topic);
Expand Down