Skip to content

Commit 541a4bb

Browse files
committed
Fix missing foil count in web view
1 parent 4d0e75d commit 541a4bb

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

pkg/serra/web.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package serra
33
import (
44
"net/http"
55
"strconv"
6+
"text/template"
67

78
"github.com/gin-gonic/gin"
89
"github.com/spf13/cobra"
@@ -16,6 +17,10 @@ func init() {
1617
rootCmd.AddCommand(webCmd)
1718
}
1819

20+
func add(a, b int64) int64 {
21+
return a + b
22+
}
23+
1924
var webCmd = &cobra.Command{
2025
Aliases: []string{"a"},
2126
Use: "web",
@@ -38,6 +43,9 @@ type Query struct {
3843

3944
func startWeb() error {
4045
router := gin.Default()
46+
router.SetFuncMap(template.FuncMap{
47+
"add": add,
48+
})
4149
router.LoadHTMLGlob("templates/*.tmpl")
4250
router.Static("/assets", "./assets")
4351

templates/index.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@
168168
<tbody>
169169
{{range .cards}}
170170
<tr>
171-
<td>{{.SerraCount}}</td>
171+
<td>{{ add .SerraCount .SerraCountFoil }}</td>
172172
<td>
173173
<div class="cardpreview"><strong>{{.Name }}</strong>
174174
<span class="cardpreviewtext">

0 commit comments

Comments
 (0)