fix(parser): correct priority calculation for 'Z' to return 0
Previously, the priority calculation did not handle 'Z' correctly, resulting in a non-zero value. Now, 'Z' returns 0 as intended, and the step size is calculated for a linear scale.
This commit is contained in:
@@ -35,8 +35,12 @@ func (t Task) PriorityAsRemind() int {
|
|||||||
if p < 'A' || p > 'Z' {
|
if p < 'A' || p > 'Z' {
|
||||||
return 5000
|
return 5000
|
||||||
}
|
}
|
||||||
// A=9999, Z=0, linear scale
|
step := 9999 / 25 // 399
|
||||||
return 9999 - int(p-'A')*400
|
val := 9999 - int(p-'A')*step
|
||||||
|
if p == 'Z' {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
return val
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t Task) MarshalJSON() ([]byte, error) {
|
func (t Task) MarshalJSON() ([]byte, error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user