Skip to content

Commit 986fd43

Browse files
committed
fix: TT-539 conflict resolution
2 parents d8bdea8 + 64826cd commit 986fd43

File tree

11 files changed

+170
-174
lines changed

11 files changed

+170
-174
lines changed

package-lock.json

Lines changed: 9 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "time-tracker",
3-
"version": "1.72.4",
3+
"version": "1.72.5",
44
"scripts": {
55
"config": "ts-node ./scripts/setenv.ts",
66
"preinstall": "npx npm-force-resolutions",

src/app/modules/activities-management/store/activity-management.selectors.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ const getActivityState = createFeatureSelector<ActivityState>('activities');
66
export const allActivities = createSelector(getActivityState, (state: ActivityState) => state?.data);
77

88
export const allActiveActivities = createSelector(getActivityState, (state: ActivityState) => {
9-
return state?.data.filter((item) => item.status !== 'inactive');
9+
return state?.data.filter((item) => item.status !== 'inactive').sort( (a, b) => {
10+
return (a.name).localeCompare(b.name);
11+
});
1012
});
1113

1214
export const activityIdToEdit = createSelector(getActivityState, (state: ActivityState) => state?.activityIdToEdit);
Lines changed: 54 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,59 @@
11
<div class="row scroll-table mt-5 ml-0">
22
<app-search-user [users]="users" (selectedUserId)="user($event)"></app-search-user>
3-
<table
4-
class="table table-striped mb-0"
5-
datatable
6-
[dtTrigger]="dtTrigger"
7-
[dtOptions]="dtOptions"
8-
*ngIf="(reportDataSource$ | async) as dataSource">
9-
<thead class="thead-blue">
10-
<tr class="d-flex">
11-
<th class="hidden-col">ID</th>
12-
<th class="col md-col">User email</th>
13-
<th class="col sm-col">Date</th>
14-
<th class="col sm-col" title="Duration (hours)">Duration</th>
15-
<th class="col x-sm-col" title="Time in">Time in</th>
16-
<th class="col x-sm-col" title="Time out">Time out</th>
17-
<th class="col md-col">Project</th>
18-
<th class="hidden-col">Project ID</th>
19-
<th class="col md-col">Customer</th>
20-
<th class="hidden-col">Customer ID</th>
21-
<th class="col md-col">Activity</th>
22-
<th class="col lg-col">Ticket</th>
23-
<th class="col lg-col">Description</th>
24-
<th class="col lg-col">Technologies</th>
25-
</tr>
26-
</thead>
27-
<app-loading-bar *ngIf="dataSource.isLoading"></app-loading-bar>
28-
<tbody *ngIf="!dataSource.isLoading">
29-
<tr class="d-flex col-height" *ngFor="let entry of dataSource.data">
30-
<td class="hidden-col">{{ entry.id }}</td>
31-
<td class="col md-col">{{ entry.owner_email }}</td>
32-
<td class="col sm-col">
33-
{{ entry.start_date | date: 'MM/dd/yyyy' }}
34-
</td>
35-
<td class="col sm-col">
36-
{{ entry.end_date | substractDate: entry.start_date }}
37-
</td>
38-
<td class="col x-sm-col">{{ entry.start_date | date: 'HH:mm' }}</td>
39-
<td class="col x-sm-col">{{ entry.end_date | date: 'HH:mm' }}</td>
40-
<td class="col md-col">{{ entry.project_name }}</td>
41-
<td class="hidden-col">{{ entry.project_id }}</td>
42-
<td class="col md-col">{{ entry.customer_name }}</td>
43-
<td class="hidden-col">{{ entry.customer_id }}</td>
44-
<td class="col md-col">{{ entry.activity_name }}</td>
45-
<td class="col lg-col">
46-
<ng-container *ngIf="entry.uri !== null">
47-
<a [class.is-url]="isURL(entry.uri)" (click)="openURLInNewTab(entry.uri)">
3+
4+
<table class="table table-striped mb-0" datatable [dtTrigger]="dtTrigger" [dtOptions]="dtOptions" *ngIf="(reportDataSource$ | async) as dataSource">
5+
<thead class="thead-blue">
6+
<tr class="d-flex">
7+
<th class="hidden-col">ID</th>
8+
<th class="col md-col">User email</th>
9+
<th class="col sm-col">Date</th>
10+
<th class="col sm-col" title="Duration (hours)">Duration</th>
11+
<th class="col x-sm-col" title="Time in">Time in</th>
12+
<th class="col x-sm-col" title="Time out">Time out</th>
13+
<th class="col md-col">Project</th>
14+
<th class="hidden-col">Project ID</th>
15+
<th class="col md-col">Customer</th>
16+
<th class="hidden-col">Customer ID</th>
17+
<th class="col md-col">Activity</th>
18+
<th class="col lg-col">Ticket</th>
19+
<th class="col lg-col">Description</th>
20+
<th class="col lg-col">Technologies</th>
21+
</tr>
22+
</thead>
23+
<app-loading-bar *ngIf="dataSource.isLoading"></app-loading-bar>
24+
<tbody *ngIf="!dataSource.isLoading">
25+
<tr class="d-flex col-height" *ngFor="let entry of dataSource.data">
26+
<td class="hidden-col">{{ entry.id }}</td>
27+
<td class="col md-col">{{ entry.owner_email }}</td>
28+
<td class="col sm-col">
29+
{{ entry.start_date | date: 'MM/dd/yyyy' }}
30+
</td>
31+
<td class="col sm-col">
32+
{{ entry.end_date | substractDate: entry.start_date }}
33+
</td>
34+
<td class="col x-sm-col">{{ dateTimeOffset.parseDateTimeOffset(entry.start_date,entry.timezone_offset) }}</td>
35+
<td class="col x-sm-col">{{ dateTimeOffset.parseDateTimeOffset(entry.end_date , entry.timezone_offset) }}</td>
36+
<td class="col md-col">{{ entry.project_name }}</td>
37+
<td class="hidden-col">{{ entry.project_id }}</td>
38+
<td class="col md-col">{{ entry.customer_name }}</td>
39+
<td class="hidden-col">{{ entry.customer_id }}</td>
40+
<td class="col md-col">{{ entry.activity_name }}</td>
41+
<td class="col lg-col">
42+
<ng-container *ngIf="entry.uri !== null">
43+
<a [class.is-url]="isURL(entry.uri)" (click)="openURLInNewTab(entry.uri)">
4844
{{ entry.uri }}
4945
</a>
50-
</ng-container>
51-
</td>
52-
<td class="col lg-scroll">{{ entry.description }}</td>
53-
<td class="col lg-scroll">
54-
<ng-container *ngIf="entry.technologies.length > 0">
55-
<div *ngFor="let technology of entry.technologies" class="badge bg-secondary text-wrap">
56-
{{ technology }}
57-
</div>
58-
</ng-container>
59-
</td>
60-
</tr>
61-
</tbody>
62-
</table>
46+
</ng-container>
47+
</td>
48+
<td class="col lg-scroll">{{ entry.description }}</td>
49+
<td class="col lg-scroll">
50+
<ng-container *ngIf="entry.technologies.length > 0">
51+
<div *ngFor="let technology of entry.technologies" class="badge bg-secondary text-wrap">
52+
{{ technology }}
53+
</div>
54+
</ng-container>
55+
</td>
56+
</tr>
57+
</tbody>
58+
</table>
6359
</div>

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
}
3333

