Compare commits

..

2 Commits

Author SHA1 Message Date
676ef83e50 chore: bump version to v2 in main.go 2025-11-26 16:24:55 +01:00
adbc2cf364 fix(parser): improve priority calculation accuracy using math.Round
Refactored PriorityAsRemind to use floating point division and rounding
for more precise priority mapping.
2025-11-26 16:24:28 +01:00
2 changed files with 6 additions and 7 deletions

View File

@@ -6,6 +6,7 @@ import (
"errors" "errors"
"fmt" "fmt"
"io" "io"
"math"
"regexp" "regexp"
"strings" "strings"
"time" "time"
@@ -104,12 +105,10 @@ func (t Task) PriorityAsRemind() int {
if p < 'A' || p > 'Z' { if p < 'A' || p > 'Z' {
return 5000 return 5000
} }
step := 9999 / 25 // 399 pInt := int(p) - 65 // 'A' = 65
val := 9999 - int(p-'A')*step value := 9999 - (float64(pInt) * (float64(9999) / float64(25)))
if p == 'Z' { value = math.Round(value)
return 0 return int(value)
}
return val
} }
func (t Task) MarshalJSON() ([]byte, error) { func (t Task) MarshalJSON() ([]byte, error) {

View File

@@ -14,7 +14,7 @@ var (
inputFile string inputFile string
outputFile string outputFile string
debug bool debug bool
version = "1" version = "v2"
) )
func main() { func main() {