From 331ac7ded21bbd9346361ddf8598d744c069489e Mon Sep 17 00:00:00 2001 From: Valentin Zickner <3200232+vzickner@users.noreply.github.com> Date: Sun, 1 Aug 2021 03:39:41 -0400 Subject: [PATCH] remove unused method in portfolio.service.ts (#240) Co-authored-by: Valentin Zickner --- .../src/app/portfolio/portfolio.service.ts | 54 ------------------- 1 file changed, 54 deletions(-) diff --git a/apps/api/src/app/portfolio/portfolio.service.ts b/apps/api/src/app/portfolio/portfolio.service.ts index 4bddb0d19..9e431622e 100644 --- a/apps/api/src/app/portfolio/portfolio.service.ts +++ b/apps/api/src/app/portfolio/portfolio.service.ts @@ -29,21 +29,14 @@ import { REQUEST } from '@nestjs/core'; import { Currency, DataSource, Type as TypeOfOrder } from '@prisma/client'; import Big from 'big.js'; import { - add, endOfToday, format, - getDate, - getMonth, - getYear, isAfter, isBefore, max, parse, parseISO, - setDate, setDayOfYear, - setMonth, - sub, subDays, subYears } from 'date-fns'; @@ -669,53 +662,6 @@ export class PortfolioService { }; } - private convertDateRangeToDate(aDateRange: DateRange, aMinDate: Date) { - let currentDate = new Date(); - - const normalizedMinDate = - getDate(aMinDate) === 1 - ? aMinDate - : add(setDate(aMinDate, 1), { months: 1 }); - - const year = getYear(currentDate); - const month = getMonth(currentDate); - const day = getDate(currentDate); - - currentDate = new Date(Date.UTC(year, month, day, 0)); - - switch (aDateRange) { - case '1d': - return sub(currentDate, { - days: 1 - }); - case 'ytd': - currentDate = setDate(currentDate, 1); - currentDate = setMonth(currentDate, 0); - return isAfter(currentDate, normalizedMinDate) - ? currentDate - : undefined; - case '1y': - currentDate = setDate(currentDate, 1); - currentDate = sub(currentDate, { - years: 1 - }); - return isAfter(currentDate, normalizedMinDate) - ? currentDate - : undefined; - case '5y': - currentDate = setDate(currentDate, 1); - currentDate = sub(currentDate, { - years: 5 - }); - return isAfter(currentDate, normalizedMinDate) - ? currentDate - : undefined; - default: - // Gets handled as all data - return undefined; - } - } - private getAccounts( orders: OrderWithAccount[], portfolioItemsNow: { [p: string]: TimelinePosition },