diff --git a/models/issue_tracked_time_test.go b/models/issue_tracked_time_test.go index e6c9caf90013..68e78c71c726 100644 --- a/models/issue_tracked_time_test.go +++ b/models/issue_tracked_time_test.go @@ -34,7 +34,7 @@ func TestAddTime(t *testing.T) { assert.Equal(t, int64(3661), tt.Time) comment := unittest.AssertExistsAndLoadBean(t, &Comment{Type: CommentTypeAddTimeManual, PosterID: 3, IssueID: 1}).(*Comment) - assert.Equal(t, comment.Content, "1h 1m 1s") + assert.Equal(t, comment.Content, "1 hour 1 minute") } func TestGetTrackedTimes(t *testing.T) { @@ -86,7 +86,7 @@ func TestTotalTimes(t *testing.T) { assert.Len(t, total, 1) for user, time := range total { assert.Equal(t, int64(1), user.ID) - assert.Equal(t, "6m 40s", time) + assert.Equal(t, "6 minutes 40 seconds", time) } total, err = TotalTimes(&FindTrackedTimesOptions{IssueID: 2}) @@ -94,9 +94,9 @@ func TestTotalTimes(t *testing.T) { assert.Len(t, total, 2) for user, time := range total { if user.ID == 2 { - assert.Equal(t, "1h 1m 2s", time) + assert.Equal(t, "1 hour 1 minute", time) } else if user.ID == 1 { - assert.Equal(t, "20s", time) + assert.Equal(t, "20 seconds", time) } else { assert.Error(t, assert.AnError) } @@ -107,7 +107,7 @@ func TestTotalTimes(t *testing.T) { assert.Len(t, total, 1) for user, time := range total { assert.Equal(t, int64(2), user.ID) - assert.Equal(t, "1s", time) + assert.Equal(t, "1 second", time) } total, err = TotalTimes(&FindTrackedTimesOptions{IssueID: 4}) diff --git a/models/migrations/v210.go b/models/migrations/v210.go index cf50760b92c3..9da8ca9db664 100644 --- a/models/migrations/v210.go +++ b/models/migrations/v210.go @@ -11,8 +11,8 @@ import ( "strings" "code.gitea.io/gitea/modules/timeutil" - "github.com/tstranex/u2f" + "github.com/tstranex/u2f" "xorm.io/xorm" "xorm.io/xorm/schemas" ) diff --git a/models/migrations/v210_test.go b/models/migrations/v210_test.go index 3e10b3ce80a2..70dbe61b06eb 100644 --- a/models/migrations/v210_test.go +++ b/models/migrations/v210_test.go @@ -8,6 +8,7 @@ import ( "testing" "code.gitea.io/gitea/modules/timeutil" + "github.com/stretchr/testify/assert" "xorm.io/xorm/schemas" ) diff --git a/modules/util/sec_to_time.go b/modules/util/sec_to_time.go index 2a5f96f71cca..5bf87b6ebe42 100644 --- a/modules/util/sec_to_time.go +++ b/modules/util/sec_to_time.go @@ -57,7 +57,7 @@ func SecToTime(duration int64) string { // formattedTime = "1 year" // input: value = 3, name = "month" // output will be "1 year 3 months" -func FormatTime(value int64, name string, formattedTime string) string { +func FormatTime(value int64, name, formattedTime string) string { if value == 1 { formattedTime = fmt.Sprintf("%s1 %s ", formattedTime, name) } else if value > 1 {