|
|
@ -7,7 +7,6 @@ import ( |
|
|
|
"context" |
|
|
|
"context" |
|
|
|
"fmt" |
|
|
|
"fmt" |
|
|
|
"strings" |
|
|
|
"strings" |
|
|
|
"time" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"code.gitea.io/gitea/models/db" |
|
|
|
"code.gitea.io/gitea/models/db" |
|
|
|
repo_model "code.gitea.io/gitea/models/repo" |
|
|
|
repo_model "code.gitea.io/gitea/models/repo" |
|
|
@ -65,7 +64,6 @@ type Milestone struct { |
|
|
|
DeadlineString string `xorm:"-"` |
|
|
|
DeadlineString string `xorm:"-"` |
|
|
|
|
|
|
|
|
|
|
|
TotalTrackedTime int64 `xorm:"-"` |
|
|
|
TotalTrackedTime int64 `xorm:"-"` |
|
|
|
TimeSinceUpdate int64 `xorm:"-"` |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func init() { |
|
|
|
func init() { |
|
|
@ -84,9 +82,6 @@ func (m *Milestone) BeforeUpdate() { |
|
|
|
// AfterLoad is invoked from XORM after setting the value of a field of
|
|
|
|
// AfterLoad is invoked from XORM after setting the value of a field of
|
|
|
|
// this object.
|
|
|
|
// this object.
|
|
|
|
func (m *Milestone) AfterLoad() { |
|
|
|
func (m *Milestone) AfterLoad() { |
|
|
|
if !m.UpdatedUnix.IsZero() { |
|
|
|
|
|
|
|
m.TimeSinceUpdate = time.Now().Unix() - m.UpdatedUnix.AsTime().Unix() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
m.NumOpenIssues = m.NumIssues - m.NumClosedIssues |
|
|
|
m.NumOpenIssues = m.NumIssues - m.NumClosedIssues |
|
|
|
if m.DeadlineUnix.Year() == 9999 { |
|
|
|
if m.DeadlineUnix.Year() == 9999 { |
|
|
|
return |
|
|
|
return |
|
|
|