ananthakumaran/paisa

Balance assertions

Sinderella opened this issue · 0 comments

Describe your Environment
OS: Docker container on a linux host and macOS Sonoma (silicon)
Paisa Version: 0.6.2
App Variant: CLI and Web

Describe the bug
I'm trying out both ledger and hledger as I like paisa's UI, so I am a newbie in the area. I started using balance assertions and it seems like paisa crashes as it cannot parse the amount somehow.

To Reproduce
Steps to reproduce the behavior:

  1. Try to sync the provided journal and got the following error log.
2024/01/03 10:55:11 [Recovery] 2024/01/03 - 10:55:11 panic recovered:
runtime error: index out of range [0] with length 0
/usr/local/go/src/runtime/panic.go:113 (0x43ab9e)
/usr/src/paisa/internal/ledger/ledger.go:786 (0x926ef8)
/usr/src/paisa/internal/ledger/ledger.go:173 (0x9215bd)
/usr/src/paisa/internal/model/model.go:59 (0x92dca5)
/usr/src/paisa/internal/server/sync.go:20 (0xae6e4e)
/usr/src/paisa/internal/server/server.go:109 (0xae5d9d)
/go/pkg/mod/github.com/gin-gonic/gin@v1.8.1/context.go:173 (0xae6bf3)
/usr/src/paisa/internal/server/server.go:378 (0xae6bd7)
/go/pkg/mod/github.com/gin-gonic/gin@v1.8.1/context.go:173 (0xaaa681)
/go/pkg/mod/github.com/gin-gonic/gin@v1.8.1/recovery.go:101 (0xaaa66c)
/go/pkg/mod/github.com/gin-gonic/gin@v1.8.1/context.go:173 (0xadbd03)
/usr/src/paisa/internal/server/logger.go:18 (0xadbce0)
/go/pkg/mod/github.com/gin-gonic/gin@v1.8.1/context.go:173 (0xac4961)
/go/pkg/mod/github.com/gin-contrib/gzip@v0.0.6/handler.go:60 (0xac4939)
/go/pkg/mod/github.com/gin-gonic/gin@v1.8.1/context.go:173 (0xaa94ea)
/go/pkg/mod/github.com/gin-gonic/gin@v1.8.1/gin.go:616 (0xaa9171)
/go/pkg/mod/github.com/gin-gonic/gin@v1.8.1/gin.go:572 (0xaa8c9c)
/usr/local/go/src/net/http/server.go:2936 (0x833a55)
/usr/local/go/src/net/http/server.go:1995 (0x82ef71)
/usr/local/go/src/runtime/asm_amd64.s:1598 (0x46f7a0)

Expected behavior
It should parse just fine.

Screenshots
N/A

Journal
If applicable, provide a minimal journal to help explain your problem.

account assets   ; type:A
account equity   ; type:E

2024-01-02 * test
  assets  $1
  equity

2024-01-03 * test2
  assets  =$1

Thanks!