Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix: TTA-147 fixing column format 'time in' in the reports page
  • Loading branch information
jimmyjaramillo committed Aug 29, 2022
commit 425c43d781bbf3ff0985170ccc0963bfc466d443
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@ describe('Reports Page', () => {
let fixture: ComponentFixture<TimeEntriesTableComponent>;
let store: MockStore<EntryState>;
let getReportDataSourceSelectorMock;
let durationTime: number;
let row: number;
let node: number;
let decimalValidator: RegExp;
const timeEntry: Entry = {
id: '123',
start_date: new Date(),
Expand Down Expand Up @@ -102,10 +100,8 @@ describe('Reports Page', () => {
);

beforeEach(() => {
durationTime = new Date().setHours(5, 30);
row = 0;
node = 0;
decimalValidator = /^\d+\.\d{0,2}$/;
});

it('component should be created', async () => {
Expand Down Expand Up @@ -155,16 +151,6 @@ describe('Reports Page', () => {
});
});

it('The data should be displayed as a multiple of hour when column is equal to 4', () => {
const column = 4;
expect(component.bodyExportOptions(durationTime, row, column, node)).toMatch(decimalValidator);
});

it('The data should not be displayed as a multiple of hour when column is different of 4', () => {
const column = 5;
expect(component.bodyExportOptions(durationTime, row, column, node)).toBe(durationTime.toString());
});

it('The link Ticket must not contain the ticket URL enclosed with < > when export a file csv, excel or PDF', () => {
const entry = '<a _ngcontent-vlm-c151="" class="is-url">https://TT-392-uri</a>';
const column = 0;
Expand Down Expand Up @@ -247,7 +233,7 @@ describe('Reports Page', () => {
'19',
'[email protected]',
'07/01/2022',
'9.00',
'09:00',
'09:00',
'18:00',
'Project_Name',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,7 @@ export class TimeEntriesTableComponent implements OnInit, OnDestroy, AfterViewIn
}

bodyExportOptions(data, row, column, node) {
const dataFormated = data.toString().replace(/<((.|\n){0,200}?)>/gi, '');
const durationColumnIndex = 4;
return column === durationColumnIndex ? moment.duration(dataFormated).asHours().toFixed(2) : dataFormated;
return data.toString().replace(/<((.|\n){0,200}?)>/gi, '') || '';
}


Expand Down