-
Notifications
You must be signed in to change notification settings - Fork 1
TT-85 fix: fix overlapping seconds on time entries #591
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
8b50d4f
3155406
29da434
85a4c93
1685b88
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -219,14 +219,6 @@ export class DetailsFieldsComponent implements OnChanges, OnInit { | |
return result; | ||
} | ||
|
||
timeEntryIsInTheFuture(){ | ||
const startDate = this.entryForm.value.start_date; | ||
const endDate = this.entryForm.value.end_date; | ||
const isStartDateInTheFuture = moment(startDate).isAfter(moment()); | ||
const isEndDateInTheFuture = moment(endDate).isAfter(moment()); | ||
return isStartDateInTheFuture || isEndDateInTheFuture; | ||
} | ||
|
||
onSubmit() { | ||
if (this.entryForm.invalid) { | ||
this.toastrService.warning('Make sure to select a project and activity'); | ||
|
@@ -250,7 +242,11 @@ export class DetailsFieldsComponent implements OnChanges, OnInit { | |
delete entry.end_date; | ||
} | ||
|
||
if (this.timeEntryIsInTheFuture()) { | ||
const isStartDateInTheFuture = moment(startDateToSubmit).isAfter(moment()); | ||
const isEndDateInTheFuture = moment(endDateToSubmit).isAfter(moment()); | ||
const timeEntryIsInTheFuture = isStartDateInTheFuture || isEndDateInTheFuture; | ||
|
||
if (timeEntryIsInTheFuture) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I remember we made a change to extract There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just tried the function of not allowing a "time entry" in the future and it allowed me to add. It ignores the way we put it so I left it as it was. but with the tests, there was no problem. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's ok. Then, keep in mind that, when we may want to retake that little refactor. |
||
this.toastrService.error('You cannot start a time-entry in the future'); | ||
return; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change:
dateTest
tocurrentDate
startHourTest
tostartHour
I think is necessary use other name of variable per example
dateTest
todateCurrent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok it's changed