1
1
mirror of https://github.com/go-gitea/gitea synced 2025-09-28 03:28:13 +00:00

Improve ui for builds

This commit is contained in:
Lunny Xiao
2022-10-19 22:31:05 +08:00
committed by Jason Song
parent d69423a3b0
commit 3518c098b9
6 changed files with 75 additions and 47 deletions

View File

@@ -8,6 +8,7 @@ import (
"context"
"fmt"
"hash/fnv"
"time"
"code.gitea.io/gitea/core"
"code.gitea.io/gitea/models/db"
@@ -84,6 +85,10 @@ func (r *Run) LoadAttributes(ctx context.Context) error {
return nil
}
func (run *Run) TakeTime() time.Duration {
return run.EndTime.AsTime().Sub(run.StartTime.AsTime())
}
func updateRepoRunsNumbers(ctx context.Context, repo *repo_model.Repository) error {
_, err := db.GetEngine(ctx).ID(repo.ID).
SetExpr("num_runs",