20 files changed,
9 insertions(+),
76 deletions(-)
Author:
Oleksandr Smirnov
olexsmir@gmail.com
Committed at:
2026-08-12 16:49:20 +0300
Authored at:
2026-08-12 16:17:35 +0300
Change ID:
qqwuxqltsrpmqtxwylqktuosozwkpssn
Parent:
20a67e0
jump to
M
internal/analyzer/analyzer.go
··· 35 35 Dates []ast.Date // unique transaction dats in sorted order 36 36 DateStrings []string // same order as Dates, "YYYY-MM-DD" 37 37 38 - // CommodityDecimalMarks decimal mark per commodity, detected from D/amounts. 39 - CommodityDecimalMarks map[string]byte 40 - 41 38 // TransactionsByKey groups transactions by [TxDuplicateKey] signature. 42 39 TransactionsByKey map[string][]*ast.Transaction 43 40 }
M
internal/analyzer/analyzer_test.go
··· 293 293 for _, v := range a.TagValues { 294 294 fmt.Fprintf(w, " %s\n", v) 295 295 } 296 - 297 - // commodity decimal marks 298 - csyms2 := make([]string, 0, len(a.CommodityDecimalMarks)) 299 - for sym := range a.CommodityDecimalMarks { 300 - csyms2 = append(csyms2, sym) 301 - } 302 - sort.Strings(csyms2) 303 - fmt.Fprintf(w, "\ncommodity decimal marks (%d):\n", len(a.CommodityDecimalMarks)) 304 - for _, sym := range csyms2 { 305 - fmt.Fprintf(w, " %s: %c\n", sym, a.CommodityDecimalMarks[sym]) 306 - } 307 296 }
M
internal/analyzer/build.go
··· 17 17 } 18 18 19 19 a := &Analysis{ 20 - Files: rj.Occurrences, 21 - Accounts: make(map[string]*AccountInfo), 22 - AccountAliases: make(map[string]string), 23 - Commodities: make(map[string]*CommodityInfo), 24 - Payees: make(map[string]*PayeeInfo), 25 - Tags: make(map[string]*TagInfo), 26 - AccountsByPrefix: make(map[string][]string), 27 - PayeeTemplates: make(map[string][]PostingTemplate), 28 - CommodityDecimalMarks: make(map[string]byte), 29 - TransactionsByKey: make(map[string][]*ast.Transaction), 20 + Files: rj.Occurrences, 21 + Accounts: make(map[string]*AccountInfo), 22 + AccountAliases: make(map[string]string), 23 + Commodities: make(map[string]*CommodityInfo), 24 + Payees: make(map[string]*PayeeInfo), 25 + Tags: make(map[string]*TagInfo), 26 + AccountsByPrefix: make(map[string][]string), 27 + PayeeTemplates: make(map[string][]PostingTemplate), 28 + TransactionsByKey: make(map[string][]*ast.Transaction), 30 29 } 31 30 for _, item := range rj.Items { 32 31 if item.IsInclude { ··· 95 94 a.addCommentTags(fileIndex, nil, e.Comment) 96 95 for _, c := range e.HeaderComments { 97 96 a.addCommentTags(fileIndex, nil, c) 98 - } 99 - case *ast.DefaultCommodityDirective: 100 - if e.Amount.Commodity != "" { 101 - mark := e.Amount.QuantityFmt.Decimal 102 - if mark != 0 { 103 - a.CommodityDecimalMarks[e.Amount.Commodity] = mark 104 - } 105 97 } 106 98 } 107 99 ··· 234 226 a.addCommentTags(fileIndex, date, posting.Comment) 235 227 for i := range posting.Comments { 236 228 a.addCommentTags(fileIndex, date, &posting.Comments[i]) 237 - } 238 - 239 - // Collect decimal mark from amount formatting. 240 - if posting.Amount != nil && posting.Amount.Commodity != "" && posting.Amount.QuantityFmt.Decimal != 0 { 241 - if _, ok := a.CommodityDecimalMarks[posting.Amount.Commodity]; !ok { 242 - a.CommodityDecimalMarks[posting.Amount.Commodity] = posting.Amount.QuantityFmt.Decimal 243 - } 244 229 } 245 230 } 246 231 }