Skip to content

Commit 86ccb94

Browse files
kevinjlopeSandro Castillo
authored andcommitted
fix: TT-258 added canMarkEntryAsWIP how conditions in start_date
1 parent face70b commit 86ccb94

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

src/app/modules/shared/components/details-fields/details-fields.component.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
</div>
7979
</div>
8080

81-
<div class="form-group row">
81+
<div class="form-group row" >
8282
<label class="col-12 col-sm-2">Date in:</label>
8383
<div class="col-12 col-sm-4">
8484
<input
@@ -107,6 +107,7 @@
107107
formControlName="start_hour"
108108
id="start_hour"
109109
class="timepicker-input"
110+
[defaultTime]="'00:00'"
110111
[class.timepicker-input--disabled]="!(project_id.value && project_name.value)"
111112
></ngx-timepicker-field>
112113
</div>

src/app/modules/shared/models/entry.model.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export interface Entry {
22
running?: boolean;
33
id?: string;
4-
start_date: Date;
4+
start_date?: Date;
55
end_date?: Date;
66
activity_id?: string;
77
technologies?: string[];

src/app/modules/time-entries/pages/time-entries.component.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ describe('TimeEntriesComponent', () => {
381381
uri: 'http://testing.is.fun',
382382
activity_id: 'sss',
383383
project_id: 'id',
384-
start_date: new Date(),
384+
start_date: component.canMarkEntryAsWIP ? new Date() : new Date(new Date().setHours(0, 0, 0, 0)),
385385
end_date: new Date(new Date().setHours(0, 0, 0, 0))
386386
};
387387
state.timeEntriesDataSource.data = [lastEntry];

src/app/modules/time-entries/pages/time-entries.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,15 +122,15 @@ export class TimeEntriesComponent implements OnInit, OnDestroy {
122122
this.store.pipe(select(getTimeEntriesDataSource)).subscribe(ds => {
123123
const dataToUse = ds.data.find(item => item.project_id === event.projectId);
124124
if (dataToUse && this.isNewEntry()) {
125-
const endDate = new Date(new Date().setHours(0, 0, 0, 0));
125+
const startDate = new Date(new Date().setHours(0, 0, 0, 0));
126126
const entry = {
127127
description: dataToUse.description ? dataToUse.description : '',
128128
technologies: dataToUse.technologies ? dataToUse.technologies : [],
129129
uri: dataToUse.uri ? dataToUse.uri : '',
130130
activity_id: dataToUse.activity_id,
131131
project_id: dataToUse.project_id,
132-
start_date: new Date(),
133-
end_date: endDate
132+
start_date: this.canMarkEntryAsWIP ? new Date() : startDate,
133+
end_date: startDate
134134
};
135135
this.entry = entry;
136136
}

0 commit comments

Comments
 (0)