Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
fix: TT-258 added canMarkEntryAsWIP how conditions in start_date
  • Loading branch information
kevinjlope committed Jun 16, 2021
commit 9cad28c493cf185f88f57ed13325fa72da50df85
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
</div>
</div>

<div class="form-group row">
<div class="form-group row" >
<label class="col-12 col-sm-2">Date in:</label>
<div class="col-12 col-sm-4">
<input
Expand Down Expand Up @@ -107,6 +107,7 @@
formControlName="start_hour"
id="start_hour"
class="timepicker-input"
[defaultTime]="'00:00'"
[class.timepicker-input--disabled]="!(project_id.value && project_name.value)"
></ngx-timepicker-field>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/app/modules/shared/models/entry.model.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export interface Entry {
running?: boolean;
id?: string;
start_date: Date;
start_date?: Date;
end_date?: Date;
activity_id?: string;
technologies?: string[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ describe('TimeEntriesComponent', () => {
uri: 'http://testing.is.fun',
activity_id: 'sss',
project_id: 'id',
start_date: new Date(),
start_date: component.canMarkEntryAsWIP ? new Date() : new Date(new Date().setHours(0, 0, 0, 0)),
end_date: new Date(new Date().setHours(0, 0, 0, 0))
};
state.timeEntriesDataSource.data = [lastEntry];
Expand Down
6 changes: 3 additions & 3 deletions src/app/modules/time-entries/pages/time-entries.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,15 @@ export class TimeEntriesComponent implements OnInit, OnDestroy {
this.store.pipe(select(getTimeEntriesDataSource)).subscribe(ds => {
const dataToUse = ds.data.find(item => item.project_id === event.projectId);
if (dataToUse && this.isNewEntry()) {
const endDate = new Date(new Date().setHours(0, 0, 0, 0));
const startDate = new Date(new Date().setHours(0, 0, 0, 0));
const entry = {
description: dataToUse.description ? dataToUse.description : '',
technologies: dataToUse.technologies ? dataToUse.technologies : [],
uri: dataToUse.uri ? dataToUse.uri : '',
activity_id: dataToUse.activity_id,
project_id: dataToUse.project_id,
start_date: new Date(),
end_date: endDate
start_date: this.canMarkEntryAsWIP ? new Date() : startDate,
end_date: startDate
Copy link
Contributor

@jase156 jase156 Jun 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should change constant's the name of the startDate to endDate for better readability.

};
this.entry = entry;
}
Expand Down