Fix missing foil count in web view

This commit is contained in:
Florian Baumann 2024-09-14 20:23:49 +02:00
parent 4d0e75d806
commit 541a4bbd19
2 changed files with 9 additions and 1 deletions

View File

@ -3,6 +3,7 @@ package serra
import (
"net/http"
"strconv"
"text/template"
"github.com/gin-gonic/gin"
"github.com/spf13/cobra"
@ -16,6 +17,10 @@ func init() {
rootCmd.AddCommand(webCmd)
}
func add(a, b int64) int64 {
return a + b
}
var webCmd = &cobra.Command{
Aliases: []string{"a"},
Use: "web",
@ -38,6 +43,9 @@ type Query struct {
func startWeb() error {
router := gin.Default()
router.SetFuncMap(template.FuncMap{
"add": add,
})
router.LoadHTMLGlob("templates/*.tmpl")
router.Static("/assets", "./assets")

View File

@ -168,7 +168,7 @@
<tbody>
{{range .cards}}
<tr>
<td>{{.SerraCount}}</td>
<td>{{ add .SerraCount .SerraCountFoil }}</td>
<td>
<div class="cardpreview"><strong>{{.Name }}</strong>
<span class="cardpreviewtext">