Skip to content

Commit d54c273

Browse files
TTA-142: Alphabetically sort list of users on reports
1 parent 399ac39 commit d54c273

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,10 @@ describe('Reports Page', () => {
212212

213213
it('the sume of hours of entries selected is equal to {hours:0, minutes:0, seconds:0}', () => {
214214
let checked = true;
215-
let {hours, minutes, seconds}:TotalHours = component.sumHoursEntriesSelected(timeEntryList[0], checked);
215+
let {hours, minutes, seconds}: TotalHours = component.sumHoursEntriesSelected(timeEntryList[0], checked);
216216
checked = false;
217-
({hours, minutes,seconds} = component.sumHoursEntriesSelected(timeEntryList[0], checked));
218-
expect({hours, minutes, seconds}).toEqual({hours:0, minutes:0, seconds:0});
217+
({hours, minutes, seconds} = component.sumHoursEntriesSelected(timeEntryList[0], checked));
218+
expect({hours, minutes, seconds}).toEqual({hours: 0, minutes: 0, seconds: 0});
219219
});
220220

221221
it('should export data with the correct format', () => {

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export class TimeEntriesTableComponent implements OnInit, OnDestroy, AfterViewIn
6969
},
7070
],
7171
columnDefs: [{ type: 'date', targets: 2}, {orderable: false, targets: [0]}],
72-
order: [[1,'asc'],[2,'desc'],[4,'desc']]
72+
order: [[1, 'asc'], [2, 'desc'], [4, 'desc']]
7373
};
7474
dtTrigger: Subject<any> = new Subject();
7575
@ViewChild(DataTableDirective, { static: false })
@@ -79,7 +79,7 @@ export class TimeEntriesTableComponent implements OnInit, OnDestroy, AfterViewIn
7979
rerenderTableSubscription: Subscription;
8080
resultSum: TotalHours;
8181
resultSumEntriesSelected: TotalHours;
82-
resultSumEntriesSelected$:Observable<TotalHours>;
82+
resultSumEntriesSelected$: Observable<TotalHours>;
8383
totalHoursSubscription: Subscription;
8484
dateTimeOffset: ParseDateTimeOffset;
8585

@@ -96,7 +96,9 @@ export class TimeEntriesTableComponent implements OnInit, OnDestroy, AfterViewIn
9696
this.actionsSubject$
9797
.pipe(filter((action: any) => action.type === UserActionTypes.LOAD_USERS_SUCCESS))
9898
.subscribe((action) => {
99-
this.users = action.payload;
99+
const sortUsers = [...action.payload];
100+
sortUsers.sort((a, b) => a.name.localeCompare(b.name));
101+
this.users = sortUsers;
100102
});
101103
}
102104

0 commit comments

Comments
 (0)