|
|
@ -19,15 +19,17 @@ import { MatDialog } from '@angular/material/dialog';
|
|
|
|
import { DataSource, MarketData } from '@prisma/client';
|
|
|
|
import { DataSource, MarketData } from '@prisma/client';
|
|
|
|
import {
|
|
|
|
import {
|
|
|
|
addDays,
|
|
|
|
addDays,
|
|
|
|
|
|
|
|
addMonths,
|
|
|
|
format,
|
|
|
|
format,
|
|
|
|
isBefore,
|
|
|
|
isBefore,
|
|
|
|
isSameDay,
|
|
|
|
isSameDay,
|
|
|
|
isToday,
|
|
|
|
isToday,
|
|
|
|
isValid,
|
|
|
|
isValid,
|
|
|
|
|
|
|
|
min,
|
|
|
|
parse,
|
|
|
|
parse,
|
|
|
|
parseISO
|
|
|
|
parseISO
|
|
|
|
} from 'date-fns';
|
|
|
|
} from 'date-fns';
|
|
|
|
import { last } from 'lodash';
|
|
|
|
import { first, last } from 'lodash';
|
|
|
|
import { DeviceDetectorService } from 'ngx-device-detector';
|
|
|
|
import { DeviceDetectorService } from 'ngx-device-detector';
|
|
|
|
import { Subject, takeUntil } from 'rxjs';
|
|
|
|
import { Subject, takeUntil } from 'rxjs';
|
|
|
|
|
|
|
|
|
|
|
@ -135,6 +137,27 @@ export class AdminMarketDataDetailComponent implements OnChanges, OnInit {
|
|
|
|
marketPrice: marketDataItem.marketPrice
|
|
|
|
marketPrice: marketDataItem.marketPrice
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (this.dateOfFirstActivity) {
|
|
|
|
|
|
|
|
// Fill up missing months
|
|
|
|
|
|
|
|
const dates = Object.keys(this.marketDataByMonth).sort();
|
|
|
|
|
|
|
|
const startDate = min([
|
|
|
|
|
|
|
|
parseISO(this.dateOfFirstActivity),
|
|
|
|
|
|
|
|
parseISO(first(dates))
|
|
|
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
const endDate = parseISO(last(dates));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let currentDate = startDate;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while (isBefore(currentDate, endDate)) {
|
|
|
|
|
|
|
|
const key = format(currentDate, 'yyyy-MM');
|
|
|
|
|
|
|
|
if (!this.marketDataByMonth[key]) {
|
|
|
|
|
|
|
|
this.marketDataByMonth[key] = {};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
currentDate = addMonths(currentDate, 1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public isDateOfInterest(aDateString: string) {
|
|
|
|
public isDateOfInterest(aDateString: string) {
|
|
|
|