Skip to content
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
Expand Up @@ -498,13 +498,12 @@ export class <%=ClassName%> implements OnInit, AfterViewInit, OnDestroy {
let rnd = Math.random();
rnd = Math.round(rnd * 100) / 100;
const volatility = 2;
let newPrice = 0;
let changePercent = 2 * volatility * rnd;
if (changePercent > volatility) {
changePercent -= (2 * volatility);
}
const changeAmount = oldPrice * (changePercent / 100);
newPrice = oldPrice + changeAmount;
let newPrice = oldPrice + changeAmount;
newPrice = Math.round(newPrice * 100) / 100;
const result = { Price: 0, ChangePercent: 0 };
changePercent = Math.round(changePercent * 100) / 100;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -953,15 +953,13 @@ export class FinancialData {
private generateNewPrice(oldPrice: number): any {
const rnd = parseFloat(Math.random().toFixed(2));
const volatility = 2;
let newPrice = 0;

let changePercent = 2 * volatility * rnd;
if (changePercent > volatility) {
changePercent -= (2 * volatility);
}

const changeAmount = oldPrice * (changePercent / 100);
newPrice = oldPrice + changeAmount;
const newPrice = oldPrice + changeAmount;

const result = {Price: 0, ChangePercent: 0};
result.Price = parseFloat(newPrice.toFixed(2));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,13 +328,12 @@ export class <%=ClassName%> implements OnInit, AfterViewInit, OnDestroy {
let rnd = Math.random();
rnd = Math.round(rnd * 100) / 100;
const volatility = 2;
let newPrice = 0;
let changePercent = 2 * volatility * rnd;
if (changePercent > volatility) {
changePercent -= (2 * volatility);
}
const changeAmount = oldPrice * (changePercent / 100);
newPrice = oldPrice + changeAmount;
let newPrice = oldPrice + changeAmount;
newPrice = Math.round(newPrice * 100) / 100;
const result = {Price: 0, ChangePercent: 0};
changePercent = Math.round(changePercent * 100) / 100;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -953,15 +953,13 @@ export class FinancialData {
private generateNewPrice(oldPrice: number): any {
const rnd = parseFloat(Math.random().toFixed(2));
const volatility = 2;
let newPrice = 0;

let changePercent = 2 * volatility * rnd;
if (changePercent > volatility) {
changePercent -= (2 * volatility);
}

const changeAmount = oldPrice * (changePercent / 100);
newPrice = oldPrice + changeAmount;
const newPrice = oldPrice + changeAmount;

const result = {Price: 0, ChangePercent: 0};
result.Price = parseFloat(newPrice.toFixed(2));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Component } from '@angular/core';

@Component({
selector: "<%=filePrefix%>",
selector: "app-<%=filePrefix%>",
templateUrl: './<%=filePrefix%>.html',
styleUrl: './<%=filePrefix%>.scss'
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,15 @@ module.exports = defineConfig([
],
// Relax rules
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@angular-eslint/prefer-inject': 'off',
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
},
},
{
files: ['**/*.spec.ts'],
rules: {
'@typescript-eslint/class-literal-property-style': 'off',
},
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@ export class FacebookProvider implements AuthProvider {
}

public logout() {
FB.logout((response) => { });
FB.logout();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class ExternalAuth {
private location = inject(Location);
private localStorage = inject(LocalStorageService);

protected providers: Map<ExternalAuthProvider, AuthProvider> = new Map();
protected providers = new Map<ExternalAuthProvider, AuthProvider>();
public get activeProvider(): ExternalAuthProvider {
return this.localStorage.getItem('extActiveProvider') as ExternalAuthProvider;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,12 @@ export function decodeBase64Url(base64Url: string) {
return decodeURIComponent(decoded.split('')
.map(c => '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2))
.join(''));
} catch (er) {
} catch {
return decoded;
}
}

// eslint-disable-next-line @typescript-eslint/no-empty-object-type
export function encodeBase64Url(input: {}) {
const encodedToURI: string = encodeURI(JSON.stringify(input));
let result = '';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ class LocalStorageFallback implements Storage {
[name: string]: any;
readonly length = 0;
clear(): void { }
getItem(key: string): string | null { return null; }
key(index: number): string | null { return null; }
removeItem(key: string): void { }
setItem(key: string, value: string): void { }
getItem(_key: string): string | null { return null; }
key(_index: number): string | null { return null; }
removeItem(_key: string): void { }
setItem(_key: string, _value: string): void { }
}

@Injectable({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,11 @@ describe('Services', () => {
describe(`User Service`, () => {
let userServ: UserStore;
let localStorage: LocalStorageService;
let mockLocalStorage: any;
const mockLocalStorage = {
getItem: vi.fn(),
setItem: vi.fn(),
removeItem: vi.fn()
};
const mockUser = {
exp: 111,
name: 'Testy Testington',
Expand All @@ -538,12 +542,6 @@ describe('Services', () => {
externalToken: `mock token`
};

mockLocalStorage = {
getItem: vi.fn(),
setItem: vi.fn(),
removeItem: vi.fn()
};

beforeEach(() => {
vi.spyOn(JSON, 'parse').mockReturnValue(mockUser);
vi.spyOn(mockLocalStorage, 'getItem').mockReturnValue('MOCK JSON');
Expand Down
Loading