3434
@mixin scroll-style {
35-
width: 40em;
35+
width: 18em;
3636
overflow: hidden;
3737
white-space: normal;
3838
display: -webkit-box;
@@ -60,6 +60,7 @@
6060
.lg-scroll {
6161
@include scroll-style;
6262
}
63+
6364
.hidden-col{
6465
display: none;
6566
}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { EntryState } from '../../../time-clock/store/entry.reducer';
1111
import { getReportDataSource } from '../../../time-clock/store/entry.selectors';
1212
import { User } from 'src/app/modules/users/models/users';
1313
import { LoadUsers, UserActionTypes } from 'src/app/modules/users/store/user.actions';
14+
import { ParseDateTimeOffset } from '../../../shared/formatters/parse-date-time-offset/parse-date-time-offset';
1415

1516
@Component({
1617
selector: 'app-time-entries-table',
@@ -66,9 +67,11 @@ export class TimeEntriesTableComponent implements OnInit, OnDestroy, AfterViewIn
6667
isLoading$: Observable<boolean>;
6768
reportDataSource$: Observable<DataSource<Entry>>;
6869
rerenderTableSubscription: Subscription;
70+
dateTimeOffset: ParseDateTimeOffset;
6971

7072
constructor(private store: Store<EntryState>, private actionsSubject$: ActionsSubject, private storeUser: Store<User> ) {
7173
this.reportDataSource$ = this.store.pipe(select(getReportDataSource));
74+
this.dateTimeOffset = new ParseDateTimeOffset();
7275
}
7376

7477
uploadUsers(): void {
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { ParseDateTimeOffset } from './parse-date-time-offset';
2+
3+
describe('ParseDateToUtcComponent', () => {
4+
5+
it('returns converted date when his offset is 300', () => {
6+
let parseTimeOffset = new ParseDateTimeOffset();
7+
const date = '2022-03-30T13:00:00Z';
8+
const timezone_offset = 300;
9+
const dateOffset:string = '08:00';
10+
11+
expect(parseTimeOffset.parseDateTimeOffset(date, timezone_offset)).toEqual(dateOffset);
12+
});
13+
14+
it('returns converted date when his offset is 420', () => {
15+
let parseTimeOffset = new ParseDateTimeOffset();
16+
const date = '2022-03-30T16:30:00Z';
17+
const timezone_offset = 420;
18+
const dateOffset:string = '09:30';
19+
20+
expect(parseTimeOffset.parseDateTimeOffset(date, timezone_offset)).toEqual(dateOffset);
21+
});
22+
23+
});
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import * as moment from 'moment';
2+
3+
export class ParseDateTimeOffset {
4+
5+
parseDateTimeOffset(date:string, offset): string{
6+
return moment.utc(date).utcOffset(-1*offset).format("HH:mm");
7+
}
8+
}

src/app/modules/time-clock/components/entry-fields/entry-fields.component.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ export class EntryFieldsComponent implements OnInit, OnDestroy {
6161
this.loadActivitiesSubscription = this.actionsSubject$
6262
.pipe(filter((action: any) => action.type === ActivityManagementActionTypes.LOAD_ACTIVITIES_SUCCESS))
6363
.subscribe((action) => {
64-
this.activities = action.payload.filter((item) => item.status !== 'inactive');
64+
this.activities = action.payload.filter((item) => item.status !== 'inactive').sort((a, b) => {
65+
return (a.name).localeCompare(b.name);
66+
});
6567
this.store.dispatch(new LoadActiveEntry());
6668
});
6769

0 commit comments

Comments
 (0)