-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Issue is not overdue when it is on the same date #5566 #5568
Conversation
Codecov Report
@@ Coverage Diff @@
## master #5568 +/- ##
=========================================
- Coverage 37.81% 37.8% -0.01%
=========================================
Files 322 322
Lines 47458 47463 +5
=========================================
- Hits 17946 17944 -2
- Misses 26926 26933 +7
Partials 2586 2586
Continue to review full report at Codecov.
|
models/issue.go
Outdated
@@ -83,7 +84,8 @@ func (issue *Issue) loadTotalTimes(e Engine) (err error) { | |||
|
|||
// IsOverdue checks if the issue is overdue | |||
func (issue *Issue) IsOverdue() bool { | |||
return util.TimeStampNow() >= issue.DeadlineUnix | |||
deadline := issue.DeadlineUnix.AsTime().UTC().Round(24 * time.Hour) | |||
return time.Now().UTC().After(deadline) |
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.
I'd rather change the behaviour when saving a due date to save it on 23:59:59 instead of 00:00 rather than changing this when showing the due date.
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.
return util.TimeStampNow() >= issue.DeadlineUnix + util.TimeStamp(time.Hour * 24 / time.Second)
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.
I agree with kolaente
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 thinking about the solution It would be like this
if form.Deadline != nil && !form.Deadline.IsZero() {
t := form.Deadline
deadLine := time.Date(t.Year(), t.Month(), t.Day(), 23, 59, 59, 0, t.Location())
form.Deadline = &deadLine
deadlineUnix = util.TimeStamp(form.Deadline.Unix())
}
This is an example for the issue deadline case. What do you think @lunny, @kolaente, @Bwko, @adelowo ? Maybe this code could be simplified.
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.
I'd only set it to 23:59:59 if it is set to 00:00:00. Maybe someone wants to use it in some kind of frontend with exact deadlines. Or maybe don't modify it at all on the backend and only in gitea's frontend?
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.
@rvillablanca I don't against @kolaente 's idea, but that you have to consider old data migration.
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.
@kolaente I don't think the frontend currently supports exact deadlines.
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.
@adelowo Ours doesn't, but the api does.
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.
I don't think we should support exact deadlines (with time)
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.
I have changed the behaviour of this, now the time part of a due date of issues and milestones is setted to 23:59:59 at the save/edit moment, this is according to @kolaente's suggestion.
With respect to exact deadlines I think that could be possible but at the moment due dates are being treated like a date and not like timestamp (this at least in the handlers, I know the api supports timestamp), so I believe this could be done in another PR as a new feature.
c596b89
to
244d106
Compare
@kolaente need your approval. |
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.
Looks good! I think the CI failed though...
This PR fix #5566 so now a due date that is today won't be considered overdue, this applies to milestones and issues.