From 09cc4e3f841475a0e0e6676ed3e65a06a53a8319 Mon Sep 17 00:00:00 2001 From: zhoupzh Date: Thu, 22 Dec 2022 10:26:58 +0800 Subject: [PATCH] fix issue --- modules/templates/helper.go | 6 ++---- templates/custom/task_wait_count.tmpl | 31 +++++++++++++++---------------- 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/modules/templates/helper.go b/modules/templates/helper.go index 115246eab..441c3d558 100755 --- a/modules/templates/helper.go +++ b/modules/templates/helper.go @@ -471,10 +471,8 @@ func Str2html(raw string) template.HTML { func subOne(length int) int { return length - 1 } -func addOne(i interface{}) int64 { - if i>=0 { - return i + 1 - } +func addOne(length int64) int64 { + return length + 1 } // Escape escapes a HTML string func Escape(raw string) string { diff --git a/templates/custom/task_wait_count.tmpl b/templates/custom/task_wait_count.tmpl index 73ecac3ac..53405b0dd 100644 --- a/templates/custom/task_wait_count.tmpl +++ b/templates/custom/task_wait_count.tmpl @@ -1,26 +1,25 @@
- {{.i18n.Tr "repo.wait_count_start"}} {{addOne .WaitCount}} {{.i18n.Tr "repo.wait_count_end"}} + {{.i18n.Tr "repo.wait_count_start"}} {{if .WaitCount}}1{{else}}{{addOne .WaitCount}}{{end}} {{.i18n.Tr "repo.wait_count_end"}}