remove console.time statements during portfolio calls

pull/239/head
Valentin Zickner 3 years ago committed by Thomas
parent 852902d1ab
commit 993f066e08

@ -30,8 +30,6 @@ export class PortfolioCalculator {
) {}
public computeTransactionPoints(orders: PortfolioOrder[]) {
console.time('compute-transaction-points');
orders.sort((a, b) => a.date.localeCompare(b.date));
this.transactionPoints = [];
@ -97,7 +95,6 @@ export class PortfolioCalculator {
}
lastDate = currentDate;
}
console.timeEnd('compute-transaction-points');
}
public setTransactionPoints(transactionPoints: TransactionPoint[]) {
@ -247,8 +244,6 @@ export class PortfolioCalculator {
if (timelineSpecification.length === 0) {
return [];
}
console.time('calculate-timeline-total');
console.time('calculate-timeline-calculations');
const startDate = timelineSpecification[0].start;
const start = parseDate(startDate);
@ -296,17 +291,11 @@ export class PortfolioCalculator {
timelinePeriodPromises.push(timePeriodForDates);
}
}
console.timeEnd('calculate-timeline-calculations');
console.time('calculate-timeline-periods');
const timelinePeriods: TimelinePeriod[][] = await Promise.all(
timelinePeriodPromises
);
console.timeEnd('calculate-timeline-periods');
console.timeEnd('calculate-timeline-total');
return flatten(timelinePeriods);
}

@ -91,14 +91,10 @@ export class PortfolioController {
@Query('range') range,
@Res() res: Response
): Promise<HistoricalDataItem[]> {
console.log(`------- ${range} ------`);
console.time('get-chart-request');
console.time('portfolio-service-get-chart');
let chartData = await this.portfolioService.getChart(
impersonationId,
range
);
console.timeEnd('portfolio-service-get-chart');
let hasNullValue = false;
@ -135,8 +131,6 @@ export class PortfolioController {
});
}
console.timeEnd('get-chart-request');
return <any>res.json(chartData);
}

@ -146,13 +146,11 @@ export class PortfolioService {
aImpersonationId: string,
aDateRange: DateRange = 'max'
): Promise<HistoricalDataItem[]> {
console.time('impersonation-service');
const impersonationUserId =
await this.impersonationService.validateImpersonationId(
aImpersonationId,
this.request.user.id
);
console.timeEnd('impersonation-service');
const userId = impersonationUserId || this.request.user.id;
@ -457,9 +455,7 @@ export class PortfolioService {
}
private async getTransactionPoints(userId: string) {
console.time('create-portfolio');
const orders = await this.getOrders(userId);
console.timeEnd('create-portfolio');
if (orders.length <= 0) {
return [];

Loading…
Cancel
Save