mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-06-01 04:12:10 +00:00
Add Created & Updated to Milestone (#12662)
* Add Created and Updated to Milestone table and expose via API * Expose to UI - To Overloaded ?!? * fix unit test Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
parent
7404786420
commit
1ea1cade85
9 changed files with 57 additions and 1 deletions
|
@ -7,6 +7,7 @@ package models
|
|||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
api "code.gitea.io/gitea/modules/structs"
|
||||
|
@ -31,11 +32,14 @@ type Milestone struct {
|
|||
Completeness int // Percentage(1-100).
|
||||
IsOverdue bool `xorm:"-"`
|
||||
|
||||
DeadlineString string `xorm:"-"`
|
||||
CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"`
|
||||
UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"`
|
||||
DeadlineUnix timeutil.TimeStamp
|
||||
ClosedDateUnix timeutil.TimeStamp
|
||||
DeadlineString string `xorm:"-"`
|
||||
|
||||
TotalTrackedTime int64 `xorm:"-"`
|
||||
TimeSinceUpdate int64 `xorm:"-"`
|
||||
}
|
||||
|
||||
// BeforeUpdate is invoked from XORM before updating this object.
|
||||
|
@ -50,6 +54,9 @@ func (m *Milestone) BeforeUpdate() {
|
|||
// AfterLoad is invoked from XORM after setting the value of a field of
|
||||
// this object.
|
||||
func (m *Milestone) AfterLoad() {
|
||||
if !m.UpdatedUnix.IsZero() {
|
||||
m.TimeSinceUpdate = time.Now().Unix() - m.UpdatedUnix.AsTime().Unix()
|
||||
}
|
||||
m.NumOpenIssues = m.NumIssues - m.NumClosedIssues
|
||||
if m.DeadlineUnix.Year() == 9999 {
|
||||
return
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue