RED-9993: fixed license labels.
This commit is contained in:
parent
05b6f88d64
commit
edd709df6f
@ -3,7 +3,7 @@ import { LicenseService } from '@services/license.service';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { ChartDataset } from 'chart.js';
|
||||
import { ChartBlue, ChartGreen, ChartRed } from '../../utils/constants';
|
||||
import { getDataUntilCurrentMonth, getLabelsFromLicense, getLineConfig, isCurrentMonthAndYear } from '../../utils/functions';
|
||||
import { getDataUntilCurrentMonth, getLabelsFromLicense, getLineConfig, isCurrentMonth } from '../../utils/functions';
|
||||
import { TranslateModule, TranslateService } from '@ngx-translate/core';
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
import { size } from '@iqser/common-ui/lib/utils';
|
||||
@ -43,7 +43,7 @@ export class LicenseAnalysisCapacityUsageComponent {
|
||||
#getCapacityDatasets(): ChartDataset[] {
|
||||
const monthlyData = [...this.licenseService.selectedLicenseReport.monthlyData];
|
||||
const dataUntilCurrentMonth = getDataUntilCurrentMonth(monthlyData);
|
||||
if (monthlyData.length === 1 || isCurrentMonthAndYear(monthlyData[0].startDate)) {
|
||||
if (monthlyData.length === 1 || isCurrentMonth(monthlyData[0].startDate)) {
|
||||
const empty = { analysedFilesBytes: null } as ILicenseData;
|
||||
dataUntilCurrentMonth.splice(0, 0, empty);
|
||||
monthlyData.splice(0, 0, empty);
|
||||
|
||||
@ -3,7 +3,7 @@ import { LicenseService } from '@services/license.service';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { ChartDataset } from 'chart.js';
|
||||
import { ChartBlue, ChartGreen, ChartRed } from '../../utils/constants';
|
||||
import { getDataUntilCurrentMonth, getLabelsFromLicense, getLineConfig, isCurrentMonthAndYear } from '../../utils/functions';
|
||||
import { getDataUntilCurrentMonth, getLabelsFromLicense, getLineConfig, isCurrentMonth } from '../../utils/functions';
|
||||
import { TranslateModule, TranslateService } from '@ngx-translate/core';
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
import { ILicenseData } from '@red/domain';
|
||||
@ -40,7 +40,7 @@ export class LicensePageUsageComponent {
|
||||
#getPagesDatasets(): ChartDataset[] {
|
||||
const monthlyData = [...this.licenseService.selectedLicenseReport.monthlyData];
|
||||
const dataUntilCurrentMonth = getDataUntilCurrentMonth(monthlyData);
|
||||
if (monthlyData.length === 1 || isCurrentMonthAndYear(monthlyData[0].startDate)) {
|
||||
if (monthlyData.length === 1 || isCurrentMonth(monthlyData[0].startDate)) {
|
||||
const empty = { numberOfAnalyzedPages: null } as ILicenseData;
|
||||
dataUntilCurrentMonth.splice(0, 0, empty);
|
||||
monthlyData.splice(0, 0, empty);
|
||||
|
||||
@ -44,7 +44,7 @@ export const getLabelsFromLicense = (license: ILicenseReport) => {
|
||||
monthIterator = monthIterator.add(1, 'month');
|
||||
}
|
||||
|
||||
if (startMonth.month() === endMonth.month() || startMonth.month() === currentMonth) {
|
||||
if (startMonth.isSame(endMonth, 'month') || isCurrentMonth(startMonth.toDate())) {
|
||||
result.splice(0, 0, '');
|
||||
}
|
||||
|
||||
@ -55,6 +55,6 @@ export const getDataUntilCurrentMonth = (monthlyData: ILicenseData[]) => {
|
||||
return monthlyData.filter(data => dayjs(data.startDate).isSameOrBefore(dayjs(Date.now()), 'month'));
|
||||
};
|
||||
|
||||
export const isCurrentMonthAndYear = (date: Date | string) => {
|
||||
return dayjs(date).isSame(dayjs(Date.now()), 'month') && dayjs(date).isSame(dayjs(Date.now()), 'year');
|
||||
export const isCurrentMonth = (date: Date | string) => {
|
||||
return dayjs(date).isSame(dayjs(Date.now()), 'month');
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user