fix: expenses without tag crashes reports page
All checks were successful
Deploy / build-and-deploy (push) Successful in 2m18s
All checks were successful
Deploy / build-and-deploy (push) Successful in 2m18s
This commit is contained in:
parent
4b0b5902f6
commit
cbb14ffba2
2 changed files with 2 additions and 2 deletions
|
|
@ -47,6 +47,6 @@ type ExpenseItem struct {
|
||||||
type TagExpenseSummary struct {
|
type TagExpenseSummary struct {
|
||||||
TagID string `db:"tag_id"`
|
TagID string `db:"tag_id"`
|
||||||
TagName string `db:"tag_name"`
|
TagName string `db:"tag_name"`
|
||||||
TagColor string `db:"tag_color"`
|
TagColor *string `db:"tag_color"`
|
||||||
TotalAmount int `db:"total_amount"`
|
TotalAmount int `db:"total_amount"`
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ templ ReportCharts(spaceID string, report *model.SpendingReport, from, to time.T
|
||||||
for i, t := range report.ByTag {
|
for i, t := range report.ByTag {
|
||||||
tagLabels[i] = t.TagName
|
tagLabels[i] = t.TagName
|
||||||
tagData[i] = float64(t.TotalAmount) / 100.0
|
tagData[i] = float64(t.TotalAmount) / 100.0
|
||||||
tagColors[i] = chartColor(i, &t.TagColor)
|
tagColors[i] = chartColor(i, t.TagColor)
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
@chart.Chart(chart.Props{
|
@chart.Chart(chart.Props{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue