feat: better flags
All checks were successful
Go / build (push) Successful in 38s

This commit is contained in:
2025-11-04 21:15:05 +01:00
parent cfbb475a42
commit e5169ee0c4
11 changed files with 57 additions and 731 deletions

View File

@@ -32,7 +32,11 @@ func FromGiteas(is []*gitea.Issue, mindur time.Duration) []Issue {
func FromGitea(i gitea.Issue) Issue {
issue := Issue{Issue: i}
issue.Duration, _ = ExtractDuration(i.Body)
var err error
issue.Duration, err = ExtractDuration(i.Body)
if err != nil {
issue.Duration = time.Second * 0
}
return issue
}
@@ -43,7 +47,7 @@ func ExtractDuration(text string) (duration time.Duration, err error) {
block := reBlock.FindStringSubmatch(text)
if len(block) < 2 {
err = fmt.Errorf("no info block found")
return
return duration, err
}
// Now extract the duration line from inside that block
@@ -51,7 +55,7 @@ func ExtractDuration(text string) (duration time.Duration, err error) {
match := reDuration.FindStringSubmatch(block[1])
if len(match) < 2 {
err = fmt.Errorf("no duration found inside info block")
return
return duration, err
}
dur := strings.TrimSpace(match[1])
dur = strings.ReplaceAll(dur, "min", "m")

View File

@@ -82,10 +82,14 @@
<article>
<div class="issue-title">
<h3>
<span style="font-family: monospace">{{ .Shorthand }}</span>: {{
.Title }}
<a href="{{ .HTMLURL }}" style="font-family: monospace"
>{{ .Shorthand }}</a
>: {{ .Title }}
</h3>
<p>Fertiggestellt: {{ .Closed | time }}</p>
<p>
{{ if .Closed }} Fertiggestellt: {{ .Closed | time }} {{else}} not
closed {{ end }}
</p>
</div>
{{ .CleanBody | md | oh 3 }}
</article>

View File

@@ -35,11 +35,11 @@ func (r Report) ToHTML() (html string, err error) {
err = tmpl.Execute(buf, tmpler{r, style})
if err != nil {
return
return html, err
}
html = buf.String()
return
return html, err
}
func (r Report) applyRate(dur time.Duration) string {