Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Fix linting issues #3583

Merged
merged 2 commits into from
Aug 30, 2021
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
5 changes: 3 additions & 2 deletions frontend_v2/src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { NgModule } from '@angular/core';
import { RouterModule, Routes, PreloadAllModules } from '@angular/router';
import { RouterModule, Routes } from '@angular/router';

// import component
import { NotFoundComponent } from './components/not-found/not-found.component';
Expand Down Expand Up @@ -66,7 +66,8 @@ const routes: Routes = [
},
{
path: 'template-challenge-create/:id/:phases',
loadChildren: './components/template-challenge-create/template-challenge-create.module#TemplateChallengeCreateModule',
loadChildren:
'./components/template-challenge-create/template-challenge-create.module#TemplateChallengeCreateModule',
},
{
path: '404',
Expand Down
1 change: 0 additions & 1 deletion frontend_v2/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ export class AppComponent implements OnInit, OnDestroy {
*/
@HostListener('window:scroll', [])
onWindowScroll(): void {
const HEADER_ELE = document.getElementById('header-static');
if (this.document.documentElement.scrollTop > 50) {
if (this.scrolledState === false) {
this.globalService.scrolledStateChange(true);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, OnInit, Inject } from '@angular/core';
import { Component, OnInit } from '@angular/core';
import { AfterViewInit } from '@angular/core';
import { ApiService } from '../../../services/api.service';
import { EndpointsService } from '../../../services/endpoints.service';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Component, OnInit, QueryList, ViewChildren, AfterViewInit, OnDestroy } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { Router, ActivatedRoute } from '@angular/router';
import { NGXLogger } from 'ngx-logger';

// import component
import { SelectphaseComponent } from '../../utility/selectphase/selectphase.component';
Expand Down Expand Up @@ -147,7 +146,7 @@ export class ChallengeleaderboardComponent implements OnInit, AfterViewInit, OnD
/**
* Number of entries on complete leaderboard
*/
numberOfAllEntries:number = 0;
numberOfAllEntries = 0;

/**
* Current state of whether private leaderboard
Expand Down Expand Up @@ -221,8 +220,7 @@ export class ChallengeleaderboardComponent implements OnInit, AfterViewInit, OnD
private globalService: GlobalService,
private apiService: ApiService,
private endpointsService: EndpointsService,
public dialog: MatDialog,
private logger: NGXLogger
public dialog: MatDialog
) {}

/**
Expand Down Expand Up @@ -265,8 +263,7 @@ export class ChallengeleaderboardComponent implements OnInit, AfterViewInit, OnD
if (this.phaseSplits[i].visibility !== this.challengePhaseVisibility.public) {
this.phaseSplits[i].showPrivate = true;
this.showPrivateIds.push(this.phaseSplits[i].id);
}
else {
} else {
this.phaseSplits[i].showPrivate = false;
}
}
Expand Down Expand Up @@ -303,8 +300,8 @@ export class ChallengeleaderboardComponent implements OnInit, AfterViewInit, OnD
if (self.viewInit) {
self.components.map((item) => {
item.selectPhaseSplit(self.selectedPhaseSplit, 'selectBox', 'phaseSplit');
})
this.phaseSplitSelected(self.selectedPhaseSplit)
});
this.phaseSplitSelected(self.selectedPhaseSplit);
} else {
setTimeout(() => {
checkViewInit();
Expand All @@ -324,52 +321,52 @@ export class ChallengeleaderboardComponent implements OnInit, AfterViewInit, OnD
* This is called when a phase split is selected (from child components)
* Updates the router URL with phase-split-id
*/
selectedPhaseSplitUrlChange = (phaseSplit) => {
selectedPhaseSplitUrlChange = (phaseSplit) => {
const SELF = this;
if (SELF.router.url.endsWith('leaderboard')) {
SELF.router.navigate([phaseSplit['id']], { relativeTo: this.route });
} else if (SELF.router.url.split('/').length === 5) {
SELF.router.navigate(['../' + phaseSplit['id']], { relativeTo: this.route });
} else if (SELF.router.url.split('/').length === 6) {
SELF.router.navigate(['../../' + phaseSplit['id']], { relativeTo: this.route });
}
if (SELF.router.url.endsWith('leaderboard')) {
SELF.router.navigate([phaseSplit['id']], { relativeTo: this.route });
} else if (SELF.router.url.split('/').length === 5) {
SELF.router.navigate(['../' + phaseSplit['id']], { relativeTo: this.route });
} else if (SELF.router.url.split('/').length === 6) {
SELF.router.navigate(['../../' + phaseSplit['id']], { relativeTo: this.route });
}
};

/**
* This is called when a phase split is selected
*/
phaseSplitSelected(phaseSplit) {
const SELF = this;
SELF.selectedPhaseSplit = phaseSplit;
phaseSplitSelected(phaseSplit) {
const SELF = this;
SELF.selectedPhaseSplit = phaseSplit;

SELF.fetchNumberOfAllEnteriesOnPublicLeaderboard(SELF.selectedPhaseSplit['id']);

const API_PATH = SELF.endpointsService.particularChallengePhaseSplitUrl(SELF.selectedPhaseSplit['id']);
SELF.apiService.getUrl(API_PATH).subscribe(
(data) => {
SELF.leaderboardPrecisionValue = data.leaderboard_decimal_precision;
SELF.setLeaderboardPrecisionValue = `1.${ SELF.leaderboardPrecisionValue }-${ SELF.leaderboardPrecisionValue }`;
},
(err) => {
SELF.globalService.handleApiError(err);
},
() => {}
);
SELF.fetchNumberOfAllEnteriesOnPublicLeaderboard(SELF.selectedPhaseSplit['id']);

if (SELF.selectedPhaseSplit && SELF.router.url.endsWith('leaderboard/' + phaseSplit['id'])) {
if(SELF.getAllEntriesTextOption == 'Exclude private submissions') {
SELF.fetchAllEnteriesOnPublicLeaderboard(SELF.selectedPhaseSplit['id']);
} else {
SELF.fetchLeaderboard(SELF.selectedPhaseSplit['id']);
}
SELF.showLeaderboardByLatest = SELF.selectedPhaseSplit.show_leaderboard_by_latest_submission;
SELF.sortLeaderboardTextOption = SELF.showLeaderboardByLatest ? 'Sort by best' : 'Sort by latest';
let selectedPhase = SELF.phases.find((phase) => {
return phase.id === SELF.selectedPhaseSplit.challenge_phase
})
SELF.isSelectedPhaseLeaderboardPublic = selectedPhase.leaderboard_public
const API_PATH = SELF.endpointsService.particularChallengePhaseSplitUrl(SELF.selectedPhaseSplit['id']);
SELF.apiService.getUrl(API_PATH).subscribe(
(data) => {
SELF.leaderboardPrecisionValue = data.leaderboard_decimal_precision;
SELF.setLeaderboardPrecisionValue = `1.${SELF.leaderboardPrecisionValue}-${SELF.leaderboardPrecisionValue}`;
},
(err) => {
SELF.globalService.handleApiError(err);
},
() => {}
);

if (SELF.selectedPhaseSplit && SELF.router.url.endsWith('leaderboard/' + phaseSplit['id'])) {
if (SELF.getAllEntriesTextOption === 'Exclude private submissions') {
SELF.fetchAllEnteriesOnPublicLeaderboard(SELF.selectedPhaseSplit['id']);
} else {
SELF.fetchLeaderboard(SELF.selectedPhaseSplit['id']);
}
};
SELF.showLeaderboardByLatest = SELF.selectedPhaseSplit.show_leaderboard_by_latest_submission;
SELF.sortLeaderboardTextOption = SELF.showLeaderboardByLatest ? 'Sort by best' : 'Sort by latest';
const selectedPhase = SELF.phases.find((phase) => {
return phase.id === SELF.selectedPhaseSplit.challenge_phase;
});
SELF.isSelectedPhaseLeaderboardPublic = selectedPhase.leaderboard_public;
}
}

/**
* This updates the leaderboard results after fetching them from API
Expand Down Expand Up @@ -556,7 +553,7 @@ export class ChallengeleaderboardComponent implements OnInit, AfterViewInit, OnD
*/
startLeaderboard(phaseSplitId) {
let API_PATH;
if(this.getAllEntriesTextOption == 'Exclude private submissions') {
if (this.getAllEntriesTextOption === 'Exclude private submissions') {
API_PATH = this.endpointsService.challengeCompleteLeaderboardURL(phaseSplitId);
} else {
API_PATH = this.endpointsService.challengeLeaderboardURL(phaseSplitId);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, OnInit, Inject } from '@angular/core';
import { Component, OnInit } from '@angular/core';

// import service
import { ChallengeService } from '../../../services/challenge.service';
Expand Down Expand Up @@ -26,9 +26,7 @@ export class ChallengeoverviewComponent implements OnInit {
* Constructor.
* @param challengeService ChallengeService Injection.
*/
constructor(
private challengeService: ChallengeService
) {}
constructor(private challengeService: ChallengeService) {}

/**
* Component on initialized.
Expand Down
Loading