diff options
author | 6543 <m.huber@kithara.com> | 2023-06-19 18:40:06 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-19 18:40:06 +0200 |
commit | 749802c9223b787c2681faac6e1f8798df219d50 (patch) | |
tree | 1711697f33f7d4049eddff44f9bf07e2617e247b /models/issues/tracked_time.go | |
parent | bd2e3226bea9a9af077d7a4991d45b716209f563 (diff) | |
download | gitea-749802c9223b787c2681faac6e1f8798df219d50.tar.gz gitea-749802c9223b787c2681faac6e1f8798df219d50.zip |
Refactor: TotalTimest return seconds (#25370)
so template/browser can deal with string format
---
*Sponsored by Kithara Software GmbH*
Diffstat (limited to 'models/issues/tracked_time.go')
-rw-r--r-- | models/issues/tracked_time.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/models/issues/tracked_time.go b/models/issues/tracked_time.go index ac65d654f2..698014afeb 100644 --- a/models/issues/tracked_time.go +++ b/models/issues/tracked_time.go @@ -199,8 +199,8 @@ func addTime(ctx context.Context, user *user_model.User, issue *Issue, amount in return tt, db.Insert(ctx, tt) } -// TotalTimes returns the spent time for each user by an issue -func TotalTimes(options *FindTrackedTimesOptions) (map[*user_model.User]string, error) { +// TotalTimes returns the spent time in seconds for each user by an issue +func TotalTimes(options *FindTrackedTimesOptions) (map[*user_model.User]int64, error) { trackedTimes, err := GetTrackedTimes(db.DefaultContext, options) if err != nil { return nil, err @@ -211,7 +211,7 @@ func TotalTimes(options *FindTrackedTimesOptions) (map[*user_model.User]string, totalTimesByUser[t.UserID] += t.Time } - totalTimes := make(map[*user_model.User]string) + totalTimes := make(map[*user_model.User]int64) // Fetching User and making time human readable for userID, total := range totalTimesByUser { user, err := user_model.GetUserByID(db.DefaultContext, userID) @@ -221,7 +221,7 @@ func TotalTimes(options *FindTrackedTimesOptions) (map[*user_model.User]string, } return nil, err } - totalTimes[user] = util.SecToTime(total) + totalTimes[user] = total } return totalTimes, nil } |