From adbc2cf364a75d76542f8b130575eb674955b74e Mon Sep 17 00:00:00 2001 From: Paolo Donadeo Date: Wed, 26 Nov 2025 16:24:28 +0100 Subject: [PATCH] fix(parser): improve priority calculation accuracy using math.Round Refactored PriorityAsRemind to use floating point division and rounding for more precise priority mapping. --- internal/parser/parser.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/internal/parser/parser.go b/internal/parser/parser.go index b6eba21..cb0721c 100644 --- a/internal/parser/parser.go +++ b/internal/parser/parser.go @@ -6,6 +6,7 @@ import ( "errors" "fmt" "io" + "math" "regexp" "strings" "time" @@ -104,12 +105,10 @@ func (t Task) PriorityAsRemind() int { if p < 'A' || p > 'Z' { return 5000 } - step := 9999 / 25 // 399 - val := 9999 - int(p-'A')*step - if p == 'Z' { - return 0 - } - return val + pInt := int(p) - 65 // 'A' = 65 + value := 9999 - (float64(pInt) * (float64(9999) / float64(25))) + value = math.Round(value) + return int(value) } func (t Task) MarshalJSON() ([]byte, error) {