Compare commits

1 Commits

Author SHA1 Message Date
0e15bf1549 chore(deps): update golang:1.25.3 docker digest to 6d4e5e7
Some checks failed
Build Docker Image / Build-Docker-Image (push) Failing after 1m27s
2025-11-05 03:06:36 +00:00
3 changed files with 14 additions and 21 deletions

View File

@@ -1,4 +1,4 @@
FROM golang:1.25.3@sha256:7e3cbcd2f6af1bebb937462ec29f77ce28b406081af509afed158fa8721f11af AS builder_go FROM golang:1.25.3@sha256:6d4e5e74f47db00f7f24da5f53c1b4198ae46862a47395e30477365458347bf2 AS builder_go
WORKDIR /spend-sparrow WORKDIR /spend-sparrow
RUN go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest RUN go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest
RUN go install github.com/a-h/templ/cmd/templ@latest RUN go install github.com/a-h/templ/cmd/templ@latest

View File

@@ -8,7 +8,6 @@ import (
"spend-sparrow/internal/service" "spend-sparrow/internal/service"
"spend-sparrow/internal/template/dashboard" "spend-sparrow/internal/template/dashboard"
"spend-sparrow/internal/utils" "spend-sparrow/internal/utils"
"strings"
"time" "time"
"github.com/google/uuid" "github.com/google/uuid"
@@ -75,17 +74,14 @@ func (handler DashboardImpl) handleDashboardMainChart() http.HandlerFunc {
w.Header().Set("Content-Type", "application/json") w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK) w.WriteHeader(http.StatusOK)
accountBuilder := strings.Builder{} account := ""
savingsBuilder := strings.Builder{} savings := ""
for _, entry := range series { for _, entry := range series {
accountBuilder.WriteString(fmt.Sprintf(`["%s",%.2f],`, entry.Day.Format(time.RFC3339), float64(entry.Value)/100)) account += fmt.Sprintf(`["%s",%.2f],`, entry.Day.Format(time.RFC3339), float64(entry.Value)/100)
savingsBuilder.WriteString(fmt.Sprintf(`["%s",%.2f],`, entry.Day.Format(time.RFC3339), float64(entry.Savings)/100)) savings += fmt.Sprintf(`["%s",%.2f],`, entry.Day.Format(time.RFC3339), float64(entry.Savings)/100)
} }
account := accountBuilder.String()
savings := savingsBuilder.String()
account = account[:len(account)-1] account = account[:len(account)-1]
savings = savings[:len(savings)-1] savings = savings[:len(savings)-1]
@@ -141,24 +137,23 @@ func (handler DashboardImpl) handleDashboardTreasureChests() http.HandlerFunc {
w.Header().Set("Content-Type", "application/json") w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK) w.WriteHeader(http.StatusOK)
dataBuilder := strings.Builder{} data := ""
for _, item := range treeList { for _, item := range treeList {
childrenBuilder := strings.Builder{} children := ""
for _, child := range item.Children { for _, child := range item.Children {
if child.Value < 0 { if child.Value < 0 {
childrenBuilder.WriteString(fmt.Sprintf(`{"name":"%s\n%.2f €","value":%d},`, child.Name, float64(child.Value)/100, -child.Value)) children += fmt.Sprintf(`{"name":"%s\n%.2f €","value":%d},`, child.Name, float64(child.Value)/100, -child.Value)
} else { } else {
childrenBuilder.WriteString(fmt.Sprintf(`{"name":"%s\n%.2f €","value":%d},`, child.Name, float64(child.Value)/100, child.Value)) children += fmt.Sprintf(`{"name":"%s\n%.2f €","value":%d},`, child.Name, float64(child.Value)/100, child.Value)
} }
} }
children := childrenBuilder.String()
children = children[:len(children)-1] children = children[:len(children)-1]
dataBuilder.WriteString(fmt.Sprintf(`{"name":"%s","children":[%s]},`, item.Name, children)) data += fmt.Sprintf(`{"name":"%s","children":[%s]},`, item.Name, children)
} }
data := dataBuilder.String()
data = data[:len(data)-1] data = data[:len(data)-1]
_, err = fmt.Fprintf(w, ` _, err = fmt.Fprintf(w, `
@@ -209,14 +204,12 @@ func (handler DashboardImpl) handleDashboardTreasureChest() http.HandlerFunc {
w.Header().Set("Content-Type", "application/json") w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK) w.WriteHeader(http.StatusOK)
valueBuilder := strings.Builder{} value := ""
for _, entry := range series { for _, entry := range series {
valueBuilder.WriteString(fmt.Sprintf(`["%s",%.2f],`, entry.Day.Format(time.RFC3339), float64(entry.Value)/100)) value += fmt.Sprintf(`["%s",%.2f],`, entry.Day.Format(time.RFC3339), float64(entry.Value)/100)
} }
value := valueBuilder.String()
if len(value) > 0 { if len(value) > 0 {
value = value[:len(value)-1] value = value[:len(value)-1]
} }

View File

@@ -152,7 +152,7 @@ func getTokenAttribute(t *testing.T, data *html.Node) string {
for _, attr := range data.Attr { for _, attr := range data.Attr {
if attr.Key == "hx-headers" { if attr.Key == "hx-headers" {
var data map[string]any var data map[string]interface{}
err := json.Unmarshal([]byte(attr.Val), &data) err := json.Unmarshal([]byte(attr.Val), &data)
require.NoError(t, err) require.NoError(t, err)
result, ok := data["Csrf-Token"].(string) result, ok := data["Csrf-Token"].(string)