Skip to content

Commit cb3e330

Browse files
committed
Revert "fix: TT-336 Fix format Duration column (#749)"
This reverts commit 426106f.
1 parent 19a8734 commit cb3e330

File tree

2 files changed

+0
-38
lines changed

2 files changed

+0
-38
lines changed

src/app/modules/reports/components/time-entries-table/time-entries-table.component.spec.ts

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ describe('Reports Page', () => {
1212
let fixture: ComponentFixture<TimeEntriesTableComponent>;
1313
let store: MockStore<EntryState>;
1414
let getReportDataSourceSelectorMock;
15-
let durationTime: number;
16-
let row: number;
17-
let node: number;
18-
let decimalValidator: RegExp;
1915
const timeEntry: Entry = {
2016
id: '123',
2117
start_date: new Date(),
@@ -66,13 +62,6 @@ describe('Reports Page', () => {
6662
})
6763
);
6864

69-
beforeEach(() => {
70-
durationTime = new Date().setHours(5, 30);
71-
row = 0;
72-
node = 0;
73-
decimalValidator = /^\d+\.\d{0,2}$/;
74-
});
75-
7665
it('component should be created', async () => {
7766
expect(component).toBeTruthy();
7867
});
@@ -118,17 +107,6 @@ describe('Reports Page', () => {
118107
});
119108
});
120109

121-
it('The data should be displayed as a multiple of hour when column is equal to 3', () => {
122-
const column = 3;
123-
124-
expect(component.bodyExportOptions(durationTime, row, column, node)).toMatch(decimalValidator);
125-
});
126-
127-
it('The data should not be displayed as a multiple of hour when column is different of 3', () => {
128-
const column = 4;
129-
expect(component.bodyExportOptions(durationTime, row, column, node)).toBe(durationTime);
130-
});
131-
132110
afterEach(() => {
133111
fixture.destroy();
134112
});

src/app/modules/reports/components/time-entries-table/time-entries-table.component.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { formatDate } from '@angular/common';
22
import { AfterViewInit, Component, OnDestroy, OnInit, ViewChild} from '@angular/core';
33
import { select, Store } from '@ngrx/store';
44
import { DataTableDirective } from 'angular-datatables';
5-
import * as moment from 'moment';
65
import { Observable, Subject, Subscription } from 'rxjs';
76
import { Entry } from 'src/app/modules/shared/models';
87
import { DataSource } from 'src/app/modules/shared/models/data-source.model';
@@ -28,21 +27,11 @@ export class TimeEntriesTableComponent implements OnInit, OnDestroy, AfterViewIn
2827
},
2928
{
3029
extend: 'excel',
31-
exportOptions: {
32-
format: {
33-
body: this.bodyExportOptions
34-
}
35-
},
3630
text: 'Excel',
3731
filename: `time-entries-${formatDate(new Date(), 'MM_dd_yyyy-HH_mm', 'en')}`
3832
},
3933
{
4034
extend: 'csv',
41-
exportOptions: {
42-
format: {
43-
body: this.bodyExportOptions
44-
}
45-
},
4635
text: 'CSV',
4736
filename: `time-entries-${formatDate(new Date(), 'MM_dd_yyyy-HH_mm', 'en')}`
4837
},
@@ -93,9 +82,4 @@ export class TimeEntriesTableComponent implements OnInit, OnDestroy, AfterViewIn
9382
const regex = new RegExp('http*', 'g');
9483
return regex.test(uri);
9584
}
96-
97-
bodyExportOptions(data, row, column, node){
98-
const durationColumnIndex = 3;
99-
return column === durationColumnIndex ? moment.duration(data).asHours().toFixed(2) : data;
100-
}
10185
}

0 commit comments

Comments
 (0)