This commit is contained in:
stuzer05 2023-02-24 19:44:24 +02:00
parent f463765fec
commit 7a570440f1
4 changed files with 11 additions and 9 deletions

View File

@ -221,7 +221,7 @@ func TotalTimes(options *FindTrackedTimesOptions) (map[*user_model.User]string,
} }
return nil, err return nil, err
} }
totalTimes[user] = util.SecToTimeExact(total) totalTimes[user] = util.SecToTimeExact(total, false)
} }
return totalTimes, nil return totalTimes, nil
} }

View File

@ -64,7 +64,7 @@ func SecToTime(duration int64) string {
return strings.TrimRight(formattedTime, " ") return strings.TrimRight(formattedTime, " ")
} }
func SecToTimeExact(duration int64) string { func SecToTimeExact(duration int64, withSeconds bool) string {
formattedTime := "" formattedTime := ""
// The following four variables are calculated by taking // The following four variables are calculated by taking
@ -93,7 +93,9 @@ func SecToTimeExact(duration int64) string {
formattedTime = formatTime(days, "day", formattedTime) formattedTime = formatTime(days, "day", formattedTime)
formattedTime = formatTime(hours, "hour", formattedTime) formattedTime = formatTime(hours, "hour", formattedTime)
formattedTime = formatTime(minutes, "minute", formattedTime) formattedTime = formatTime(minutes, "minute", formattedTime)
formattedTime = formatTime(seconds, "second", formattedTime) if withSeconds {
formattedTime = formatTime(seconds, "second", formattedTime)
}
// The formatTime() function always appends a space at the end. This will be trimmed // The formatTime() function always appends a space at the end. This will be trimmed
return strings.TrimRight(formattedTime, " ") return strings.TrimRight(formattedTime, " ")

View File

@ -263,7 +263,7 @@
{{template "repo/issue/view_content/comments_delete_time" Dict "ctx" $ "comment" .}} {{template "repo/issue/view_content/comments_delete_time" Dict "ctx" $ "comment" .}}
<div class="detail"> <div class="detail">
{{svg "octicon-clock"}} {{svg "octicon-clock"}}
<span class="text grey muted-links">{{SecToTimeExact .TimeTracked}}</span> <span class="text grey muted-links">{{SecToTimeExact .TimeTracked false}}</span>
</div> </div>
</div> </div>
{{else if eq .Type 14}} {{else if eq .Type 14}}
@ -277,7 +277,7 @@
{{template "repo/issue/view_content/comments_delete_time" Dict "ctx" $ "comment" .}} {{template "repo/issue/view_content/comments_delete_time" Dict "ctx" $ "comment" .}}
<div class="detail"> <div class="detail">
{{svg "octicon-clock"}} {{svg "octicon-clock"}}
<span class="text grey muted-links">{{SecToTimeExact .TimeTracked}}</span> <span class="text grey muted-links">{{SecToTimeExact .TimeTracked false}}</span>
</div> </div>
</div> </div>
{{else if eq .Type 15}} {{else if eq .Type 15}}
@ -668,7 +668,7 @@
</span> </span>
<div class="detail"> <div class="detail">
{{svg "octicon-clock"}} {{svg "octicon-clock"}}
<span class="text grey muted-links">- {{SecToTimeExact .TimeTracked}}</span> <span class="text grey muted-links">- {{SecToTimeExact .TimeTracked false}}</span>
</div> </div>
</div> </div>
{{else if eq .Type 27}} {{else if eq .Type 27}}
@ -802,7 +802,7 @@
{{if and (eq .TimeEstimate 0)}} {{if and (eq .TimeEstimate 0)}}
{{$.locale.Tr "repo.issues.remove_time_estimate" $createdStr | Safe}} {{$.locale.Tr "repo.issues.remove_time_estimate" $createdStr | Safe}}
{{else}} {{else}}
{{$.locale.Tr "repo.issues.change_time_estimate_at" (SecToTimeExact .TimeEstimate) $createdStr | Safe}} {{$.locale.Tr "repo.issues.change_time_estimate_at" (SecToTimeExact .TimeEstimate false) $createdStr | Safe}}
{{end}} {{end}}
</span> </span>
</div> </div>

View File

@ -365,7 +365,7 @@
<form method="POST" id="set_time_estimate_form" class="gt-mt-3" action="{{.Issue.Link}}/time_estimate"> <form method="POST" id="set_time_estimate_form" class="gt-mt-3" action="{{.Issue.Link}}/time_estimate">
{{$.CsrfTokenHtml}} {{$.CsrfTokenHtml}}
<div class="ui input fluid"> <div class="ui input fluid">
<input name="time_estimate" placeholder='{{.locale.Tr "repo.issues.add_time_estimate"}}' value="{{ ($.Issue.TimeEstimateToStr) }}" type="text" > <input name="time_estimate" placeholder='{{.locale.Tr "repo.issues.add_time_estimate"}}' value="{{($.Issue.TimeEstimateToStr)}}" type="text" >
</div> </div>
<button class="ui fluid button green tooltip gt-mt-3"> <button class="ui fluid button green tooltip gt-mt-3">
{{.locale.Tr "repo.issues.save"}} {{.locale.Tr "repo.issues.save"}}
@ -414,7 +414,7 @@
<div class="ui divider"></div> <div class="ui divider"></div>
<div class="ui comments"> <div class="ui comments">
<div class="text"><strong>{{.locale.Tr "repo.issues.time_spent_from_all_authors" | Safe}}</strong></div> <div class="text"><strong>{{.locale.Tr "repo.issues.time_spent_from_all_authors" | Safe}}</strong></div>
<div>{{SecToTimeExact .Issue.TotalTrackedTime}}</div> <div>{{SecToTimeExact .Issue.TotalTrackedTime false}}</div>
<div class="gt-mt-3"> <div class="gt-mt-3">
{{range $user, $trackedtime := .WorkingUsers}} {{range $user, $trackedtime := .WorkingUsers}}
<div class="comment gt-mt-3"> <div class="comment gt-mt-3">